提交 1dba94ef 编写于 作者: V valeriep

Merge

/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,15 +26,49 @@ ...@@ -26,15 +26,49 @@
package java.lang.annotation; package java.lang.annotation;
/** /**
* A program element type. The constants of this enumerated type * The constants of this enumerated type provide a simple classification of the
* provide a simple classification of the declared elements in a * syntactic locations where annotations may appear in a Java program. These
* Java program. * 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>These constants are used with the {@link Target} meta-annotation type * <p>The syntactic locations where annotations may appear are split into
* to specify where it is legal to use an annotation type. * <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>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 * @author Joshua Bloch
* @since 1.5 * @since 1.5
* @jls 9.6.4.1 @Target
* @jls 4.1 The Kinds of Types and Values
*/ */
public enum ElementType { public enum ElementType {
/** Class, interface (including annotation type), or enum declaration */ /** Class, interface (including annotation type), or enum declaration */
......
...@@ -26,33 +26,42 @@ ...@@ -26,33 +26,42 @@
package java.lang.annotation; package java.lang.annotation;
/** /**
* Indicates the kinds of program element to which an annotation type * Indicates the contexts in which an annotation type is applicable. The
* is applicable. If a Target meta-annotation is not present on an * declaration contexts and type contexts in which an annotation type may be
* annotation type declaration, the declared type may be used on any * applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
* program element. If such a meta-annotation is present, the compiler * constants of {@link ElementType java.lang.annotation.ElementType}.
* will enforce the specified usage restriction.
* *
* For example, this meta-annotation indicates that the declared type is * <p>If an {@code @Target} meta-annotation is not present on an annotation type
* itself a meta-annotation type. It can only be used on annotation type * {@code T} , then an annotation of type {@code T} may be written as a
* declarations: * 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> * <pre>
* &#064;Target(ElementType.ANNOTATION_TYPE) * &#064;Target(ElementType.ANNOTATION_TYPE)
* public &#064;interface MetaAnnotationType { * public &#064;interface MetaAnnotationType {
* ... * ...
* } * }
* </pre> * </pre>
* This meta-annotation indicates that the declared type is intended solely *
* for use as a member type in complex annotation type declarations. It * <p>This {@code @Target} meta-annotation indicates that the declared type is
* cannot be used to annotate anything directly: * intended solely for use as a member type in complex annotation type
* declarations. It cannot be used to annotate anything directly:
* <pre> * <pre>
* &#064;Target({}) * &#064;Target({})
* public &#064;interface MemberType { * public &#064;interface MemberType {
* ... * ...
* } * }
* </pre> * </pre>
* It is a compile-time error for a single ElementType constant to *
* appear more than once in a Target annotation. For example, the * <p>It is a compile-time error for a single {@code ElementType} constant to
* following meta-annotation is illegal: * appear more than once in an {@code @Target} annotation. For example, the
* following {@code @Target} meta-annotation is illegal:
* <pre> * <pre>
* &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD}) * &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
* public &#064;interface Bogus { * public &#064;interface Bogus {
...@@ -61,7 +70,8 @@ package java.lang.annotation; ...@@ -61,7 +70,8 @@ package java.lang.annotation;
* </pre> * </pre>
* *
* @since 1.5 * @since 1.5
* @jls 9.6.3.1 @Target * @jls 9.6.4.1 @Target
* @jls 9.7.4 Where Annotations May Appear
*/ */
@Documented @Documented
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
......
...@@ -129,9 +129,6 @@ java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all ...@@ -129,9 +129,6 @@ java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
# jdk_management # jdk_management
# 8010897
sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java macosx-all
# 8028150 # 8028150
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all
...@@ -153,13 +150,6 @@ demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all ...@@ -153,13 +150,6 @@ demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java generic-all
# 7027502 # 7027502
demo/jvmti/hprof/MonitorTest.java generic-all 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 # 8027973
javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java windows-all javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java windows-all
...@@ -170,9 +160,6 @@ javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java windows-all ...@@ -170,9 +160,6 @@ javax/xml/jaxp/transform/jdk8004476/XSLTExFuncTest.java windows-all
# Filed 7052625 # Filed 7052625
com/sun/net/httpserver/bugs/6725892/Test.java generic-all 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 # failing on vista 32/64 on nightly
# 7102702 # 7102702
java/net/PortUnreachableException/OneExceptionOnly.java windows-all java/net/PortUnreachableException/OneExceptionOnly.java windows-all
...@@ -307,9 +294,6 @@ com/sun/jdi/SuspendThreadTest.java generic-all ...@@ -307,9 +294,6 @@ com/sun/jdi/SuspendThreadTest.java generic-all
# Filed 6653793 # Filed 6653793
com/sun/jdi/RedefineCrossEvent.java generic-all com/sun/jdi/RedefineCrossEvent.java generic-all
# Filed 6402201
com/sun/jdi/ProcessAttachTest.sh generic-all
############################################################################ ############################################################################
# jdk_util # jdk_util
......
/*
* 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");
}
}
}
...@@ -60,7 +60,7 @@ public class $1 { ...@@ -60,7 +60,7 @@ public class $1 {
public static void main(String[] args) { public static void main(String[] args) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
System.out.println("top of loop"); // @1 breakpoint System.out.println("top of loop"); // @1 breakpoint
init(1000000); init(500000);
objList.clear(); objList.clear();
System.gc(); System.gc();
System.out.println("bottom of loop"); // @1 breakpoint System.out.println("bottom of loop"); // @1 breakpoint
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
*/ */
import java.net.Socket; import java.net.Socket;
import java.net.ServerSocket; 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.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
...@@ -39,10 +42,12 @@ public class ProcessAttachDebuggee { ...@@ -39,10 +42,12 @@ public class ProcessAttachDebuggee {
int port = ss.getLocalPort(); int port = ss.getLocalPort();
// Write the port number to the given file // Write the port number to the given file
File f = new File(args[0]); File partial = new File(args[0] + ".partial");
FileOutputStream fos = new FileOutputStream(f); File portFile = new File(args[0]);
fos.write( Integer.toString(port).getBytes("UTF-8") ); try (FileOutputStream fos = new FileOutputStream(partial)) {
fos.close(); 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.println("Debuggee bound to port: " + port);
System.out.flush(); System.out.flush();
......
#!/bin/sh #!/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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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" \ ...@@ -158,7 +158,17 @@ $JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
# The debuggee is suspended and doesn't run until the debugger # The debuggee is suspended and doesn't run until the debugger
# disconnects. We have to give it time to write the port number # disconnects. We have to give it time to write the port number
# to ${PORTFILE} # 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 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
stopDebuggee "${PORTFILE}" stopDebuggee "${PORTFILE}"
......
...@@ -40,8 +40,9 @@ import javax.net.ssl.*; ...@@ -40,8 +40,9 @@ import javax.net.ssl.*;
public class Test9a extends Test { public class Test9a extends Test {
static SSLContext serverCtx, clientCtx; static SSLContext serverCtx;
static boolean error = false; static volatile SSLContext clientCtx = null;
static volatile boolean error = false;
public static void main (String[] args) throws Exception { public static void main (String[] args) throws Exception {
HttpsServer server = null; HttpsServer server = null;
...@@ -176,6 +177,7 @@ public class Test9a extends Test { ...@@ -176,6 +177,7 @@ public class Test9a extends Test {
compare (new File(orig), temp); compare (new File(orig), temp);
temp.delete(); temp.delete();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
error = true; error = true;
} }
} }
......
...@@ -561,9 +561,10 @@ public class Basic { ...@@ -561,9 +561,10 @@ public class Basic {
System.getProperty("java.class.path"); System.getProperty("java.class.path");
private static final List<String> javaChildArgs = private static final List<String> javaChildArgs =
Arrays.asList(new String[] Arrays.asList(javaExe,
{ javaExe, "-classpath", absolutifyPath(classpath), "-XX:+DisplayVMOutputToStderr",
"Basic$JavaChild"}); "-classpath", absolutifyPath(classpath),
"Basic$JavaChild");
private static void testEncoding(String encoding, String tested) { private static void testEncoding(String encoding, String tested) {
try { try {
...@@ -1627,8 +1628,8 @@ public class Basic { ...@@ -1627,8 +1628,8 @@ public class Basic {
javaExe)); javaExe));
list.add("ArrayOOME"); list.add("ArrayOOME");
ProcessResults r = run(new ProcessBuilder(list)); ProcessResults r = run(new ProcessBuilder(list));
check(r.out().contains("java.lang.OutOfMemoryError:")); check(r.err().contains("java.lang.OutOfMemoryError:"));
check(r.out().contains(javaExe)); check(r.err().contains(javaExe));
check(r.err().contains(System.getProperty("java.version"))); check(r.err().contains(System.getProperty("java.version")));
equal(r.exitValue(), 1); equal(r.exitValue(), 1);
} catch (Throwable t) { unexpected(t); } } catch (Throwable t) { unexpected(t); }
......
...@@ -33,11 +33,16 @@ import java.util.Enumeration; ...@@ -33,11 +33,16 @@ import java.util.Enumeration;
import static java.lang.System.out; import static java.lang.System.out;
public class IndexTest { public class IndexTest {
static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Enumeration<NetworkInterface> netifs = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> netifs = NetworkInterface.getNetworkInterfaces();
NetworkInterface nif = null; NetworkInterface nif;
while (netifs.hasMoreElements()) { while (netifs.hasMoreElements()) {
nif = netifs.nextElement(); nif = netifs.nextElement();
// JDK-8022212, Skip (Windows) Teredo Tunneling seudo-Interface
if (nif.getDisplayName().contains("Teredo") && isWindows)
continue;
int index = nif.getIndex(); int index = nif.getIndex();
if (index >= 0) { if (index >= 0) {
NetworkInterface nif2 = NetworkInterface.getByIndex(index); NetworkInterface nif2 = NetworkInterface.getByIndex(index);
......
...@@ -74,6 +74,10 @@ public class RMID extends JavaVM { ...@@ -74,6 +74,10 @@ public class RMID extends JavaVM {
// + // +
// " -Djava.security.debug=all "; // " -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; return options;
} }
......
...@@ -39,11 +39,13 @@ public class InternationalBAT { ...@@ -39,11 +39,13 @@ public class InternationalBAT {
public static void main(String[] args) { public static void main(String[] args) {
boolean pass = true; boolean pass = true;
if (!testRequiredLocales()) {
pass = false; TimeZone tz = TimeZone.getDefault();
} try {
if (!testRequiredEncodings()) { pass &= testRequiredLocales();
pass = false; pass &= testRequiredEncodings();
} finally {
TimeZone.setDefault(tz);
} }
if (!pass) { if (!pass) {
......
...@@ -45,12 +45,9 @@ public class GetSafepointSyncTime { ...@@ -45,12 +45,9 @@ public class GetSafepointSyncTime {
private static final long MIN_VALUE_FOR_PASS = 1; private static final long MIN_VALUE_FOR_PASS = 1;
private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE; private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE;
private static boolean trace = false;
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
if (args.length > 0 && args[0].equals("trace")) { long count = mbean.getSafepointCount();
trace = true; long value = mbean.getSafepointSyncTime();
}
// Thread.getAllStackTraces() should cause safepoints. // Thread.getAllStackTraces() should cause safepoints.
// If this test is failing because it doesn't, // If this test is failing because it doesn't,
...@@ -59,15 +56,15 @@ public class GetSafepointSyncTime { ...@@ -59,15 +56,15 @@ public class GetSafepointSyncTime {
Thread.getAllStackTraces(); Thread.getAllStackTraces();
} }
long value = mbean.getSafepointSyncTime(); long count1 = mbean.getSafepointCount();
long value1 = mbean.getSafepointSyncTime();
if (trace) { System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
System.out.println("Safepoint sync time (ms): " + value); 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 " + throw new RuntimeException("Safepoint sync time " +
"illegal value: " + value + " ms " + "illegal value: " + value1 + " ms " +
"(MIN = " + MIN_VALUE_FOR_PASS + "; " + "(MIN = " + MIN_VALUE_FOR_PASS + "; " +
"MAX = " + MAX_VALUE_FOR_PASS + ")"); "MAX = " + MAX_VALUE_FOR_PASS + ")");
} }
...@@ -76,16 +73,16 @@ public class GetSafepointSyncTime { ...@@ -76,16 +73,16 @@ public class GetSafepointSyncTime {
Thread.getAllStackTraces(); Thread.getAllStackTraces();
} }
long count2 = mbean.getSafepointCount();
long value2 = mbean.getSafepointSyncTime(); long value2 = mbean.getSafepointSyncTime();
if (trace) { System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
System.out.println("Safepoint sync time2 (ms): " + value2); count2, count2-count1, value2, value2-value1);
}
if (value2 <= value) { if (value2 <= value1) {
throw new RuntimeException("Safepoint sync time " + throw new RuntimeException("Safepoint sync time " +
"did not increase " + "did not increase " +
"(value = " + value + "; " + "(value1 = " + value1 + "; " +
"value2 = " + value2 + ")"); "value2 = " + value2 + ")");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册