Merge
authorvaleriep
Thu, 21 Nov 2013 11:58:51 -0800
changeset 21838 72472170840d
parent 21837 0c41fa97176a (current diff)
parent 21836 e41f1922c8a7 (diff)
child 21839 31c719abe9ec
child 21842 81911f748777
Merge
--- a/jdk/src/share/classes/java/lang/annotation/ElementType.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/src/share/classes/java/lang/annotation/ElementType.java	Thu Nov 21 11:58:51 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,49 @@
 package java.lang.annotation;
 
 /**
- * A program element type.  The constants of this enumerated type
- * provide a simple classification of the declared elements in a
- * Java program.
+ * The constants of this enumerated type provide a simple classification of the
+ * syntactic locations where annotations may appear in a Java program. These
+ * constants are used in {@link Target java.lang.annotation.Target}
+ * meta-annotations to specify where it is legal to write annotations of a
+ * given type.
+ *
+ * <p>The syntactic locations where annotations may appear are split into
+ * <em>declaration contexts</em> , where annotations apply to declarations, and
+ * <em>type contexts</em> , where annotations apply to types used in
+ * declarations and expressions.
+ *
+ * <p>The constants {@link #ANNOTATION_TYPE} , {@link #CONSTRUCTOR} , {@link
+ * #FIELD} , {@link #LOCAL_VARIABLE} , {@link #METHOD} , {@link #PACKAGE} ,
+ * {@link #PARAMETER} , {@link #TYPE} , and {@link #TYPE_PARAMETER} correspond
+ * to the declaration contexts in JLS 9.6.4.1.
  *
- * <p>These constants are used with the {@link Target} meta-annotation type
- * to specify where it is legal to use an annotation type.
+ * <p>For example, an annotation whose type is meta-annotated with
+ * {@code @Target(ElementType.FIELD)} may only be written as a modifier for a
+ * field declaration.
+ *
+ * <p>The constant {@link #TYPE_USE} corresponds to the 15 type contexts in JLS
+ * 4.11, as well as to two declaration contexts: type declarations (including
+ * annotation type declarations) and type parameter declarations.
+ *
+ * <p>For example, an annotation whose type is meta-annotated with
+ * {@code @Target(ElementType.TYPE_USE)} may be written on the type of a field
+ * (or within the type of the field, if it is a nested, parameterized, or array
+ * type), and may also appear as a modifier for, say, a class declaration.
+ *
+ * <p>The {@code TYPE_USE} constant includes type declarations and type
+ * parameter declarations as a convenience for designers of type checkers which
+ * give semantics to annotation types. For example, if the annotation type
+ * {@code NonNull} is meta-annotated with
+ * {@code @Target(ElementType.TYPE_USE)}, then {@code @NonNull}
+ * {@code class C {...}} could be treated by a type checker as indicating that
+ * all variables of class {@code C} are non-null, while still allowing
+ * variables of other classes to be non-null or not non-null based on whether
+ * {@code @NonNull} appears at the variable's declaration.
  *
  * @author  Joshua Bloch
  * @since 1.5
+ * @jls 9.6.4.1 @Target
+ * @jls 4.1 The Kinds of Types and Values
  */
 public enum ElementType {
     /** Class, interface (including annotation type), or enum declaration */
--- a/jdk/src/share/classes/java/lang/annotation/Target.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/src/share/classes/java/lang/annotation/Target.java	Thu Nov 21 11:58:51 2013 -0800
@@ -26,33 +26,42 @@
 package java.lang.annotation;
 
 /**
- * Indicates the kinds of program element to which an annotation type
- * is applicable.  If a Target meta-annotation is not present on an
- * annotation type declaration, the declared type may be used on any
- * program element.  If such a meta-annotation is present, the compiler
- * will enforce the specified usage restriction.
+ * Indicates the contexts in which an annotation type is applicable. The
+ * declaration contexts and type contexts in which an annotation type may be
+ * applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
+ * constants of {@link ElementType java.lang.annotation.ElementType}.
  *
- * For example, this meta-annotation indicates that the declared type is
- * itself a meta-annotation type.  It can only be used on annotation type
- * declarations:
+ * <p>If an {@code @Target} meta-annotation is not present on an annotation type
+ * {@code T} , then an annotation of type {@code T} may be written as a
+ * modifier for any declaration except a type parameter declaration.
+ *
+ * <p>If an {@code @Target} meta-annotation is present, the compiler will enforce
+ * the usage restrictions indicated by {@code ElementType}
+ * enum constants, in line with JLS 9.7.4.
+ *
+ * <p>For example, this {@code @Target} meta-annotation indicates that the
+ * declared type is itself a meta-annotation type.  It can only be used on
+ * annotation type declarations:
  * <pre>
  *    &#064;Target(ElementType.ANNOTATION_TYPE)
  *    public &#064;interface MetaAnnotationType {
  *        ...
  *    }
  * </pre>
- * This meta-annotation indicates that the declared type is intended solely
- * for use as a member type in complex annotation type declarations.  It
- * cannot be used to annotate anything directly:
+ *
+ * <p>This {@code @Target} meta-annotation indicates that the declared type is
+ * intended solely for use as a member type in complex annotation type
+ * declarations.  It cannot be used to annotate anything directly:
  * <pre>
  *    &#064;Target({})
  *    public &#064;interface MemberType {
  *        ...
  *    }
  * </pre>
- * It is a compile-time error for a single ElementType constant to
- * appear more than once in a Target annotation.  For example, the
- * following meta-annotation is illegal:
+ *
+ * <p>It is a compile-time error for a single {@code ElementType} constant to
+ * appear more than once in an {@code @Target} annotation.  For example, the
+ * following {@code @Target} meta-annotation is illegal:
  * <pre>
  *    &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
  *    public &#064;interface Bogus {
@@ -61,7 +70,8 @@
  * </pre>
  *
  * @since 1.5
- * @jls 9.6.3.1 @Target
+ * @jls 9.6.4.1 @Target
+ * @jls 9.7.4 Where Annotations May Appear
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
--- a/jdk/test/ProblemList.txt	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/ProblemList.txt	Thu Nov 21 11:58:51 2013 -0800
@@ -129,9 +129,6 @@
 
 # jdk_management
 
-# 8010897
-sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	macosx-all
-
 # 8028150
 sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	windows-all
 
@@ -153,13 +150,6 @@
 # 7027502
 demo/jvmti/hprof/MonitorTest.java                               generic-all
 
-# 8024423 - JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
-demo/jvmti/hprof/HeapAllTest.java                               generic-all
-demo/jvmti/hprof/HeapBinaryFormatTest.java                      generic-all
-demo/jvmti/hprof/HeapDumpTest.java                              generic-all
-demo/jvmti/hprof/OptionsTest.java                               generic-all
-demo/jvmti/hprof/StackMapTableTest.java                         generic-all
-
 # 8027973
 javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java		windows-all
 
@@ -170,9 +160,6 @@
 # Filed 7052625
 com/sun/net/httpserver/bugs/6725892/Test.java                   generic-all
 
-# Filed 7036666
-com/sun/net/httpserver/Test9a.java                              generic-all
-
 # failing on vista 32/64 on nightly
 # 7102702
 java/net/PortUnreachableException/OneExceptionOnly.java         windows-all
@@ -307,9 +294,6 @@
 # Filed 6653793
 com/sun/jdi/RedefineCrossEvent.java                             generic-all
 
-# Filed 6402201
-com/sun/jdi/ProcessAttachTest.sh                                generic-all
-
 ############################################################################
 
 # jdk_util
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/se/impl/orb/SetDefaultORBTest.java	Thu Nov 21 11:58:51 2013 -0800
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8028215
+ * @summary SetDefaultORBTest setting ORB impl via properties test
+ * @run main/othervm SetDefaultORBTest
+ *
+ */
+
+import java.util.Properties;
+
+import org.omg.CORBA.ORB;
+
+
+public class SetDefaultORBTest {
+
+    public static void main(String[] args) {
+        Properties systemProperties = System.getProperties();
+        systemProperties.setProperty("org.omg.CORBA.ORBSingletonClass",
+                "com.sun.corba.se.impl.orb.ORBSingleton");
+        System.setSecurityManager(new SecurityManager());
+        Properties props = new Properties();
+        props.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
+        ORB orb = ORB.init(args, props);
+        Class<?> orbClass = orb.getClass();
+        if (orbClass.getName().equals("com.sun.corba.se.impl.orb.ORBImpl")) {
+            System.out.println("orbClass is com.sun.corba.se.impl.orb.ORBimpl  as expected");
+        } else {
+            throw new RuntimeException("com.sun.corba.se.impl.orb.ORBimpl class expected for ORBImpl");
+        }
+        ORB singletonORB = ORB.init();
+        Class<?> singletoneOrbClass = singletonORB.getClass();
+        if (singletoneOrbClass.getName().equals("com.sun.corba.se.impl.orb.ORBSingleton")) {
+            System.out.println("singeletonOrbClass is com.sun.corba.se.impl.orb.ORBSingleton  as expected");
+        } else {
+            throw new RuntimeException("com.sun.corba.se.impl.orb.ORBSingleton class expected for ORBSingleton");
+        }
+    }
+}
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh	Thu Nov 21 11:58:51 2013 -0800
@@ -60,7 +60,7 @@
     public static void main(String[] args) {
         for (int i = 0; i < 10; i++) {
             System.out.println("top of loop");     // @1 breakpoint
-            init(1000000);
+            init(500000);
             objList.clear();
             System.gc();
             System.out.println("bottom of loop");  // @1 breakpoint
--- a/jdk/test/com/sun/jdi/ProcessAttachDebuggee.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/com/sun/jdi/ProcessAttachDebuggee.java	Thu Nov 21 11:58:51 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,9 @@
  */
 import java.net.Socket;
 import java.net.ServerSocket;
+import java.nio.file.CopyOption;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.io.File;
 import java.io.FileOutputStream;
 
@@ -39,10 +42,12 @@
         int port = ss.getLocalPort();
 
         // Write the port number to the given file
-        File f = new File(args[0]);
-        FileOutputStream fos = new FileOutputStream(f);
-        fos.write( Integer.toString(port).getBytes("UTF-8") );
-        fos.close();
+        File partial = new File(args[0] + ".partial");
+        File portFile = new File(args[0]);
+        try (FileOutputStream fos = new FileOutputStream(partial)) {
+            fos.write( Integer.toString(port).getBytes("UTF-8") );
+        }
+        Files.move(partial.toPath(), portFile.toPath(), StandardCopyOption.ATOMIC_MOVE);
 
         System.out.println("Debuggee bound to port: " + port);
         System.out.flush();
--- a/jdk/test/com/sun/jdi/ProcessAttachTest.sh	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/com/sun/jdi/ProcessAttachTest.sh	Thu Nov 21 11:58:51 2013 -0800
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -158,7 +158,17 @@
 # The debuggee is suspended and doesn't run until the debugger
 # disconnects.  We have to give it time to write the port number
 # to ${PORTFILE}
-sleep 10
+
+echo "Waiting for port file to be written..."
+attempts=0
+while true; do
+  sleep 1
+  attempts=`expr $attempts + 1`
+  if [ -f  ${PORTFILE} ]; then
+    break
+  fi
+  echo "Waiting $attempts second(s) ..."
+done
 
 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
 stopDebuggee "${PORTFILE}"
--- a/jdk/test/com/sun/net/httpserver/Test9a.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/com/sun/net/httpserver/Test9a.java	Thu Nov 21 11:58:51 2013 -0800
@@ -40,8 +40,9 @@
 
 public class Test9a extends Test {
 
-    static SSLContext serverCtx, clientCtx;
-    static boolean error = false;
+    static SSLContext serverCtx;
+    static volatile SSLContext clientCtx = null;
+    static volatile boolean error = false;
 
     public static void main (String[] args) throws Exception {
         HttpsServer server = null;
@@ -176,6 +177,7 @@
                 compare (new File(orig), temp);
                 temp.delete();
             } catch (IOException e) {
+                e.printStackTrace();
                 error = true;
             }
         }
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Thu Nov 21 11:58:51 2013 -0800
@@ -561,9 +561,10 @@
         System.getProperty("java.class.path");
 
     private static final List<String> javaChildArgs =
-        Arrays.asList(new String[]
-            { javaExe, "-classpath", absolutifyPath(classpath),
-              "Basic$JavaChild"});
+        Arrays.asList(javaExe,
+                      "-XX:+DisplayVMOutputToStderr",
+                      "-classpath", absolutifyPath(classpath),
+                      "Basic$JavaChild");
 
     private static void testEncoding(String encoding, String tested) {
         try {
@@ -1627,8 +1628,8 @@
                                       javaExe));
             list.add("ArrayOOME");
             ProcessResults r = run(new ProcessBuilder(list));
-            check(r.out().contains("java.lang.OutOfMemoryError:"));
-            check(r.out().contains(javaExe));
+            check(r.err().contains("java.lang.OutOfMemoryError:"));
+            check(r.err().contains(javaExe));
             check(r.err().contains(System.getProperty("java.version")));
             equal(r.exitValue(), 1);
         } catch (Throwable t) { unexpected(t); }
--- a/jdk/test/java/net/NetworkInterface/IndexTest.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/java/net/NetworkInterface/IndexTest.java	Thu Nov 21 11:58:51 2013 -0800
@@ -33,11 +33,16 @@
 import static java.lang.System.out;
 
 public class IndexTest {
+    static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+
     public static void main(String[] args) throws Exception {
         Enumeration<NetworkInterface> netifs = NetworkInterface.getNetworkInterfaces();
-        NetworkInterface nif = null;
+        NetworkInterface nif;
         while (netifs.hasMoreElements()) {
             nif = netifs.nextElement();
+            // JDK-8022212, Skip (Windows) Teredo Tunneling seudo-Interface
+            if (nif.getDisplayName().contains("Teredo") && isWindows)
+                continue;
             int index = nif.getIndex();
             if (index >= 0) {
                 NetworkInterface nif2 = NetworkInterface.getByIndex(index);
--- a/jdk/test/java/rmi/testlibrary/RMID.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/java/rmi/testlibrary/RMID.java	Thu Nov 21 11:58:51 2013 -0800
@@ -74,6 +74,10 @@
         // +
         // " -Djava.security.debug=all ";
 
+        // Set execTimeout to 60 sec (default is 30 sec)
+        // to avoid spurious timeouts on slow machines.
+        options += " -Dsun.rmi.activation.execTimeout=60000";
+
         return options;
     }
 
--- a/jdk/test/java/util/Locale/InternationalBAT.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/java/util/Locale/InternationalBAT.java	Thu Nov 21 11:58:51 2013 -0800
@@ -39,11 +39,13 @@
 
     public static void main(String[] args) {
         boolean pass = true;
-        if (!testRequiredLocales()) {
-            pass = false;
-        }
-        if (!testRequiredEncodings()) {
-            pass = false;
+
+        TimeZone tz = TimeZone.getDefault();
+        try {
+            pass &= testRequiredLocales();
+            pass &= testRequiredEncodings();
+        } finally {
+            TimeZone.setDefault(tz);
         }
 
         if (!pass) {
--- a/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Tue Nov 19 15:29:56 2013 -0800
+++ b/jdk/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Thu Nov 21 11:58:51 2013 -0800
@@ -45,12 +45,9 @@
     private static final long MIN_VALUE_FOR_PASS = 1;
     private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE;
 
-    private static boolean trace = false;
-
     public static void main(String args[]) throws Exception {
-        if (args.length > 0 && args[0].equals("trace")) {
-            trace = true;
-        }
+        long count = mbean.getSafepointCount();
+        long value = mbean.getSafepointSyncTime();
 
         // Thread.getAllStackTraces() should cause safepoints.
         // If this test is failing because it doesn't,
@@ -59,15 +56,15 @@
             Thread.getAllStackTraces();
         }
 
-        long value = mbean.getSafepointSyncTime();
+        long count1 = mbean.getSafepointCount();
+        long value1 = mbean.getSafepointSyncTime();
 
-        if (trace) {
-            System.out.println("Safepoint sync time (ms): " + value);
-        }
+        System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
+                          count1, count1-count, value1, value1-value);
 
-        if (value < MIN_VALUE_FOR_PASS || value > MAX_VALUE_FOR_PASS) {
+        if (value1 < MIN_VALUE_FOR_PASS || value1 > MAX_VALUE_FOR_PASS) {
             throw new RuntimeException("Safepoint sync time " +
-                                       "illegal value: " + value + " ms " +
+                                       "illegal value: " + value1 + " ms " +
                                        "(MIN = " + MIN_VALUE_FOR_PASS + "; " +
                                        "MAX = " + MAX_VALUE_FOR_PASS + ")");
         }
@@ -76,16 +73,16 @@
             Thread.getAllStackTraces();
         }
 
+        long count2 = mbean.getSafepointCount();
         long value2 = mbean.getSafepointSyncTime();
 
-        if (trace) {
-            System.out.println("Safepoint sync time2 (ms): " + value2);
-        }
+        System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
+                          count2, count2-count1, value2, value2-value1);
 
-        if (value2 <= value) {
+        if (value2 <= value1) {
             throw new RuntimeException("Safepoint sync time " +
                                        "did not increase " +
-                                       "(value = " + value + "; " +
+                                       "(value1 = " + value1 + "; " +
                                        "value2 = " + value2 + ")");
         }