diff --git a/src/share/classes/java/lang/annotation/ElementType.java b/src/share/classes/java/lang/annotation/ElementType.java index a1125ffe117c89fba93b3e2cc6e37e4f83e15316..4590f39edd1ed4fbbc0d57ac0ff7df1b1699396b 100644 --- a/src/share/classes/java/lang/annotation/ElementType.java +++ b/src/share/classes/java/lang/annotation/ElementType.java @@ -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. * - *
These constants are used with the {@link Target} meta-annotation type - * to specify where it is legal to use an annotation type. + *
The syntactic locations where annotations may appear are split into + * declaration contexts , where annotations apply to declarations, and + * type contexts , where annotations apply to types used in + * declarations and expressions. + * + *
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. + * + *
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. + * + *
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. + * + *
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. + * + *
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 */ diff --git a/src/share/classes/java/lang/annotation/Target.java b/src/share/classes/java/lang/annotation/Target.java index 1ceec3806808e56cc1f754ea81e5695729e088cd..1ad405633c64b050814c4a94062eb0217f94ac52 100644 --- a/src/share/classes/java/lang/annotation/Target.java +++ b/src/share/classes/java/lang/annotation/Target.java @@ -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: + *
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. + * + *
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. + * + *
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: *
* @Target(ElementType.ANNOTATION_TYPE)
* public @interface MetaAnnotationType {
* ...
* }
*
- * 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:
+ *
+ * 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: *
* @Target({})
* public @interface MemberType {
* ...
* }
*
- * 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:
+ *
+ * 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: *
* @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
* public @interface Bogus {
@@ -61,7 +70,8 @@ package java.lang.annotation;
*
*
* @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)
diff --git a/test/ProblemList.txt b/test/ProblemList.txt
index e213d7af881dff1514150bc817e572910a09a743..547eb7b8d5c07614e57c81c66a7d9bdbf34de362 100644
--- a/test/ProblemList.txt
+++ b/test/ProblemList.txt
@@ -129,9 +129,6 @@ java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
# jdk_management
-# 8010897
-sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java macosx-all
-
# 8028150
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all
@@ -153,13 +150,6 @@ demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all
# 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 @@ javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java windows-all
# 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 @@ com/sun/jdi/SuspendThreadTest.java generic-all
# Filed 6653793
com/sun/jdi/RedefineCrossEvent.java generic-all
-# Filed 6402201
-com/sun/jdi/ProcessAttachTest.sh generic-all
-
############################################################################
# jdk_util
diff --git a/test/com/sun/corba/se/impl/orb/SetDefaultORBTest.java b/test/com/sun/corba/se/impl/orb/SetDefaultORBTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..d5fa81cb2f57a4867b5da0250ef0dece2dbab4b0
--- /dev/null
+++ b/test/com/sun/corba/se/impl/orb/SetDefaultORBTest.java
@@ -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");
+ }
+ }
+}
diff --git a/test/com/sun/jdi/BreakpointWithFullGC.sh b/test/com/sun/jdi/BreakpointWithFullGC.sh
index ef0da8804a210e72f9212278ac0adb21efbf0171..e358487d3be726f1bfa4897e842be99c8a07b6d0 100644
--- a/test/com/sun/jdi/BreakpointWithFullGC.sh
+++ b/test/com/sun/jdi/BreakpointWithFullGC.sh
@@ -60,7 +60,7 @@ public class $1 {
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
diff --git a/test/com/sun/jdi/ProcessAttachDebuggee.java b/test/com/sun/jdi/ProcessAttachDebuggee.java
index feca088223858d0384c8bb7d62531e1839d0e1b8..3208b1551ee3a261096dfee146a5712b9cd1d50f 100644
--- a/test/com/sun/jdi/ProcessAttachDebuggee.java
+++ b/test/com/sun/jdi/ProcessAttachDebuggee.java
@@ -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 @@ public class ProcessAttachDebuggee {
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();
diff --git a/test/com/sun/jdi/ProcessAttachTest.sh b/test/com/sun/jdi/ProcessAttachTest.sh
index d48ea5ec82871faaa24ab5c6fba591a946e1a3fd..10b5d50315486efa67a2777173c58f81216b17df 100644
--- a/test/com/sun/jdi/ProcessAttachTest.sh
+++ b/test/com/sun/jdi/ProcessAttachTest.sh
@@ -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 @@ $JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
# 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}"
diff --git a/test/com/sun/net/httpserver/Test9a.java b/test/com/sun/net/httpserver/Test9a.java
index fa6f3656bc843e1fa5dbaa04cb0c27ddff677fa2..66e7948b863212cf5f17c0d9b3f90c0cde398062 100644
--- a/test/com/sun/net/httpserver/Test9a.java
+++ b/test/com/sun/net/httpserver/Test9a.java
@@ -40,8 +40,9 @@ import javax.net.ssl.*;
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 @@ public class Test9a extends Test {
compare (new File(orig), temp);
temp.delete();
} catch (IOException e) {
+ e.printStackTrace();
error = true;
}
}
diff --git a/test/java/lang/ProcessBuilder/Basic.java b/test/java/lang/ProcessBuilder/Basic.java
index c0873dc0df7b8135a1019677491bba9809ab2573..4434e9b1ae517a59e23857c2b22267231a53770f 100644
--- a/test/java/lang/ProcessBuilder/Basic.java
+++ b/test/java/lang/ProcessBuilder/Basic.java
@@ -561,9 +561,10 @@ public class Basic {
System.getProperty("java.class.path");
private static final List