From a4da3681de106c29090bb5bfc03cd4f01a3fa3ca Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Thu, 19 Mar 2015 09:01:44 +0100 Subject: [PATCH 01/63] 8064923: [TESTBUG] jps doesn't display anything on embedded platforms and it causes some tests to fail Reviewed-by: egahlin, jbachorik --- jdk/test/sun/tools/jps/JpsHelper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/test/sun/tools/jps/JpsHelper.java b/jdk/test/sun/tools/jps/JpsHelper.java index e28e92dae73..a5882aee6db 100644 --- a/jdk/test/sun/tools/jps/JpsHelper.java +++ b/jdk/test/sun/tools/jps/JpsHelper.java @@ -151,6 +151,7 @@ public final class JpsHelper { */ public static OutputAnalyzer jps(List vmArgs, List toolArgs) throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); + launcher.addVMArg("-XX:+UsePerfData"); if (vmArgs != null) { for (String vmArg : vmArgs) { launcher.addVMArg(vmArg); From 40807f0a8e2ec5aeb1fdf457aa94d8ef1261e1de Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Fri, 20 Mar 2015 01:59:08 -0700 Subject: [PATCH 02/63] 8067662: "java.lang.NullPointerException: Method name is null" from StackTraceElement. Update java/lang/instrument/RedefineMethodInBacktrace.sh test to cover the hotspot fix Reviewed-by: coleenp, dcubed --- .../instrument/RedefineMethodInBacktrace.sh | 2 +- .../RedefineMethodInBacktraceApp.java | 56 +++++++++++++++++-- .../RedefineMethodInBacktraceTarget.java | 9 +++ .../RedefineMethodInBacktraceTargetB.java | 12 ++++ .../RedefineMethodInBacktraceTargetB_2.java | 3 + .../RedefineMethodInBacktraceTarget_2.java | 4 ++ 6 files changed, 80 insertions(+), 6 deletions(-) diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh b/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh index 4ebaaa8e73b..439a7f72776 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktrace.sh @@ -77,7 +77,7 @@ fi cat output.log -MESG="Exception" +MESG="Test failed" grep "$MESG" output.log result=$? if [ "$result" = 0 ]; then diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java index 7f7ddbf19b1..60ab8e4347a 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java @@ -46,12 +46,15 @@ import sun.management.ManagementFactoryHelper; * could be freed, since class redefinition didn't know about the backtraces. */ public class RedefineMethodInBacktraceApp { + static boolean failed = false; + public static void main(String args[]) throws Exception { System.out.println("Hello from RedefineMethodInBacktraceApp!"); - new RedefineMethodInBacktraceApp().doTest(); - System.exit(0); + if (failed) { + throw new Exception("ERROR: RedefineMethodInBacktraceApp failed."); + } } public static CountDownLatch stop = new CountDownLatch(1); @@ -63,13 +66,18 @@ public class RedefineMethodInBacktraceApp { } private void doMethodInBacktraceTest() throws Exception { - Throwable t = getThrowableFromMethodToRedefine(); + Throwable t1 = getThrowableFromMethodToRedefine(); + Throwable t2 = getThrowableFromMethodToDelete(); doRedefine(RedefineMethodInBacktraceTarget.class); doClassUnloading(); - touchRedefinedMethodInBacktrace(t); + System.out.println("checking backtrace for throwable from methodToRedefine"); + touchRedefinedMethodInBacktrace(t1); + + System.out.println("checking backtrace for throwable from methodToDelete"); + touchRedefinedMethodInBacktrace(t2); } private void doMethodInBacktraceTestB() throws Exception { @@ -115,6 +123,10 @@ public class RedefineMethodInBacktraceApp { if (!(thrownFromMethodToRedefine instanceof RuntimeException)) { throw e; } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("\nTest failed: unexpected exception: " + e.toString()); + failed = true; } method = null; c = null; @@ -122,15 +134,49 @@ public class RedefineMethodInBacktraceApp { return thrownFromMethodToRedefine; } + private static Throwable getThrowableFromMethodToDelete() throws Exception { + Class c = + RedefineMethodInBacktraceTarget.class; + Method method = c.getMethod("callMethodToDelete"); + + Throwable thrownFromMethodToDelete = null; + try { + method.invoke(null); + } catch (InvocationTargetException e) { + thrownFromMethodToDelete = e.getCause(); + if (!(thrownFromMethodToDelete instanceof RuntimeException)) { + throw e; + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("\nTest failed: unexpected exception: " + e.toString()); + failed = true; + } + return thrownFromMethodToDelete; + } + + private static void doClassUnloading() { // This will clean out old, unused redefined methods. System.gc(); } private static void touchRedefinedMethodInBacktrace(Throwable throwable) { + throwable.printStackTrace(); // Make sure that we can convert the backtrace, which is referring to // the redefined method, to a StrackTraceElement[] without crashing. - throwable.getStackTrace(); + StackTraceElement[] stackTrace = throwable.getStackTrace(); + for (int i = 0; i < stackTrace.length; i++) { + StackTraceElement frame = stackTrace[i]; + if (frame.getClassName() == null) { + System.out.println("\nTest failed: trace[" + i + "].getClassName() returned null"); + failed = true; + } + if (frame.getMethodName() == null) { + System.out.println("\nTest failed: trace[" + i + "].getMethodName() returned null"); + failed = true; + } + } } private static void doRedefine(Class clazz) throws Exception { diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget.java index fad881137c8..d1c1e33078d 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget.java @@ -29,4 +29,13 @@ public class RedefineMethodInBacktraceTarget { public static void methodToRedefine() { throw new RuntimeException("Test exception"); } + + public static void callMethodToDelete() { + methodToDelete(); + } + + private static void methodToDelete() { + throw new RuntimeException("Test exception in methodToDelete"); + } + } diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB.java index baefeb78703..d7fb6f7857a 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB.java @@ -37,4 +37,16 @@ public class RedefineMethodInBacktraceTargetB { // ignore, test will fail } } + + public static void callMethodToDelete() { + try { + // signal that we are here + RedefineMethodInBacktraceApp.called.countDown(); + + // wait until test is done + RedefineMethodInBacktraceApp.stop.await(); + } catch (InterruptedException ex) { + // ignore, test will fail + } + } } diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB_2.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB_2.java index de98206a8dd..33c6e7103e2 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB_2.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTargetB_2.java @@ -28,4 +28,7 @@ public class RedefineMethodInBacktraceTargetB { public static void methodToRedefine() { } + + public static void callMethodToDelete() { + } } diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget_2.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget_2.java index d2ba2259932..a7d9dc666a1 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget_2.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceTarget_2.java @@ -29,4 +29,8 @@ public class RedefineMethodInBacktraceTarget { public static void methodToRedefine() { throw new RuntimeException("Test exception 2"); } + + public static void callMethodToDelete() { + throw new RuntimeException("Test exception 2 in callMethodToDelete"); + } } From 71020f90eff7e97502e48f88bb00ce0f59e77376 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 20 Mar 2015 11:42:31 -0700 Subject: [PATCH 03/63] 8075263: MHI::checkCustomized isn't eliminated for inlined MethodHandles Reviewed-by: jrose, kvn --- .../java.base/share/classes/java/lang/invoke/Invokers.java | 1 + .../share/classes/java/lang/invoke/MethodHandleImpl.java | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java index 43cf38f12bd..7b7d7432996 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -394,6 +394,7 @@ class Invokers { @ForceInline void checkCustomized(Object o) { MethodHandle mh = (MethodHandle)o; + if (MethodHandleImpl.isCompileConstant(mh)) return; if (mh.form.customized == null) { maybeCustomize(mh); } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 57568ece696..35805a4294e 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -722,6 +722,13 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; return result; } + // Intrinsified by C2. Returns true if obj is a compile-time constant. + @LambdaForm.Hidden + static + boolean isCompileConstant(Object obj) { + return false; + } + static MethodHandle makeGuardWithTest(MethodHandle test, MethodHandle target, From b75ed37297ece8bd3cc3923f6b6ddc42736b02d0 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 25 Mar 2015 09:37:52 +0100 Subject: [PATCH 04/63] 8075725: Remove /jre subdir in hotspot dist dir Reviewed-by: tbell, ihse --- jdk/make/Import.gmk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk index 9e743349437..ffe2869897f 100644 --- a/jdk/make/Import.gmk +++ b/jdk/make/Import.gmk @@ -32,11 +32,11 @@ include MakeBase.gmk # Put the libraries here. Different locations for different target OS types. ifneq ($(OPENJDK_TARGET_OS), windows) - HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR) + HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR) BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR) SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent$(OPENJDK_TARGET_CPU_LIBDIR) else - HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/bin + HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/bin BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent endif @@ -80,11 +80,11 @@ SA_TARGETS := $(COPY_HOTSPOT_SA) ################################################################################ ifeq ($(OPENJDK_TARGET_OS), macosx) - JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \ - $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) ) + JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \ + $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) ) else - JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \ - $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) ) + JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \ + $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) ) endif ifneq ($(OPENJDK_TARGET_OS), windows) From 2d4a9917d5a83fff390ec4bdcb4e021e3c1d47ef Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Wed, 25 Mar 2015 12:39:48 +0100 Subject: [PATCH 05/63] 8075820: java/lang/management/ThreadMXBean/FindDeadlocks.java should be unquarantined Reviewed-by: jbachorik, sspitsyn --- jdk/test/ProblemList.txt | 7 ------- .../java/lang/management/ThreadMXBean/FindDeadlocks.java | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 95b60e73fb3..b460c3600bb 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -136,13 +136,6 @@ java/lang/instrument/BootClassPath/BootClassPathTest.sh macosx-all ############################################################################ -# jdk_management - -# 8058492 -java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all - -############################################################################ - # jdk_jmx # 8030957 diff --git a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java index 0bdcd7ae4de..c2fd2a651e4 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java +++ b/jdk/test/java/lang/management/ThreadMXBean/FindDeadlocks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -25,6 +25,7 @@ /* * @test * @bug 5086470 + * @key intermittent * @summary Basic Test for the following methods: * - ThreadMXBean.findDeadlockedThreads() * - ThreadMXBean.findMonitorDeadlockedThreads() From eecde5f24ceb60ba3f303bc8d12955808c4f8a21 Mon Sep 17 00:00:00 2001 From: Fredrik Arvidsson Date: Mon, 30 Mar 2015 10:10:19 +0200 Subject: [PATCH 06/63] 8076154: com/sun/jdi/InstanceFilter.java failing due to missing MethodEntryRequest calls Some jdi tests are failing due to missing MethodEntryRequest events during the test execution. Reviewed-by: sla, jbachorik --- jdk/test/com/sun/jdi/InstanceFilter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jdk/test/com/sun/jdi/InstanceFilter.java b/jdk/test/com/sun/jdi/InstanceFilter.java index a8d7da33ab9..0c9dc322cf5 100644 --- a/jdk/test/com/sun/jdi/InstanceFilter.java +++ b/jdk/test/com/sun/jdi/InstanceFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -104,7 +104,10 @@ public class InstanceFilter extends TestScaffold { return; } if (theThis == null) { - // This happens when the thread has exited. + // This happens when the thread has exited or when a + // static method is called. Setting an instance + // filter does not prevent this event from being + // emitted with a this that is null. methodEntryRequest.disable(); return; } @@ -138,6 +141,10 @@ public class InstanceFilter extends TestScaffold { EventRequestManager mgr = vm().eventRequestManager(); methodEntryRequest = mgr.createMethodEntryRequest(); methodEntryRequest.addInstanceFilter(theInstance); + // Thread filter is needed to prevent MethodEntry events + // to be emitted by the debugee when a static method + // is called on any thread. + methodEntryRequest.addThreadFilter(bpe.thread()); methodEntryRequest.enable(); listenUntilVMDisconnect(); From ca198f7351d4a438900bb7c7d44f578ac80e894d Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 25 Mar 2015 18:33:17 +0100 Subject: [PATCH 07/63] 8023093: Add ManagementAgent.status diagnostic command Reviewed-by: sla --- .../share/classes/sun/management/Agent.java | 131 ++++++- .../jmxremote/startstop/JMXStartStopTest.java | 324 ++++++------------ .../jmxremote/startstop/JMXStatusTest.java | 149 ++++++++ .../startstop/ManagementAgentJcmd.java | 198 +++++++++++ .../jmxremote/startstop/PortAllocator.java | 52 +++ .../jmxremote/startstop/REMOTE_TESTING.txt | 2 +- ...StartStopDoSomething.java => TestApp.java} | 5 +- 7 files changed, 643 insertions(+), 218 deletions(-) create mode 100644 jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java create mode 100644 jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java create mode 100644 jdk/test/sun/management/jmxremote/startstop/PortAllocator.java rename jdk/test/sun/management/jmxremote/startstop/{JMXStartStopDoSomething.java => TestApp.java} (90%) diff --git a/jdk/src/java.management/share/classes/sun/management/Agent.java b/jdk/src/java.management/share/classes/sun/management/Agent.java index 3128ca442ea..ffb3105255e 100644 --- a/jdk/src/java.management/share/classes/sun/management/Agent.java +++ b/jdk/src/java.management/share/classes/sun/management/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -34,6 +34,7 @@ import java.lang.management.ManagementFactory; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.InetAddress; +import java.net.MalformedURLException; import java.net.UnknownHostException; import java.text.MessageFormat; import java.util.MissingResourceException; @@ -55,6 +56,125 @@ import sun.misc.VMSupport; * system class loader. Also jmx framework could be started by jcmd */ public class Agent { + /** + * Agent status collector strategy class + */ + private static abstract class StatusCollector { + final protected StringBuilder sb = new StringBuilder(); + final public String collect() { + Properties agentProps = VMSupport.getAgentProperties(); + String localConnAddr = (String)agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP); + if (localConnAddr != null || jmxServer != null) { + addAgentStatus(true); + appendConnections(localConnAddr); + } else { + addAgentStatus(false); + } + return sb.toString(); + } + + private void appendConnections(String localConnAddr) { + appendConnectionsHeader(); + if (localConnAddr != null) { + try { + JMXServiceURL u = new JMXServiceURL(localConnAddr); + addConnection(false, u); + } catch (MalformedURLException e) { + // will never happen + } + + } + if (jmxServer != null) { + addConnection(true, jmxServer.getAddress()); + } + appendConnectionsFooter(); + } + + private void addConnection(boolean remote, JMXServiceURL u) { + appendConnectionHeader(remote); + addConnectionDetails(u); + if (remote) { + addConfigProperties(); + } + appendConnectionFooter(remote); + } + + private void addConfigProperties() { + appendConfigPropsHeader(); + boolean[] first = new boolean[] {true}; + configProps.entrySet().stream().forEach((e) -> { + String key = (String)e.getKey(); + if (key.startsWith("com.sun.management.")) { + addConfigProp(key, e.getValue(), first[0]); + first[0] = false; + } + }); + appendConfigPropsFooter(); + } + + abstract protected void addAgentStatus(boolean enabled); + abstract protected void appendConnectionsHeader(); + abstract protected void appendConnectionsFooter(); + abstract protected void addConnectionDetails(JMXServiceURL u); + abstract protected void appendConnectionHeader(boolean remote); + abstract protected void appendConnectionFooter(boolean remote); + abstract protected void appendConfigPropsHeader(); + abstract protected void appendConfigPropsFooter(); + abstract protected void addConfigProp(String key, Object value, boolean first); + } + + /** + * Free-text status collector strategy implementation + */ + final private static class TextStatusCollector extends StatusCollector { + + @Override + protected void addAgentStatus(boolean enabled) { + sb.append("Agent: ").append(enabled ? "enabled" : "disabled").append('\n'); + } + + @Override + protected void appendConnectionsHeader() { + sb.append('\n'); + } + + @Override + protected void addConnectionDetails(JMXServiceURL u) { + sb.append("Protocol : ").append(u.getProtocol()).append('\n') + .append("Host : ").append(u.getHost()).append('\n') + .append("URL : ").append(u).append('\n'); + } + + @Override + protected void appendConnectionHeader(boolean remote) { + sb.append("Connection Type: ").append(remote ? "remote" : "local").append('\n'); + } + + @Override + protected void appendConfigPropsHeader() { + sb.append("Properties :\n"); + } + + @Override + protected void addConfigProp(String key, Object value, boolean first) { + if (!first) { + sb.append('\n'); + } + sb.append(" ").append(key).append(" = ").append(value); + } + + @Override + protected void appendConnectionsFooter() {} + + @Override + protected void appendConnectionFooter(boolean remote) { + sb.append('\n'); + } + + @Override + protected void appendConfigPropsFooter() {} + } + // management properties private static Properties mgmtProps; @@ -81,6 +201,8 @@ public class Agent { // The only active agent allowed private static JMXConnectorServer jmxServer = null; + // The properties used to configure the server + private static Properties configProps = null; // Parse string com.sun.management.prop=xxx,com.sun.management.prop=yyyy // and return property set if args is null or empty @@ -161,7 +283,7 @@ public class Agent { try { Properties argProps = parseString(args); - Properties configProps = new Properties(); + configProps = new Properties(); // Load the management properties from the config file // if config file is not specified readConfiguration implicitly @@ -228,9 +350,14 @@ public class Agent { // Don't cause any errors. jmxServer.stop(); jmxServer = null; + configProps = null; } } + private static synchronized String getManagementAgentStatus() throws Exception { + return new TextStatusCollector().collect(); + } + private static void startAgent(Properties props) throws Exception { String snmpPort = props.getProperty(SNMP_PORT); String jmxremote = props.getProperty(JMXREMOTE); diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index 59f947b756c..7f49fe2396d 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -35,20 +35,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; -import java.util.Random; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; -import java.util.stream.Collectors; import javax.management.*; import javax.management.remote.*; import javax.net.ssl.SSLHandshakeException; import jdk.testlibrary.ProcessTools; -import jdk.testlibrary.JDKToolLauncher; import sun.management.Agent; import sun.management.AgentConfigurationError; @@ -56,45 +52,19 @@ import sun.management.AgentConfigurationError; * @test * @bug 7110104 * @library /lib/testlibrary - * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething + * @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest * @summary Makes sure that enabling/disabling the management agent through JCMD * achieves the desired results */ public class JMXStartStopTest { + private static final String TEST_APP_NAME = "TestApp"; private static final String TEST_SRC = System.getProperty("test.src"); private static final boolean verbose = false; - /** - * Dynamically allocates distinct ports from the ephemeral range 49152-65535 - */ - private static class PortAllocator { - - private final static int LOWER_BOUND = 49152; - private final static int UPPER_BOUND = 65535; - - private final static Random RND = new Random(System.currentTimeMillis()); - - private static int[] allocatePorts(final int numPorts) { - int[] ports = new int[numPorts]; - for (int i = 0; i < numPorts; i++) { - int port = -1; - while (port == -1) { - port = RND.nextInt(UPPER_BOUND - LOWER_BOUND + 1) + LOWER_BOUND; - for (int j = 0; j < i; j++) { - if (ports[j] == port) { - port = -1; - break; - } - } - } - ports[i] = port; - } - return ports; - } - } + private static ManagementAgentJcmd jcmd = new ManagementAgentJcmd(TEST_APP_NAME, verbose); private static void dbg_print(String msg) { if (verbose) { @@ -317,14 +287,14 @@ public class JMXStartStopTest { } } - private static class Something { + private static class TestAppRun { private Process p; private final ProcessBuilder pb; private final String name; private final AtomicBoolean started = new AtomicBoolean(false); private volatile long pid = -1; - public Something(ProcessBuilder pb, String name) { + public TestAppRun(ProcessBuilder pb, String name) { this.pb = pb; this.name = name; } @@ -334,7 +304,7 @@ public class JMXStartStopTest { try { AtomicBoolean error = new AtomicBoolean(false); p = ProcessTools.startProcess( - "JMXStartStopDoSomething{" + name + "}", + TEST_APP_NAME + "{" + name + "}", pb, (line) -> { boolean ok = line.equals("main enter"); @@ -381,105 +351,31 @@ public class JMXStartStopTest { } /** - * Runs the test application "JMXStartStopDoSomething" + * Runs the test application "TestApp" * @param name Test run name * @param args Additional arguments - * @return Returns a {@linkplain Something} instance representing the run + * @return Returns a {@linkplain TestAppRun} instance representing the run * @throws IOException * @throws InterruptedException * @throws TimeoutException */ - private static Something doSomething(String name, String ... args) + private static TestAppRun doTest(String name, String ... args) throws Exception { List pbArgs = new ArrayList<>(Arrays.asList( "-cp", System.getProperty("test.class.path") )); pbArgs.addAll(Arrays.asList(args)); - pbArgs.add("JMXStartStopDoSomething"); + pbArgs.add(TEST_APP_NAME); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( pbArgs.toArray(new String[pbArgs.size()]) ); - Something s = new Something(pb, name); + TestAppRun s = new TestAppRun(pb, name); s.start(); return s; } - /** - * Run the "jcmd" command - * - * @param command Command with parameters; space separated string - * @throws IOException - * @throws InterruptedException - */ - private static void jcmd(String ... command) throws IOException, InterruptedException { - if (command.length == 0) { - jcmd(null, c->{}); - } else { - jcmd(null, command); - } - } - - /** - * Run the "jcmd" command - * - * @param c {@linkplain Consumer} instance - * @param command Command with parameters; space separated string - * @throws IOException - * @throws InterruptedException - */ - private static void jcmd(Consumer c, String ... command) throws IOException, InterruptedException { - jcmd("JMXStartStopDoSomething", c, command); - } - - /** - * Run the "jcmd" command - * - * @param target The target application name (or PID) - * @param c {@linkplain Consumer} instance - * @param command Command with parameters; space separated string - * @throws IOException - * @throws InterruptedException - */ - private static void jcmd(String target, final Consumer c, String ... command) throws IOException, InterruptedException { - dbg_print("[jcmd] " + (command.length > 0 ? command[0] : "list")); - - JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jcmd"); - l.addToolArg(target); - for (String cmd : command) { - l.addToolArg(cmd); - } - - AtomicBoolean portUnavailable = new AtomicBoolean(false); - Process p = ProcessTools.startProcess( - "jcmd", - new ProcessBuilder(l.getCommand()), - line -> { - if (line.contains("BindException") || - line.contains(Agent.getText(AgentConfigurationError.CONNECTOR_SERVER_IO_ERROR))) { - portUnavailable.set(true); - } else { - c.accept(line); - } - } - ); - - p.waitFor(); - dbg_print("[jcmd] --------"); - if (portUnavailable.get()) { - String cmd = Arrays.asList(l.getCommand()).stream() - .collect( - Collectors.joining(" ", "", ": Unable to bind address") - ); - throw new BindException(cmd); - } - } - - private static final String CMD_STOP = "ManagementAgent.stop"; - private static final String CMD_START = "ManagementAgent.start"; - private static final String CMD_START_LOCAL = "ManagementAgent.start_local"; - static void test_01() throws Exception { // Run an app with JMX enabled stop it and // restart on other port @@ -487,7 +383,7 @@ public class JMXStartStopTest { System.out.println("**** Test one ****"); int ports[] = PortAllocator.allocatePorts(2); - Something s = doSomething( + TestAppRun s = doTest( "test_01", "-Dcom.sun.management.jmxremote.port=" + ports[0], "-Dcom.sun.management.jmxremote.authenticate=false", @@ -496,10 +392,10 @@ public class JMXStartStopTest { try { testConnect(ports[0]); - jcmd(CMD_STOP); + jcmd.stop(); testNoConnect(ports[0]); - jcmd(CMD_START, "jmxremote.port=" + ports[1]); + jcmd.start("jmxremote.port=" + ports[1]); testConnect(ports[1]); } finally { s.stop(); @@ -513,12 +409,13 @@ public class JMXStartStopTest { System.out.println("**** Test two ****"); int[] ports = PortAllocator.allocatePorts(1); - Something s = doSomething("test_02"); + TestAppRun s = doTest("test_02"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); testConnect(ports[0]); } finally { @@ -534,18 +431,20 @@ public class JMXStartStopTest { System.out.println("**** Test three ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_03"); + TestAppRun s = doTest("test_03"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); // Second agent shouldn't start - jcmd(CMD_START, - "jmxremote.port=" + ports[1], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[1], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); // First agent should connect testConnect(ports[0]); @@ -564,13 +463,14 @@ public class JMXStartStopTest { System.out.println("**** Test four ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_04"); + TestAppRun s = doTest("test_04"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.rmi.port=" + ports[1], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.rmi.port=" + ports[1], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); testConnect(ports[0], ports[1]); } finally { @@ -584,9 +484,9 @@ public class JMXStartStopTest { System.out.println("**** Test five ****"); int[] ports = PortAllocator.allocatePorts(1); - Something s = doSomething("test_05"); + TestAppRun s = doTest("test_05"); try { - jcmd(CMD_START_LOCAL); + jcmd.startLocal(); testNoConnect(ports[0]); testConnectLocal(s.getPid()); @@ -604,26 +504,27 @@ public class JMXStartStopTest { System.out.println("**** Test six ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_06"); + TestAppRun s = doTest("test_06"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); testConnect(ports[0], ports[1]); final AtomicBoolean checks = new AtomicBoolean(false); - jcmd( - line -> { - if (line.contains("java.lang.RuntimeException: Invalid agent state")) { - checks.set(true); - } - }, - CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + line -> { + if (line.contains("java.lang.RuntimeException: Invalid agent state")) { + checks.set(true); + } + }, + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); if (!checks.get()) { throw new Exception("Starting agent on port " + ports[0] + " should " @@ -643,27 +544,28 @@ public class JMXStartStopTest { System.out.println("**** Test seven ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_07"); + TestAppRun s = doTest("test_07"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); testConnect(ports[0], ports[1]); final AtomicBoolean checks = new AtomicBoolean(false); - jcmd( - line -> { - if (line.contains("java.lang.RuntimeException: Invalid agent state")) { - checks.set(true); - } - }, - CMD_START, - "jmxremote.port=" + ports[1], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + line -> { + if (line.contains("java.lang.RuntimeException: Invalid agent state")) { + checks.set(true); + } + }, + "jmxremote.port=" + ports[1], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); if (!checks.get()) { throw new Exception("Starting agent on poprt " + ports[1] + " should " @@ -683,17 +585,18 @@ public class JMXStartStopTest { System.out.println("**** Test eight ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_08"); + TestAppRun s = doTest("test_08"); try { - jcmd(CMD_START, - "jmxremote.port=" + ports[0], - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); testConnect(ports[0], ports[1]); - jcmd(CMD_STOP); - jcmd(CMD_STOP); + jcmd.stop(); + jcmd.stop(); } finally { s.stop(); } @@ -706,7 +609,7 @@ public class JMXStartStopTest { System.out.println("**** Test nine ****"); - Something s = doSomething("test_09"); + TestAppRun s = doTest("test_09"); try (ServerSocket ss = new ServerSocket(0)) { int localPort = ss.getLocalPort(); @@ -722,13 +625,12 @@ public class JMXStartStopTest { final AtomicBoolean retry = new AtomicBoolean(false); try { - jcmd( + jcmd.start( line -> { if (line.contains(Agent.getText(AgentConfigurationError.AGENT_EXCEPTION))) { retry.set(true); } }, - CMD_START, "jmxremote.port=" + ports[0], "jmxremote.rmi.port=" + localPort, "jmxremote.authenticate=false", @@ -763,18 +665,17 @@ public class JMXStartStopTest { System.out.println("**** Test ten ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething( + TestAppRun s = doTest( "test_10", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=true"); try { testNoConnect(ports[0]); - jcmd( - CMD_START, - "jmxremote.port=" + ports[1], - "jmxremote.authenticate=false", - "jmxremote.ssl=false" + jcmd.start( + "jmxremote.port=" + ports[1], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" ); testConnect(ports[1]); } finally { @@ -790,7 +691,7 @@ public class JMXStartStopTest { System.out.println("**** Test eleven ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething( + TestAppRun s = doTest( "test_11", "-Dcom.sun.management.jmxremote.port=" + ports[0], "-Dcom.sun.management.jmxremote.authenticate=false", @@ -799,15 +700,14 @@ public class JMXStartStopTest { try { testNoConnect(ports[0]); - jcmd(CMD_STOP); + jcmd.stop(); testNoConnect(ports[0]); - jcmd( - CMD_START, - "jmxremote.port=" + ports[1], - "jmxremote.authenticate=false", - "jmxremote.ssl=false" + jcmd.start( + "jmxremote.port=" + ports[1], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" ); testConnect(ports[1]); @@ -827,7 +727,7 @@ public class JMXStartStopTest { System.out.println("**** Test twelve ****"); int[] ports = PortAllocator.allocatePorts(2); - Something s = doSomething("test_12", + TestAppRun s = doTest("test_12", "-Dcom.sun.management.config.file=" + TEST_SRC + File.separator + "management_cl.properties", "-Dcom.sun.management.jmxremote.authenticate=false" @@ -836,15 +736,15 @@ public class JMXStartStopTest { try { testNoConnect(ports[0]); - jcmd(CMD_STOP); + jcmd.stop(); testNoConnect(ports[0]); - jcmd(CMD_START, - "config.file=" + TEST_SRC + File.separator - + "management_jcmd.properties", - "jmxremote.authenticate=false", - "jmxremote.port=" + ports[1] + jcmd.start( + "config.file=" + TEST_SRC + File.separator + + "management_jcmd.properties", + "jmxremote.authenticate=false", + "jmxremote.port=" + ports[1] ); testConnect(ports[1]); @@ -862,7 +762,7 @@ public class JMXStartStopTest { System.out.println("**** Test thirteen ****"); int[] ports = PortAllocator.allocatePorts(1); - Something s = doSomething( + TestAppRun s = doTest( "test_13", "-Dcom.sun.management.jmxremote.port=" + ports[0], "-Dcom.sun.management.jmxremote.authenticate=false", @@ -871,16 +771,16 @@ public class JMXStartStopTest { try { testNoConnect(ports[0]); - jcmd(CMD_STOP); - jcmd(CMD_START, - "jmxremote.ssl=false", - "jmxremote.port=" + ports[0] + jcmd.stop(); + jcmd.start( + "jmxremote.ssl=false", + "jmxremote.port=" + ports[0] ); testConnect(ports[0]); - jcmd(CMD_STOP); - jcmd(CMD_START, - "jmxremote.port=" + ports[0] + jcmd.stop(); + jcmd.start( + "jmxremote.port=" + ports[0] ); testNoConnect(ports[0]); @@ -896,14 +796,14 @@ public class JMXStartStopTest { System.out.println("**** Test fourteen ****"); int[] ports = PortAllocator.allocatePorts(1); - Something s = doSomething( + TestAppRun s = doTest( "test_14", "-Dcom.sun.management.jmxremote.port=" + ports[0], "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false"); try { testConnect(ports[0]); - jcmd(CMD_STOP); + jcmd.stop(); testConnectLocal(s.getPid()); } finally { s.stop(); @@ -917,11 +817,11 @@ public class JMXStartStopTest { System.out.println("**** Test fifteen ****"); int[] ports = PortAllocator.allocatePorts(1); - Something s = doSomething("test_15"); + TestAppRun s = doTest("test_15"); try { testNoConnect(ports[0]); - jcmd(CMD_START + "_local"); + jcmd.startLocal(); testConnectLocal(s.getPid()); diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java new file mode 100644 index 00000000000..f9757762ee2 --- /dev/null +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.net.BindException; +import java.util.function.Predicate; +import java.util.regex.Pattern; +import org.testng.annotations.*; +import static org.testng.Assert.*; + +import jdk.testlibrary.ProcessTools; + +/** + * @test + * @bug 8023093 + * @summary Performs a sanity test for the ManagementAgent.status diagnostic command. + * Management agent may be disable, started (only local connections) and started. + * The test asserts that the expected text is being printed. + * @library /lib/testlibrary + * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd + * @run testng JMXStatusTest + */ +public class JMXStatusTest { + private final static String TEST_APP_NAME = "TestApp"; + + private final static Pattern DISABLE_AGENT_STATUS = Pattern.compile( + "Agent\\s*\\: disabled$" + ); + + private final static Pattern LOCAL_AGENT_STATUS = Pattern.compile( + "Agent\\s*\\:\\s*enabled\\n+" + + "Connection Type\\s*\\:\\s*local\\n+" + + "Protocol\\s*\\:\\s*[a-z]+\\n+" + + "Host\\s*\\:\\s*.+\\n+" + + "URL\\s*\\:\\s*service\\:jmx\\:.+", + Pattern.MULTILINE + ); + + private final static Pattern REMOTE_AGENT_STATUS = Pattern.compile( + "Agent\\s*\\: enabled\\n+" + + "Connection Type\\s*\\: remote\\n+" + + "Protocol\\s*\\: [a-z]+\\n+" + + "Host\\s*\\: .+\\n+" + + "URL\\s*\\: service\\:jmx\\:.+\\n+" + + "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+\\n*)+", + Pattern.MULTILINE + ); + + private static ProcessBuilder testAppPb; + private Process testApp; + + private ManagementAgentJcmd jcmd; + + @BeforeClass + public static void setupClass() throws Exception { + testAppPb = ProcessTools.createJavaProcessBuilder( + "-cp", System.getProperty("test.class.path"), + TEST_APP_NAME + ); + } + + @BeforeTest + public void setup() { + jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false); + } + + @BeforeMethod + public void startTestApp() throws Exception { + testApp = ProcessTools.startProcess( + TEST_APP_NAME, testAppPb, + (Predicate)l->l.trim().equals("main enter") + ); + } + + @AfterMethod + public void stopTestApp() throws Exception { + testApp.getOutputStream().write(1); + testApp.getOutputStream().flush(); + testApp.waitFor(); + testApp = null; + } + + @Test + public void testAgentDisabled() throws Exception { + String status = jcmd.status(); + assertStatusMatches(DISABLE_AGENT_STATUS, status); + } + + @Test + public void testAgentLocal() throws Exception { + jcmd.startLocal(); + String status = jcmd.status(); + + assertStatusMatches(LOCAL_AGENT_STATUS, status); + } + + @Test + public void testAgentRemote() throws Exception { + while (true) { + try { + int[] ports = PortAllocator.allocatePorts(1); + jcmd.start( + "jmxremote.port=" + ports[0], + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); + String status = jcmd.status(); + + assertStatusMatches(REMOTE_AGENT_STATUS, status); + return; + } catch (BindException e) { + System.out.println("Failed to allocate ports. Retrying ..."); + } + } + } + + private void assertStatusMatches(Pattern expected, String value) { + assertStatusMatches(expected, value, ""); + } + + private void assertStatusMatches(Pattern expected, String value, String msg) { + int idx = value.indexOf('\n'); + if (idx > -1) { + value = value.substring(idx + 1).trim(); + assertTrue(expected.matcher(value).find(), msg); + } else { + fail("The management agent status must contain more then one line of text"); + } + } +} diff --git a/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java new file mode 100644 index 00000000000..efee771cf4a --- /dev/null +++ b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2015, 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. + */ +import java.io.IOException; +import java.net.BindException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import sun.management.Agent; +import sun.management.AgentConfigurationError; + +import jdk.testlibrary.JDKToolLauncher; +import jdk.testlibrary.ProcessTools; + +/** + * A helper class for issuing ManagementAgent.* diagnostic commands and capturing + * their output. + */ +final class ManagementAgentJcmd { + private static final String CMD_STOP = "ManagementAgent.stop"; + private static final String CMD_START = "ManagementAgent.start"; + private static final String CMD_START_LOCAL = "ManagementAgent.start_local"; + private static final String CMD_STATUS = "ManagementAgent.status"; + + private final String id; + private final boolean verbose; + + public ManagementAgentJcmd(String targetApp, boolean verbose) { + this.id = targetApp; + this.verbose = verbose; + } + + /** + * `jcmd` + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + public String list() throws IOException, InterruptedException { + return jcmd(); + } + + /** + * `jcmd ManagementAgent.stop` + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + public String stop() throws IOException, InterruptedException { + return jcmd(CMD_STOP); + } + + /** + * `jcmd ManagementAgent.start_local` + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + public String startLocal() throws IOException, InterruptedException { + return jcmd(CMD_START_LOCAL); + } + + /** + * `jcmd ManagementAgent.start ` + * @return The JCMD output + * @param params The arguments to ManagementAgent.start command + * @throws IOException + * @throws InterruptedException + */ + public String start(String ... params) throws IOException, InterruptedException { + return start(c->{}, params); + } + + /** + * `jcmd ManagementAgent.start ` + * @param c A string consumer used to inspect the jcmd output line-by-line + * @param params The arguments to ManagementAgent.start command + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + public String start(Consumer c, String ... params) throws IOException, InterruptedException { + List args = new ArrayList<>(); + args.add(CMD_START); + args.addAll(Arrays.asList(params)); + return jcmd(c, args.toArray(new String[args.size()])); + } + + public String status() throws IOException, InterruptedException { + return jcmd(CMD_STATUS); + } + + /** + * Run the "jcmd" command + * + * @param command Command + arguments + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + private String jcmd(String ... command) throws IOException, InterruptedException { + if (command.length == 0) { + return jcmd(null, c->{}); + } else { + return jcmd(c->{}, command); + } + } + + /** + * Run the "jcmd" command + * + * @param c {@linkplain Consumer} instance + * @param command Command + arguments + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + private String jcmd(Consumer c, String ... command) throws IOException, InterruptedException { + return jcmd(id, c, command); + } + + /** + * Run the "jcmd" command + * + * @param target The target application name (or PID) + * @param c {@linkplain Consumer} instance + * @param command Command + arguments + * @return The JCMD output + * @throws IOException + * @throws InterruptedException + */ + private String jcmd(String target, final Consumer c, String ... command) throws IOException, InterruptedException { + dbg_print("[jcmd] " + (command.length > 0 ? command[0] : "list")); + + JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jcmd"); + l.addToolArg(target); + for (String cmd : command) { + l.addToolArg(cmd); + } + + StringBuilder output = new StringBuilder(); + + AtomicBoolean portUnavailable = new AtomicBoolean(false); + Process p = ProcessTools.startProcess( + "jcmd", + new ProcessBuilder(l.getCommand()), + line -> { + if (line.contains("BindException") || + line.contains(Agent.getText(AgentConfigurationError.CONNECTOR_SERVER_IO_ERROR))) { + portUnavailable.set(true); + } else { + output.append(line).append('\n'); + c.accept(line); + } + } + ); + + p.waitFor(); + dbg_print("[jcmd] --------"); + if (portUnavailable.get()) { + String cmd = Arrays.asList(l.getCommand()).stream() + .collect( + Collectors.joining(" ", "", ": Unable to bind address") + ); + throw new BindException(cmd); + } + + return output.toString(); + } + + private void dbg_print(String msg) { + if (verbose) { + System.out.println("DBG: " + msg); + } + } +} diff --git a/jdk/test/sun/management/jmxremote/startstop/PortAllocator.java b/jdk/test/sun/management/jmxremote/startstop/PortAllocator.java new file mode 100644 index 00000000000..444dfbde410 --- /dev/null +++ b/jdk/test/sun/management/jmxremote/startstop/PortAllocator.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.util.Random; + +/** + * Dynamically allocates distinct ports from the ephemeral range 49152-65535 + */ +class PortAllocator { + private final static int LOWER_BOUND = 49152; + private final static int UPPER_BOUND = 65535; + + private final static Random RND = new Random(System.currentTimeMillis()); + + static int[] allocatePorts(final int numPorts) { + int[] ports = new int[numPorts]; + for (int i = 0; i < numPorts; i++) { + int port = -1; + while (port == -1) { + port = RND.nextInt(UPPER_BOUND - LOWER_BOUND + 1) + LOWER_BOUND; + for (int j = 0; j < i; j++) { + if (ports[j] == port) { + port = -1; + break; + } + } + } + ports[i] = port; + } + return ports; + } +} diff --git a/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt b/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt index 20c85f1f0be..770bf20f228 100644 --- a/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt +++ b/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt @@ -4,7 +4,7 @@ on host 1 4. run - ${TESTJAVA}/bin/java -server JMXStartStopDoSomething \ + ${TESTJAVA}/bin/java -server TestApp \ -Dcom.sun.management.jmxremote.port=50234 \ -Dcom.sun.management.jmxremote.rmi.port=50235 \ -Dcom.sun.management.jmxremote.authenticate=false \ diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java b/jdk/test/sun/management/jmxremote/startstop/TestApp.java similarity index 90% rename from jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java rename to jdk/test/sun/management/jmxremote/startstop/TestApp.java index 5a04a6d718b..997f9f5b900 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java +++ b/jdk/test/sun/management/jmxremote/startstop/TestApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -22,9 +22,8 @@ */ import java.io.IOException; -import jdk.testlibrary.ProcessTools; -public class JMXStartStopDoSomething { +public class TestApp { public static void doSomething() throws IOException{ int r = System.in.read(); System.out.println("read: " + r); From 252f04c7fdd9c8cf3c9a1efd216209ac612b6411 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 31 Mar 2015 12:30:52 -0700 Subject: [PATCH 08/63] 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods Use unaligned Unsafe loads and stores for ByteBuffer access on platforms which support unaligned access. Add intrinsics for Unsafe.{get,put}-X-Unaligned methods. Reviewed-by: dholmes, jrose, psandoz, kvn --- .../share/classes/java/nio/Bits.java | 35 +- .../java/nio/Heap-X-Buffer.java.template | 75 ++-- .../share/classes/sun/misc/Unsafe.java | 343 ++++++++++++++++++ .../security/provider/ByteArrayAccess.java | 9 +- 4 files changed, 399 insertions(+), 63 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/nio/Bits.java b/jdk/src/java.base/share/classes/java/nio/Bits.java index c7f2b78422b..d23e35e82aa 100644 --- a/jdk/src/java.base/share/classes/java/nio/Bits.java +++ b/jdk/src/java.base/share/classes/java/nio/Bits.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -567,32 +567,13 @@ class Bits { // package-private // -- Processor and memory-system properties -- - private static final ByteOrder byteOrder; + private static final ByteOrder byteOrder + = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; static ByteOrder byteOrder() { - if (byteOrder == null) - throw new Error("Unknown byte order"); return byteOrder; } - static { - long a = unsafe.allocateMemory(8); - try { - unsafe.putLong(a, 0x0102030405060708L); - byte b = unsafe.getByte(a); - switch (b) { - case 0x01: byteOrder = ByteOrder.BIG_ENDIAN; break; - case 0x08: byteOrder = ByteOrder.LITTLE_ENDIAN; break; - default: - assert false; - byteOrder = null; - } - } finally { - unsafe.freeMemory(a); - } - } - - private static int pageSize = -1; static int pageSize() { @@ -605,17 +586,9 @@ class Bits { // package-private return (int)(size + (long)pageSize() - 1L) / pageSize(); } - private static boolean unaligned; - private static boolean unalignedKnown = false; + private static boolean unaligned = unsafe.unalignedAccess(); static boolean unaligned() { - if (unalignedKnown) - return unaligned; - String arch = AccessController.doPrivileged( - new sun.security.action.GetPropertyAction("os.arch")); - unaligned = arch.equals("i386") || arch.equals("x86") - || arch.equals("amd64") || arch.equals("x86_64"); - unalignedKnown = true; return unaligned; } diff --git a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template index e8639c4d21f..3876b147093 100644 --- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template +++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, 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 @@ -27,6 +27,7 @@ package java.nio; +import sun.misc.Unsafe; /** #if[rw] @@ -52,6 +53,16 @@ class Heap$Type$Buffer$RW$ #end[rw] */ +#if[byte] + + // Cached unsafe-access object + private static final Unsafe unsafe = Bits.unsafe(); + + // Cached array base offset + private static final long arrayBaseOffset = unsafe.arrayBaseOffset($type$[].class); + +#end[byte] + Heap$Type$Buffer$RW$(int cap, int lim) { // package-private #if[rw] super(-1, 0, lim, cap, new $type$[cap], 0); @@ -131,6 +142,12 @@ class Heap$Type$Buffer$RW$ return i + offset; } +#if[byte] + private long byteOffset(long i) { + return arrayBaseOffset + i + offset; + } +#end[byte] + public $type$ get() { return hb[ix(nextGetIndex())]; } @@ -256,18 +273,18 @@ class Heap$Type$Buffer$RW$ #if[rw] public char getChar() { - return Bits.getChar(this, ix(nextGetIndex(2)), bigEndian); + return unsafe.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); } public char getChar(int i) { - return Bits.getChar(this, ix(checkIndex(i, 2)), bigEndian); + return unsafe.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); } #end[rw] public $Type$Buffer putChar(char x) { #if[rw] - Bits.putChar(this, ix(nextPutIndex(2)), x, bigEndian); + unsafe.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -276,7 +293,7 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putChar(int i, char x) { #if[rw] - Bits.putChar(this, ix(checkIndex(i, 2)), x, bigEndian); + unsafe.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -307,18 +324,18 @@ class Heap$Type$Buffer$RW$ #if[rw] public short getShort() { - return Bits.getShort(this, ix(nextGetIndex(2)), bigEndian); + return unsafe.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); } public short getShort(int i) { - return Bits.getShort(this, ix(checkIndex(i, 2)), bigEndian); + return unsafe.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); } #end[rw] public $Type$Buffer putShort(short x) { #if[rw] - Bits.putShort(this, ix(nextPutIndex(2)), x, bigEndian); + unsafe.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -327,7 +344,7 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putShort(int i, short x) { #if[rw] - Bits.putShort(this, ix(checkIndex(i, 2)), x, bigEndian); + unsafe.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -358,18 +375,18 @@ class Heap$Type$Buffer$RW$ #if[rw] public int getInt() { - return Bits.getInt(this, ix(nextGetIndex(4)), bigEndian); + return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian); } public int getInt(int i) { - return Bits.getInt(this, ix(checkIndex(i, 4)), bigEndian); + return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); } #end[rw] public $Type$Buffer putInt(int x) { #if[rw] - Bits.putInt(this, ix(nextPutIndex(4)), x, bigEndian); + unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -378,7 +395,7 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putInt(int i, int x) { #if[rw] - Bits.putInt(this, ix(checkIndex(i, 4)), x, bigEndian); + unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -409,18 +426,18 @@ class Heap$Type$Buffer$RW$ #if[rw] public long getLong() { - return Bits.getLong(this, ix(nextGetIndex(8)), bigEndian); + return unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian); } public long getLong(int i) { - return Bits.getLong(this, ix(checkIndex(i, 8)), bigEndian); + return unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian); } #end[rw] public $Type$Buffer putLong(long x) { #if[rw] - Bits.putLong(this, ix(nextPutIndex(8)), x, bigEndian); + unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -429,7 +446,7 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putLong(int i, long x) { #if[rw] - Bits.putLong(this, ix(checkIndex(i, 8)), x, bigEndian); + unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -460,18 +477,21 @@ class Heap$Type$Buffer$RW$ #if[rw] public float getFloat() { - return Bits.getFloat(this, ix(nextGetIndex(4)), bigEndian); + int x = unsafe.getIntUnaligned(hb, byteOffset(nextPutIndex(4)), bigEndian); + return Float.intBitsToFloat(x); } public float getFloat(int i) { - return Bits.getFloat(this, ix(checkIndex(i, 4)), bigEndian); + int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); + return Float.intBitsToFloat(x); } #end[rw] public $Type$Buffer putFloat(float x) { #if[rw] - Bits.putFloat(this, ix(nextPutIndex(4)), x, bigEndian); + int y = Float.floatToRawIntBits(x); + unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -480,7 +500,8 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putFloat(int i, float x) { #if[rw] - Bits.putFloat(this, ix(checkIndex(i, 4)), x, bigEndian); + int y = Float.floatToRawIntBits(x); + unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -511,18 +532,21 @@ class Heap$Type$Buffer$RW$ #if[rw] public double getDouble() { - return Bits.getDouble(this, ix(nextGetIndex(8)), bigEndian); + long x = unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian); + return Double.longBitsToDouble(x); } public double getDouble(int i) { - return Bits.getDouble(this, ix(checkIndex(i, 8)), bigEndian); + long x = unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian); + return Double.longBitsToDouble(x); } #end[rw] public $Type$Buffer putDouble(double x) { #if[rw] - Bits.putDouble(this, ix(nextPutIndex(8)), x, bigEndian); + long y = Double.doubleToRawLongBits(x); + unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); @@ -531,7 +555,8 @@ class Heap$Type$Buffer$RW$ public $Type$Buffer putDouble(int i, double x) { #if[rw] - Bits.putDouble(this, ix(checkIndex(i, 8)), x, bigEndian); + long y = Double.doubleToRawLongBits(x); + unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian); return this; #else[rw] throw new ReadOnlyBufferException(); diff --git a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java index 5ca9cb3059d..ccbe0ed1d0e 100644 --- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java +++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java @@ -934,4 +934,347 @@ public final class Unsafe { private static void throwIllegalAccessError() { throw new IllegalAccessError(); } + + /** + * @return Returns true if the native byte ordering of this + * platform is big-endian, false if it is little-endian. + */ + public final boolean isBigEndian() { return BE; } + + /** + * @return Returns true if this platform is capable of performing + * accesses at addresses which are not aligned for the type of the + * primitive type being accessed, false otherwise. + */ + public final boolean unalignedAccess() { return unalignedAccess; } + + /** + * Fetches a value at some byte offset into a given Java object. + * More specifically, fetches a value within the given object + * o at the given offset, or (if o is + * null) from the memory address whose numerical value is the + * given offset.

+ * + * The specification of this method is the same as {@link + * #getLong(Object, long)} except that the offset does not need to + * have been obtained from {@link #objectFieldOffset} on the + * {@link java.lang.reflect.Field} of some Java field. The value + * in memory is raw data, and need not correspond to any Java + * variable. Unless o is null, the value accessed + * must be entirely within the allocated object. The endianness + * of the value in memory is the endianness of the native platform. + * + *

The read will be atomic with respect to the largest power + * of two that divides the GCD of the offset and the storage size. + * For example, getLongUnaligned will make atomic reads of 2-, 4-, + * or 8-byte storage units if the offset is zero mod 2, 4, or 8, + * respectively. There are no other guarantees of atomicity. + *

+ * 8-byte atomicity is only guaranteed on platforms on which + * support atomic accesses to longs. + * + * @param o Java heap object in which the value resides, if any, else + * null + * @param offset The offset in bytes from the start of the object + * @return the value fetched from the indicated object + * @throws RuntimeException No defined exceptions are thrown, not even + * {@link NullPointerException} + * @since 1.9 + */ + public final long getLongUnaligned(Object o, long offset) { + if ((offset & 7) == 0) { + return getLong(o, offset); + } else if ((offset & 3) == 0) { + return makeLong(getInt(o, offset), + getInt(o, offset + 4)); + } else if ((offset & 1) == 0) { + return makeLong(getShort(o, offset), + getShort(o, offset + 2), + getShort(o, offset + 4), + getShort(o, offset + 6)); + } else { + return makeLong(getByte(o, offset), + getByte(o, offset + 1), + getByte(o, offset + 2), + getByte(o, offset + 3), + getByte(o, offset + 4), + getByte(o, offset + 5), + getByte(o, offset + 6), + getByte(o, offset + 7)); + } + } + /** + * As {@link #getLongUnaligned(Object, long)} but with an + * additional argument which specifies the endianness of the value + * as stored in memory. + * + * @param o Java heap object in which the variable resides + * @param offset The offset in bytes from the start of the object + * @param bigEndian The endianness of the value + * @return the value fetched from the indicated object + * @since 1.9 + */ + public final long getLongUnaligned(Object o, long offset, boolean bigEndian) { + return convEndian(bigEndian, getLongUnaligned(o, offset)); + } + + /** @see #getLongUnaligned(Object, long) */ + public final int getIntUnaligned(Object o, long offset) { + if ((offset & 3) == 0) { + return getInt(o, offset); + } else if ((offset & 1) == 0) { + return makeInt(getShort(o, offset), + getShort(o, offset + 2)); + } else { + return makeInt(getByte(o, offset), + getByte(o, offset + 1), + getByte(o, offset + 2), + getByte(o, offset + 3)); + } + } + /** @see #getLongUnaligned(Object, long, boolean) */ + public final int getIntUnaligned(Object o, long offset, boolean bigEndian) { + return convEndian(bigEndian, getIntUnaligned(o, offset)); + } + + /** @see #getLongUnaligned(Object, long) */ + public final short getShortUnaligned(Object o, long offset) { + if ((offset & 1) == 0) { + return getShort(o, offset); + } else { + return makeShort(getByte(o, offset), + getByte(o, offset + 1)); + } + } + /** @see #getLongUnaligned(Object, long, boolean) */ + public final short getShortUnaligned(Object o, long offset, boolean bigEndian) { + return convEndian(bigEndian, getShortUnaligned(o, offset)); + } + + /** @see #getLongUnaligned(Object, long) */ + public final char getCharUnaligned(Object o, long offset) { + return (char)getShortUnaligned(o, offset); + } + /** @see #getLongUnaligned(Object, long, boolean) */ + public final char getCharUnaligned(Object o, long offset, boolean bigEndian) { + return convEndian(bigEndian, getCharUnaligned(o, offset)); + } + + /** + * Stores a value at some byte offset into a given Java object. + *

+ * The specification of this method is the same as {@link + * #getLong(Object, long)} except that the offset does not need to + * have been obtained from {@link #objectFieldOffset} on the + * {@link java.lang.reflect.Field} of some Java field. The value + * in memory is raw data, and need not correspond to any Java + * variable. The endianness of the value in memory is the + * endianness of the native platform. + *

+ * The write will be atomic with respect to the largest power of + * two that divides the GCD of the offset and the storage size. + * For example, putLongUnaligned will make atomic writes of 2-, 4-, + * or 8-byte storage units if the offset is zero mod 2, 4, or 8, + * respectively. There are no other guarantees of atomicity. + *

+ * 8-byte atomicity is only guaranteed on platforms on which + * support atomic accesses to longs. + *

+ * + * @param o Java heap object in which the value resides, if any, else + * null + * @param offset The offset in bytes from the start of the object + * @param x the value to store + * @throws RuntimeException No defined exceptions are thrown, not even + * {@link NullPointerException} + * @since 1.9 + */ + public final void putLongUnaligned(Object o, long offset, long x) { + if ((offset & 7) == 0) { + putLong(o, offset, x); + } else if ((offset & 3) == 0) { + putLongParts(o, offset, + (int)(x >> 0), + (int)(x >>> 32)); + } else if ((offset & 1) == 0) { + putLongParts(o, offset, + (short)(x >>> 0), + (short)(x >>> 16), + (short)(x >>> 32), + (short)(x >>> 48)); + } else { + putLongParts(o, offset, + (byte)(x >>> 0), + (byte)(x >>> 8), + (byte)(x >>> 16), + (byte)(x >>> 24), + (byte)(x >>> 32), + (byte)(x >>> 40), + (byte)(x >>> 48), + (byte)(x >>> 56)); + } + } + /** + * As {@link #putLongUnaligned(Object, long, long)} but with an additional + * argument which specifies the endianness of the value as stored in memory. + * @param o Java heap object in which the value resides + * @param offset The offset in bytes from the start of the object + * @param x the value to store + * @param bigEndian The endianness of the value + * @throws RuntimeException No defined exceptions are thrown, not even + * {@link NullPointerException} + * @since 1.9 + */ + public final void putLongUnaligned(Object o, long offset, long x, boolean bigEndian) { + putLongUnaligned(o, offset, convEndian(bigEndian, x)); + } + + /** @see #putLongUnaligned(Object, long, long) */ + public final void putIntUnaligned(Object o, long offset, int x) { + if ((offset & 3) == 0) { + putInt(o, offset, x); + } else if ((offset & 1) == 0) { + putIntParts(o, offset, + (short)(x >> 0), + (short)(x >>> 16)); + } else { + putIntParts(o, offset, + (byte)(x >>> 0), + (byte)(x >>> 8), + (byte)(x >>> 16), + (byte)(x >>> 24)); + } + } + /** @see #putLongUnaligned(Object, long, long, boolean) */ + public final void putIntUnaligned(Object o, long offset, int x, boolean bigEndian) { + putIntUnaligned(o, offset, convEndian(bigEndian, x)); + } + + /** @see #putLongUnaligned(Object, long, long) */ + public final void putShortUnaligned(Object o, long offset, short x) { + if ((offset & 1) == 0) { + putShort(o, offset, x); + } else { + putShortParts(o, offset, + (byte)(x >>> 0), + (byte)(x >>> 8)); + } + } + /** @see #putLongUnaligned(Object, long, long, boolean) */ + public final void putShortUnaligned(Object o, long offset, short x, boolean bigEndian) { + putShortUnaligned(o, offset, convEndian(bigEndian, x)); + } + + /** @see #putLongUnaligned(Object, long, long) */ + public final void putCharUnaligned(Object o, long offset, char x) { + putShortUnaligned(o, offset, (short)x); + } + /** @see #putLongUnaligned(Object, long, long, boolean) */ + public final void putCharUnaligned(Object o, long offset, char x, boolean bigEndian) { + putCharUnaligned(o, offset, convEndian(bigEndian, x)); + } + + // JVM interface methods + private native boolean unalignedAccess0(); + private native boolean isBigEndian0(); + + // BE is true iff the native endianness of this platform is big. + private static final boolean BE = theUnsafe.isBigEndian0(); + + // unalignedAccess is true iff this platform can perform unaligned accesses. + private static final boolean unalignedAccess = theUnsafe.unalignedAccess0(); + + private static int pickPos(int top, int pos) { return BE ? top - pos : pos; } + + // These methods construct integers from bytes. The byte ordering + // is the native endianness of this platform. + private static long makeLong(byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7) { + return ((toUnsignedLong(i0) << pickPos(56, 0)) + | (toUnsignedLong(i1) << pickPos(56, 8)) + | (toUnsignedLong(i2) << pickPos(56, 16)) + | (toUnsignedLong(i3) << pickPos(56, 24)) + | (toUnsignedLong(i4) << pickPos(56, 32)) + | (toUnsignedLong(i5) << pickPos(56, 40)) + | (toUnsignedLong(i6) << pickPos(56, 48)) + | (toUnsignedLong(i7) << pickPos(56, 56))); + } + private static long makeLong(short i0, short i1, short i2, short i3) { + return ((toUnsignedLong(i0) << pickPos(48, 0)) + | (toUnsignedLong(i1) << pickPos(48, 16)) + | (toUnsignedLong(i2) << pickPos(48, 32)) + | (toUnsignedLong(i3) << pickPos(48, 48))); + } + private static long makeLong(int i0, int i1) { + return (toUnsignedLong(i0) << pickPos(32, 0)) + | (toUnsignedLong(i1) << pickPos(32, 32)); + } + private static int makeInt(short i0, short i1) { + return (toUnsignedInt(i0) << pickPos(16, 0)) + | (toUnsignedInt(i1) << pickPos(16, 16)); + } + private static int makeInt(byte i0, byte i1, byte i2, byte i3) { + return ((toUnsignedInt(i0) << pickPos(24, 0)) + | (toUnsignedInt(i1) << pickPos(24, 8)) + | (toUnsignedInt(i2) << pickPos(24, 16)) + | (toUnsignedInt(i3) << pickPos(24, 24))); + } + private static short makeShort(byte i0, byte i1) { + return (short)((toUnsignedInt(i0) << pickPos(8, 0)) + | (toUnsignedInt(i1) << pickPos(8, 8))); + } + + private static byte pick(byte le, byte be) { return BE ? be : le; } + private static short pick(short le, short be) { return BE ? be : le; } + private static int pick(int le, int be) { return BE ? be : le; } + + // These methods write integers to memory from smaller parts + // provided by their caller. The ordering in which these parts + // are written is the native endianness of this platform. + private void putLongParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7) { + putByte(o, offset + 0, pick(i0, i7)); + putByte(o, offset + 1, pick(i1, i6)); + putByte(o, offset + 2, pick(i2, i5)); + putByte(o, offset + 3, pick(i3, i4)); + putByte(o, offset + 4, pick(i4, i3)); + putByte(o, offset + 5, pick(i5, i2)); + putByte(o, offset + 6, pick(i6, i1)); + putByte(o, offset + 7, pick(i7, i0)); + } + private void putLongParts(Object o, long offset, short i0, short i1, short i2, short i3) { + putShort(o, offset + 0, pick(i0, i3)); + putShort(o, offset + 2, pick(i1, i2)); + putShort(o, offset + 4, pick(i2, i1)); + putShort(o, offset + 6, pick(i3, i0)); + } + private void putLongParts(Object o, long offset, int i0, int i1) { + putInt(o, offset + 0, pick(i0, i1)); + putInt(o, offset + 4, pick(i1, i0)); + } + private void putIntParts(Object o, long offset, short i0, short i1) { + putShort(o, offset + 0, pick(i0, i1)); + putShort(o, offset + 2, pick(i1, i0)); + } + private void putIntParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3) { + putByte(o, offset + 0, pick(i0, i3)); + putByte(o, offset + 1, pick(i1, i2)); + putByte(o, offset + 2, pick(i2, i1)); + putByte(o, offset + 3, pick(i3, i0)); + } + private void putShortParts(Object o, long offset, byte i0, byte i1) { + putByte(o, offset + 0, pick(i0, i1)); + putByte(o, offset + 1, pick(i1, i0)); + } + + // Zero-extend an integer + private static int toUnsignedInt(byte n) { return n & 0xff; } + private static int toUnsignedInt(short n) { return n & 0xffff; } + private static long toUnsignedLong(byte n) { return n & 0xffl; } + private static long toUnsignedLong(short n) { return n & 0xffffl; } + private static long toUnsignedLong(int n) { return n & 0xffffffffl; } + + // Maybe byte-reverse an integer + private static char convEndian(boolean big, char n) { return big == BE ? n : Character.reverseBytes(n); } + private static short convEndian(boolean big, short n) { return big == BE ? n : Short.reverseBytes(n) ; } + private static int convEndian(boolean big, int n) { return big == BE ? n : Integer.reverseBytes(n) ; } + private static long convEndian(boolean big, long n) { return big == BE ? n : Long.reverseBytes(n) ; } } diff --git a/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java b/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java index e06832bf3c6..1669429a4fa 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015, 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 @@ -88,13 +88,8 @@ final class ByteArrayAccess { // Return whether this platform supports full speed int/long memory access // at unaligned addresses. - // This code was copied from java.nio.Bits because there is no equivalent - // public API. private static boolean unaligned() { - String arch = java.security.AccessController.doPrivileged - (new sun.security.action.GetPropertyAction("os.arch", "")); - return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64") - || arch.equals("x86_64"); + return unsafe.unalignedAccess(); } /** From 4d07222b01149cef33ec5e0fc3316c5dddbc6569 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 3 Apr 2015 15:39:38 +0200 Subject: [PATCH 09/63] 8074368: ThreadMXBean.getThreadInfo() corrupts memory when called with empty array for thread ids Reviewed-by: mchung --- .../classes/sun/management/ThreadImpl.java | 10 ++- .../ThreadMXBean/ThreadInfoArray.java | 81 ++++++++++++++++--- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java b/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java index 019646ad4fe..9ac9868af22 100644 --- a/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java +++ b/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -165,6 +165,10 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { "Invalid maxDepth parameter: " + maxDepth); } + // ids has been verified to be non-null + // an empty array of ids should return an empty array of ThreadInfos + if (ids.length == 0) return new ThreadInfo[0]; + Util.checkMonitorAccess(); ThreadInfo[] infos = new ThreadInfo[ids.length]; // nulls @@ -436,6 +440,10 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { boolean lockedMonitors, boolean lockedSynchronizers) { verifyThreadIds(ids); + // ids has been verified to be non-null + // an empty array of ids should return an empty array of ThreadInfos + if (ids.length == 0) return new ThreadInfo[0]; + verifyDumpThreads(lockedMonitors, lockedSynchronizers); return dumpThreads0(ids, lockedMonitors, lockedSynchronizers); } diff --git a/jdk/test/java/lang/management/ThreadMXBean/ThreadInfoArray.java b/jdk/test/java/lang/management/ThreadMXBean/ThreadInfoArray.java index 8b504344143..14ff9857b6b 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/ThreadInfoArray.java +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadInfoArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -23,11 +23,12 @@ /* * @test - * @bug 5058327 - * @summary Test if getThreadInfo(long[]) returns a ThreadInfo[] - * with null elements with no exception. + * @bug 5058327 8074368 + * @summary Tests the correct behaviour of getThreadInfo(long[]) for non-existent + * thread IDs and the empty thread id array. * * @author Mandy Chung + * @author Jaroslav Bachorik * * @build ThreadInfoArray * @run main ThreadInfoArray @@ -35,15 +36,30 @@ import java.lang.management.*; import javax.management.*; -import java.util.*; import static java.lang.management.ManagementFactory.*; public class ThreadInfoArray { public static void main(String[] argv) throws Exception { - ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + ObjectName on = new ObjectName(THREAD_MXBEAN_NAME); + ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); + ThreadMXBean proxy = newPlatformMXBeanProxy(mbs, + on.toString(), + ThreadMXBean.class); + + checkNullElement(mbean, proxy, mbs, on); + checkEmptyArray(mbean, proxy, mbs, on); + System.out.println("Test passed"); + } + + private static void checkNullElement(ThreadMXBean mbean, ThreadMXBean proxy, + MBeanServer mbs, ObjectName on) + throws Exception { + System.out.println("--- Check null element"); // ID for a new thread long [] ids = {new Thread().getId()}; + // direct call ThreadInfo[] tinfos = mbean.getThreadInfo(ids); if (tinfos[0] != null) { @@ -52,8 +68,6 @@ public class ThreadInfoArray { } // call getThreadInfo through MBeanServer - MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - ObjectName on = new ObjectName(THREAD_MXBEAN_NAME); Object[] params = {ids}; String[] sigs = {"[J"}; Object[] result = (Object[]) mbs.invoke(on, "getThreadInfo", params, sigs); @@ -64,14 +78,57 @@ public class ThreadInfoArray { } // call getThreadInfo through proxy - ThreadMXBean proxy = newPlatformMXBeanProxy(mbs, - on.toString(), - ThreadMXBean.class); tinfos = proxy.getThreadInfo(ids); if (tinfos[0] != null) { throw new RuntimeException("TEST FAILED: " + "Expected to have a null element"); } - System.out.println("Test passed"); + System.out.println("--- PASSED"); + } + + private static void checkEmptyArray(ThreadMXBean mbean, ThreadMXBean proxy, + MBeanServer mbs, ObjectName on) + throws Exception { + System.out.println("--- Check empty TID array"); + + long[] ids = new long[0]; + // direct call + assertEmptyArray(mbean.getThreadInfo(ids), "Expected empty ThreadInfo array"); + assertEmptyArray(mbean.getThreadInfo(ids, 1), "Expected empty ThreadInfo array"); + assertEmptyArray(mbean.getThreadInfo(ids, true, true), "Expected empty ThreadInfo array"); + + // call getThreadInfo through MBeanServer + assertEmptyArray( + (Object[]) mbs.invoke( + on, "getThreadInfo", new Object[]{ids}, new String[]{"[J"} + ), + "Expected empty ThreadInfo array via MBeanServer" + ); + assertEmptyArray( + (Object[]) mbs.invoke( + on, "getThreadInfo", new Object[]{ids, 1}, + new String[]{"[J", "int"} + ), + "Expected empty ThreadInfo array via MBeanServer" + ); + assertEmptyArray( + (Object[]) mbs.invoke( + on, "getThreadInfo", new Object[]{ids, true, true}, + new String[]{"[J", "boolean", "boolean"} + ), + "Expected empty ThreadInfo array via MBeanServer" + ); + + // call getThreadInfo through proxy + assertEmptyArray(proxy.getThreadInfo(ids), "Expected empty ThreadInfo array"); + assertEmptyArray(proxy.getThreadInfo(ids, 1), "Expected empty ThreadInfo array"); + assertEmptyArray(proxy.getThreadInfo(ids, true, true), "Expected empty ThreadInfo array"); + System.out.println("--- PASSED"); + } + + private static void assertEmptyArray(Object[] arr, String message) throws Exception { + if (arr.length > 0) { + throw new RuntimeException("TEST FAILED: " + message); + } } } From 0ef006faca2759d84edc0e6d0e0c6891c71c7c43 Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Tue, 7 Apr 2015 14:47:33 +0200 Subject: [PATCH 10/63] 8027668: sun/tools/jstatd/TestJstatdPort.java: java.net.ConnectException: Connection refused: connect Reviewed-by: jbachorik, sla --- .../share/classes/sun/tools/jstatd/Jstatd.java | 4 +++- jdk/test/ProblemList.txt | 8 +------- jdk/test/sun/tools/jstatd/JstatdTest.java | 13 ++++++------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java index 09a17803cfa..ff2cca02269 100644 --- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java +++ b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -142,6 +142,8 @@ public class Jstatd { RemoteHost stub = (RemoteHost) UnicastRemoteObject.exportObject( remoteHost, 0); bind(name.toString(), remoteHost); + System.out.println("jstatd started (bound to " + name.toString() + ")"); + System.out.flush(); } catch (MalformedURLException e) { if (rminame != null) { System.out.println("Bad RMI server name: " + rminame); diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index b460c3600bb..31319caf8e9 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -318,13 +318,7 @@ sun/tools/jcmd/TestJcmdSanity.java windows-all # 8072131 sun/tools/jmap/heapconfig/JMapHeapConfigTest.java macosx-all -# 8027668 -sun/tools/jstatd/TestJstatdDefaults.java generic-all -sun/tools/jstatd/TestJstatdServer.java generic-all -sun/tools/jstatd/TestJstatdPort.java generic-all -sun/tools/jstatd/TestJstatdPortAndServer.java generic-all - -# 8046285 8027668 +# 8046285 sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all # 6456333 diff --git a/jdk/test/sun/tools/jstatd/JstatdTest.java b/jdk/test/sun/tools/jstatd/JstatdTest.java index 73a625cef7c..39110123b84 100644 --- a/jdk/test/sun/tools/jstatd/JstatdTest.java +++ b/jdk/test/sun/tools/jstatd/JstatdTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -22,7 +22,6 @@ */ import java.io.File; -import java.io.IOException; import java.net.UnknownHostException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; @@ -130,8 +129,6 @@ public final class JstatdTest { private OutputAnalyzer runJps() throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps"); launcher.addVMArg("-XX:+UsePerfData"); - // Run jps with -v flag to obtain -Dparent.pid. - launcher.addToolArg("-v"); launcher.addToolArg(getDestination()); String[] cmd = launcher.getCommand(); @@ -277,8 +274,6 @@ public final class JstatdTest { assertTrue(policy.exists() && policy.isFile(), "Security policy " + policy.getAbsolutePath() + " does not exist or not a file"); launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath()); - // -Dparent.pid. will help to identify jstad process started by this test - launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId()); if (port != null) { launcher.addToolArg("-p"); launcher.addToolArg(port); @@ -295,7 +290,7 @@ public final class JstatdTest { private ProcessThread tryToSetupJstatdProcess() throws Throwable { ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread", - getJstatdCmd()); + JstatdTest::isJstadReady, getJstatdCmd()); try { jstatdThread.start(); // Make sure jstatd is up and running @@ -315,6 +310,10 @@ public final class JstatdTest { return jstatdThread; } + private static boolean isJstadReady(String line) { + return line.startsWith("jstatd started (bound to "); + } + public void doTest() throws Throwable { ProcessThread jstatdThread = null; try { From 6cbdf1b8f42fcb9a5d84b012de066b8afdc078f5 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Thu, 9 Apr 2015 08:46:19 +0200 Subject: [PATCH 11/63] 8075331: jdb eval java.util.Arrays.asList(array) shows inconsistent behaviour Reviewed-by: jbachorik --- .../com/sun/tools/jdi/InterfaceTypeImpl.java | 13 ++- jdk/test/com/sun/jdi/InvokeVarArgs.java | 97 +++++++++++++++++++ 2 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 jdk/test/com/sun/jdi/InvokeVarArgs.java diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java index da7e55a2d9f..0f263ad3537 100644 --- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java +++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -130,6 +130,15 @@ final public class InterfaceTypeImpl extends InvokableTypeImpl return null; } + @Override + boolean isAssignableTo(ReferenceType type) { + if (type.name().equals("java.lang.Object")) { + // interfaces are always assignable to j.l.Object + return true; + } + return super.isAssignableTo(type); + } + @Override List interfaces() { return superinterfaces(); @@ -140,4 +149,4 @@ final public class InterfaceTypeImpl extends InvokableTypeImpl // method must be directly in this interface return this.equals(method.declaringType()); } -} \ No newline at end of file +} diff --git a/jdk/test/com/sun/jdi/InvokeVarArgs.java b/jdk/test/com/sun/jdi/InvokeVarArgs.java new file mode 100644 index 00000000000..45af920db9f --- /dev/null +++ b/jdk/test/com/sun/jdi/InvokeVarArgs.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2015, 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 8075331 + * @summary Verify that we can call varargs methods + * @run build TestScaffold VMConnection TargetAdapter TargetListener + * @run compile -g InvokeVarArgs.java + * @run driver InvokeVarArgs + */ + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import java.util.Arrays; + +interface MyInterface { +} + +class SomeClass implements MyInterface { +} + +class InvokeVarArgsTarg { + + public static void main(String args[]) { + new InvokeVarArgsTarg().run(); + } + + SomeClass someClass1 = new SomeClass(); + SomeClass someClass2 = new SomeClass(); + + MyInterface[] array = new MyInterface[]{someClass1, someClass2}; + SomeClass[] array2 = new SomeClass[]{someClass1, someClass2}; + + public void run() { + System.out.println("size(array) : " + size(array)); + System.out.println("size(array2) : " + size(array2)); + } + + int size(Object... value) { + return value.length; + } +} + +public class InvokeVarArgs extends TestScaffold { + + public static void main(String args[]) throws Exception { + new InvokeVarArgs(args).startTests(); + } + + InvokeVarArgs(String args[]) throws Exception { + super(args); + } + + protected void runTests() throws Exception { + + BreakpointEvent bpe = startTo("InvokeVarArgsTarg", "run", "()V"); + StackFrame frame = bpe.thread().frame(0); + ObjectReference targetObj = frame.thisObject(); + ReferenceType targetType = (ReferenceType) targetObj.type(); + Value arrayVal = targetObj.getValue(targetType.fieldByName("array")); + Value array2Val = targetObj.getValue(targetType.fieldByName("array2")); + Method sizeMethod = targetType.methodsByName("size", "([Ljava/lang/Object;)I").get(0); + + IntegerValue size = (IntegerValue) targetObj.invokeMethod(bpe.thread(), sizeMethod, Arrays.asList(new Value[]{arrayVal}), 0); + if (size.value() != 2) { + throw new Exception("size(array) should be 2, but was " + size.value()); + } + + size = (IntegerValue) targetObj.invokeMethod(bpe.thread(), sizeMethod, Arrays.asList(new Value[]{array2Val}), 0); + if (size.value() != 2) { + throw new Exception("size(array2) should be 2, but was " + size.value()); + } + + listenUntilVMDisconnect(); + } +} From c3e9d85d317bc403d6d14025b753a4c66047a77f Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Thu, 9 Apr 2015 09:18:56 +0200 Subject: [PATCH 12/63] 8077137: Port jdk.internal.instrumentation to jdk 9 Reviewed-by: erikj, mchung, rriggs --- jdk/make/lib/Lib-java.instrument.gmk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk index 4aaec5ce5e2..6d5f707387c 100644 --- a/jdk/make/lib/Lib-java.instrument.gmk +++ b/jdk/make/lib/Lib-java.instrument.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, 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 @@ -25,6 +25,9 @@ include LibCommon.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.instrument.gmk)) + ################################################################################ LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \ From 77b5a0e6c013c91c0a0dfaa842eecfc5381cddd7 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 13 Apr 2015 09:43:12 +0200 Subject: [PATCH 13/63] 8076050: java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java fails intermittently Reviewed-by: sla --- .../lang/Thread/ThreadStateController.java | 14 ++- .../ThreadMXBean/ThreadMXBeanStateTest.java | 109 +++++++++--------- 2 files changed, 63 insertions(+), 60 deletions(-) diff --git a/jdk/test/java/lang/Thread/ThreadStateController.java b/jdk/test/java/lang/Thread/ThreadStateController.java index e2c6341b471..728a115c271 100644 --- a/jdk/test/java/lang/Thread/ThreadStateController.java +++ b/jdk/test/java/lang/Thread/ThreadStateController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015 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 @@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; import jdk.testlibrary.LockFreeLogManager; +import jdk.testlibrary.Utils; /** * ThreadStateController allows a thread to request this thread to transition @@ -73,7 +74,7 @@ public class ThreadStateController extends Thread { public static void pause(long ms) { try { - Thread.sleep(ms); + Thread.sleep(Utils.adjustTimeout(ms)); } catch (InterruptedException e) { throw new RuntimeException(e); } @@ -135,7 +136,7 @@ public class ThreadStateController extends Thread { try { // this thread has escaped the BLOCKED state // release the lock and a short wait before continue - lock.wait(10); + lock.wait(Utils.adjustTimeout(10)); } catch (InterruptedException e) { // ignore interrupted.incrementAndGet(); @@ -165,7 +166,7 @@ public class ThreadStateController extends Thread { getId(), getName(), iterations.get(), interrupted.get()); try { stateChange(nextState); - lock.wait(10000); + lock.wait(Integer.MAX_VALUE); log("%d: %s wakes up from timed waiting (iterations %d interrupted %d)%n", getId(), getName(), iterations.get(), interrupted.get()); } catch (InterruptedException e) { @@ -185,7 +186,8 @@ public class ThreadStateController extends Thread { case S_TIMED_PARKED: { log("%d: %s is going to timed park (iterations %d)%n", getId(), getName(), iterations.get()); - long deadline = System.currentTimeMillis() + 10000*1000; + long deadline = System.currentTimeMillis() + + Utils.adjustTimeout(10000*1000); stateChange(nextState); LockSupport.parkUntil(deadline); break; @@ -195,7 +197,7 @@ public class ThreadStateController extends Thread { getId(), getName(), iterations.get(), interrupted.get()); try { stateChange(nextState); - Thread.sleep(1000000); + Thread.sleep(Utils.adjustTimeout(1000000)); } catch (InterruptedException e) { // finish sleeping interrupted.incrementAndGet(); diff --git a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java index a273bfdd309..249e55a8877 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -64,60 +64,61 @@ public class ThreadMXBeanStateTest { Thread.currentThread().getState(); ThreadStateController thread = new ThreadStateController("StateChanger", globalLock); thread.setDaemon(true); - - // before myThread starts - thread.checkThreadState(NEW); - - thread.start(); - thread.transitionTo(RUNNABLE); - thread.checkThreadState(RUNNABLE); - checkLockInfo(thread, RUNNABLE, null, null); - - thread.suspend(); - ThreadStateController.pause(10); - thread.checkThreadState(RUNNABLE); - checkSuspendedThreadState(thread, RUNNABLE); - thread.resume(); - - synchronized (globalLock) { - thread.transitionTo(BLOCKED); - thread.checkThreadState(BLOCKED); - checkLockInfo(thread, BLOCKED, - globalLock, Thread.currentThread()); - } - - thread.transitionTo(WAITING); - thread.checkThreadState(WAITING); - checkLockInfo(thread, Thread.State.WAITING, - globalLock, null); - - thread.transitionTo(TIMED_WAITING); - thread.checkThreadState(TIMED_WAITING); - checkLockInfo(thread, TIMED_WAITING, - globalLock, null); - - - thread.transitionToPark(true /* timed park */); - thread.checkThreadState(TIMED_WAITING); - checkLockInfo(thread, TIMED_WAITING, null, null); - - thread.transitionToPark(false /* indefinite park */); - thread.checkThreadState(WAITING); - checkLockInfo(thread, WAITING, null, null); - - thread.transitionToSleep(); - thread.checkThreadState(TIMED_WAITING); - checkLockInfo(thread, TIMED_WAITING, null, null); - - thread.transitionTo(TERMINATED); - thread.checkThreadState(TERMINATED); - try { - System.out.println(thread.getLog()); - } catch (InterruptedException e) { - e.printStackTrace(); - System.out.println("TEST FAILED: Unexpected exception."); - throw new RuntimeException(e); + // before myThread starts + thread.checkThreadState(NEW); + + thread.start(); + thread.transitionTo(RUNNABLE); + thread.checkThreadState(RUNNABLE); + checkLockInfo(thread, RUNNABLE, null, null); + + thread.suspend(); + ThreadStateController.pause(10); + thread.checkThreadState(RUNNABLE); + checkSuspendedThreadState(thread, RUNNABLE); + thread.resume(); + + synchronized (globalLock) { + thread.transitionTo(BLOCKED); + thread.checkThreadState(BLOCKED); + checkLockInfo(thread, BLOCKED, + globalLock, Thread.currentThread()); + } + + thread.transitionTo(WAITING); + thread.checkThreadState(WAITING); + checkLockInfo(thread, Thread.State.WAITING, + globalLock, null); + + thread.transitionTo(TIMED_WAITING); + thread.checkThreadState(TIMED_WAITING); + checkLockInfo(thread, TIMED_WAITING, + globalLock, null); + + + thread.transitionToPark(true /* timed park */); + thread.checkThreadState(TIMED_WAITING); + checkLockInfo(thread, TIMED_WAITING, null, null); + + thread.transitionToPark(false /* indefinite park */); + thread.checkThreadState(WAITING); + checkLockInfo(thread, WAITING, null, null); + + thread.transitionToSleep(); + thread.checkThreadState(TIMED_WAITING); + checkLockInfo(thread, TIMED_WAITING, null, null); + + thread.transitionTo(TERMINATED); + thread.checkThreadState(TERMINATED); + } finally { + try { + System.out.println(thread.getLog()); + } catch (InterruptedException e) { + e.printStackTrace(); + System.out.println("TEST FAILED: Unexpected exception."); + throw new RuntimeException(e); + } } System.out.println("Test passed."); } From bc83974fb5d205aeddb6d32ef1b6c129e0e8882c Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 14 Apr 2015 17:59:52 +0300 Subject: [PATCH 14/63] 8077054: DMH LFs should be customizeable Reviewed-by: jrose --- .../share/classes/java/lang/invoke/DirectMethodHandle.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java index 7cdb8c5e982..f02ed74aae5 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java @@ -691,10 +691,4 @@ class DirectMethodHandle extends MethodHandle { } } } - - @Override - void customize() { - assert(form.customized == null); - // No need to customize DMHs. - } } From 40973932589470b14967e013deabb2acfa398713 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 14 Apr 2015 18:03:12 +0300 Subject: [PATCH 15/63] 8057919: Class.getSimpleName() should work for non-JLS compliant class names Reviewed-by: dholmes, jrose --- .../share/classes/java/lang/Class.java | 39 +--- jdk/src/java.base/share/native/include/jvm.h | 3 + .../java.base/share/native/libjava/Class.c | 1 + .../getSimpleName/GetSimpleNameTest.java | 207 ++++++++++++++++++ 4 files changed, 220 insertions(+), 30 deletions(-) create mode 100644 jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index 258ec369ce5..040b39bc7f2 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -1312,7 +1312,7 @@ public final class Class implements java.io.Serializable, // e) Anonymous classes - // JVM Spec 4.8.6: A class must have an EnclosingMethod + // JVM Spec 4.7.7: A class must have an EnclosingMethod // attribute if and only if it is a local class or an // anonymous class. EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo(); @@ -1357,28 +1357,7 @@ public final class Class implements java.io.Serializable, simpleName = getName(); return simpleName.substring(simpleName.lastIndexOf('.')+1); // strip the package name } - // According to JLS3 "Binary Compatibility" (13.1) the binary - // name of non-package classes (not top level) is the binary - // name of the immediately enclosing class followed by a '$' followed by: - // (for nested and inner classes): the simple name. - // (for local classes): 1 or more digits followed by the simple name. - // (for anonymous classes): 1 or more digits. - - // Since getSimpleBinaryName() will strip the binary name of - // the immediately enclosing class, we are now looking at a - // string that matches the regular expression "\$[0-9]*" - // followed by a simple name (considering the simple of an - // anonymous class to be the empty string). - - // Remove leading "\$[0-9]*" from the name - int length = simpleName.length(); - if (length < 1 || simpleName.charAt(0) != '$') - throw new InternalError("Malformed class name"); - int index = 1; - while (index < length && isAsciiDigit(simpleName.charAt(index))) - index++; - // Eventually, this is the empty string iff this is an anonymous class - return simpleName.substring(index); + return simpleName; } /** @@ -1489,20 +1468,20 @@ public final class Class implements java.io.Serializable, Class enclosingClass = getEnclosingClass(); if (enclosingClass == null) // top level class return null; - // Otherwise, strip the enclosing class' name - try { - return getName().substring(enclosingClass.getName().length()); - } catch (IndexOutOfBoundsException ex) { - throw new InternalError("Malformed class name", ex); - } + String name = getSimpleBinaryName0(); + if (name == null) // anonymous class + return ""; + return name; } + private native String getSimpleBinaryName0(); + /** * Returns {@code true} if this is a local class or an anonymous * class. Returns {@code false} otherwise. */ private boolean isLocalOrAnonymousClass() { - // JVM Spec 4.8.6: A class must have an EnclosingMethod + // JVM Spec 4.7.7: A class must have an EnclosingMethod // attribute if and only if it is a local class or an // anonymous class. return getEnclosingMethodInfo() != null; diff --git a/jdk/src/java.base/share/native/include/jvm.h b/jdk/src/java.base/share/native/include/jvm.h index 7177f2e1d1e..91decb2ed82 100644 --- a/jdk/src/java.base/share/native/include/jvm.h +++ b/jdk/src/java.base/share/native/include/jvm.h @@ -395,6 +395,9 @@ JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass); JNIEXPORT jclass JNICALL JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass); +JNIEXPORT jstring JNICALL +JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass); + /* Generics support (JDK 1.5) */ JNIEXPORT jstring JNICALL JVM_GetClassSignature(JNIEnv *env, jclass cls); diff --git a/jdk/src/java.base/share/native/libjava/Class.c b/jdk/src/java.base/share/native/libjava/Class.c index ae759514a79..07a3f6db716 100644 --- a/jdk/src/java.base/share/native/libjava/Class.c +++ b/jdk/src/java.base/share/native/libjava/Class.c @@ -67,6 +67,7 @@ static JNINativeMethod methods[] = { {"getProtectionDomain0", "()" PD, (void *)&JVM_GetProtectionDomain}, {"getDeclaredClasses0", "()[" CLS, (void *)&JVM_GetDeclaredClasses}, {"getDeclaringClass0", "()" CLS, (void *)&JVM_GetDeclaringClass}, + {"getSimpleBinaryName0", "()" STR, (void *)&JVM_GetSimpleBinaryName}, {"getGenericSignature0", "()" STR, (void *)&JVM_GetClassSignature}, {"getRawAnnotations", "()" BA, (void *)&JVM_GetClassAnnotations}, {"getConstantPool", "()" CPL, (void *)&JVM_GetClassConstantPool}, diff --git a/jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java b/jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java new file mode 100644 index 00000000000..69382710191 --- /dev/null +++ b/jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2015, 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 8057919 + * @summary Class.getSimpleName() should work for non-JLS compliant class names + */ +import jdk.internal.org.objectweb.asm.*; +import static jdk.internal.org.objectweb.asm.Opcodes.*; + +public class GetSimpleNameTest { + static class NestedClass {} + class InnerClass {} + + static Class f1() { + class LocalClass {} + return LocalClass.class; + } + + public static void main(String[] args) throws Exception { + assertEquals(NestedClass.class.getSimpleName(), "NestedClass"); + assertEquals( InnerClass.class.getSimpleName(), "InnerClass"); + assertEquals( f1().getSimpleName(), "LocalClass"); + + java.io.Serializable anon = new java.io.Serializable() {}; + assertEquals(anon.getClass().getSimpleName(), ""); + + // Java class names, prepended enclosing class name. + testNested("p.Outer$Nested", "p.Outer", "Nested"); + testInner( "p.Outer$Inner", "p.Inner", "Inner"); + testLocal( "p.Outer$1Local", "p.Outer", "Local"); + testAnon( "p.Outer$1", "p.Outer", ""); + + // Non-Java class names, prepended enclosing class name. + testNested("p.$C1$Nested", "p.$C1$", "Nested"); + testInner( "p.$C1$Inner", "p.$C1$", "Inner"); + testLocal( "p.$C1$Local", "p.$C1$", "Local"); + testAnon( "p.$C1$1", "p.$C1$", ""); + + // Non-Java class names, unrelated class names. + testNested("p1.$Nested$", "p2.$C1$", "Nested"); + testInner( "p1.$Inner$", "p2.$C1$", "Inner"); + testLocal( "p1.$Local$", "p2.$C1$", "Local"); + testAnon( "p1.$anon$", "p2.$C1$", ""); + } + + static void testNested(String innerName, String outerName, String simpleName) throws Exception { + BytecodeGenerator bg = new BytecodeGenerator(innerName, outerName, simpleName); + CustomCL cl = new CustomCL(innerName, outerName, bg.getNestedClasses(true), bg.getNestedClasses(false)); + assertEquals(cl.loadClass(innerName).getSimpleName(), simpleName); + } + + static void testInner(String innerName, String outerName, String simpleName) throws Exception { + BytecodeGenerator bg = new BytecodeGenerator(innerName, outerName, simpleName); + CustomCL cl = new CustomCL(innerName, outerName, bg.getInnerClasses(true), bg.getInnerClasses(false)); + assertEquals(cl.loadClass(innerName).getSimpleName(), simpleName); + } + + static void testLocal(String innerName, String outerName, String simpleName) throws Exception { + BytecodeGenerator bg = new BytecodeGenerator(innerName, outerName, simpleName); + CustomCL cl = new CustomCL(innerName, outerName, bg.getLocalClasses(true), bg.getLocalClasses(false)); + assertEquals(cl.loadClass(innerName).getSimpleName(), simpleName); + } + + static void testAnon(String innerName, String outerName, String simpleName) throws Exception { + BytecodeGenerator bg = new BytecodeGenerator(innerName, outerName, simpleName); + CustomCL cl = new CustomCL(innerName, outerName, bg.getAnonymousClasses(true), bg.getAnonymousClasses(false)); + assertEquals(cl.loadClass(innerName).getSimpleName(), simpleName); + } + + static void assertEquals(Object o1, Object o2) { + if (!java.util.Objects.equals(o1, o2)) { + throw new AssertionError(o1 + " != " + o2); + } + } + + static class CustomCL extends ClassLoader { + final String innerName; + final String outerName; + + final byte[] innerClassFile; + final byte[] outerClassFile; + + CustomCL(String innerName, String outerName, byte[] innerClassFile, byte[] outerClassFile) { + this.innerName = innerName; + this.outerName = outerName; + this.innerClassFile = innerClassFile; + this.outerClassFile = outerClassFile; + } + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (innerName.equals(name)) { + return defineClass(innerName, innerClassFile, 0, innerClassFile.length); + } else if (outerName.equals(name)) { + return defineClass(outerName, outerClassFile, 0, outerClassFile.length); + } else { + throw new ClassNotFoundException(name); + } + } + } + + static class BytecodeGenerator { + final String innerName; + final String outerName; + final String simpleName; + + BytecodeGenerator(String innerName, String outerName, String simpleName) { + this.innerName = intl(innerName); + this.outerName = intl(outerName); + this.simpleName = simpleName; + } + + static String intl(String name) { return name.replace('.', '/'); } + + static void makeDefaultCtor(ClassWriter cw) { + MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + + void makeCtxk(ClassWriter cw, boolean isInner) { + if (isInner) { + cw.visitOuterClass(outerName, "f", "()V"); + } else { + MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f", "()V", null, null); + mv.visitCode(); + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + } + + byte[] getNestedClasses(boolean isInner) { + String name = (isInner ? innerName : outerName); + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, name, null, "java/lang/Object", null); + + cw.visitInnerClass(innerName, outerName, simpleName, ACC_PUBLIC | ACC_STATIC); + + makeDefaultCtor(cw); + cw.visitEnd(); + return cw.toByteArray(); + } + + byte[] getInnerClasses(boolean isInner) { + String name = (isInner ? innerName : outerName); + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, name, null, "java/lang/Object", null); + + cw.visitInnerClass(innerName, outerName, simpleName, ACC_PUBLIC); + + makeDefaultCtor(cw); + cw.visitEnd(); + return cw.toByteArray(); + } + + byte[] getLocalClasses(boolean isInner) { + String name = (isInner ? innerName : outerName); + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, name, null, "java/lang/Object", null); + + cw.visitInnerClass(innerName, null, simpleName, ACC_PUBLIC | ACC_STATIC); + makeCtxk(cw, isInner); + + makeDefaultCtor(cw); + cw.visitEnd(); + return cw.toByteArray(); + } + + byte[] getAnonymousClasses(boolean isInner) { + String name = (isInner ? innerName : outerName); + ClassWriter cw = new ClassWriter(0); + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, name, null, "java/lang/Object", null); + + cw.visitInnerClass(innerName, null, null, ACC_PUBLIC | ACC_STATIC); + makeCtxk(cw, isInner); + + makeDefaultCtor(cw); + cw.visitEnd(); + return cw.toByteArray(); + } + } +} From c9ac987bf39df41828725da2d571c0d30046ea18 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 14 Apr 2015 18:16:02 +0300 Subject: [PATCH 16/63] 8076461: JSR292: remove unused native and constants Reviewed-by: jrose, vlivanov --- .../java/lang/invoke/MethodHandleNatives.java | 114 +++--------------- 1 file changed, 16 insertions(+), 98 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java index 01c3b33001d..0e32d397c35 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, 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 @@ -55,16 +55,6 @@ class MethodHandleNatives { static native Object staticFieldBase(MemberName self); // e.g., returns clazz static native Object getMemberVMInfo(MemberName self); // returns {vmindex,vmtarget} - /// MethodHandle support - - /** Fetch MH-related JVM parameter. - * which=0 retrieves MethodHandlePushLimit - * which=1 retrieves stack slot push size (in address units) - */ - static native int getConstant(int which); - - static final boolean COUNT_GWT; - /// CallSite support /** Tell the JVM that we need to change the target of a CallSite. */ @@ -74,102 +64,30 @@ class MethodHandleNatives { private static native void registerNatives(); static { registerNatives(); - COUNT_GWT = getConstant(Constants.GC_COUNT_GWT) != 0; // The JVM calls MethodHandleNatives.. Cascade the calls as needed: MethodHandleImpl.initStatics(); } - // All compile-time constants go here. - // There is an opportunity to check them against the JVM's idea of them. + /** + * Compile-time constants go here. This collection exists not only for + * reference from clients, but also for ensuring the VM and JDK agree on the + * values of these constants (see {@link #verifyConstants()}). + */ static class Constants { Constants() { } // static only - // MethodHandleImpl - static final int // for getConstant - GC_COUNT_GWT = 4, - GC_LAMBDA_SUPPORT = 5; - // MemberName - // The JVM uses values of -2 and above for vtable indexes. - // Field values are simple positive offsets. - // Ref: src/share/vm/oops/methodOop.hpp - // This value is negative enough to avoid such numbers, - // but not too negative. static final int - MN_IS_METHOD = 0x00010000, // method (not constructor) - MN_IS_CONSTRUCTOR = 0x00020000, // constructor - MN_IS_FIELD = 0x00040000, // field - MN_IS_TYPE = 0x00080000, // nested type - MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected - MN_REFERENCE_KIND_SHIFT = 24, // refKind - MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, - // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers: - MN_SEARCH_SUPERCLASSES = 0x00100000, - MN_SEARCH_INTERFACES = 0x00200000; - - /** - * Basic types as encoded in the JVM. These code values are not - * intended for use outside this class. They are used as part of - * a private interface between the JVM and this class. - */ - static final int - T_BOOLEAN = 4, - T_CHAR = 5, - T_FLOAT = 6, - T_DOUBLE = 7, - T_BYTE = 8, - T_SHORT = 9, - T_INT = 10, - T_LONG = 11, - T_OBJECT = 12, - //T_ARRAY = 13 - T_VOID = 14, - //T_ADDRESS = 15 - T_ILLEGAL = 99; - - /** - * Constant pool entry types. - */ - static final byte - CONSTANT_Utf8 = 1, - CONSTANT_Integer = 3, - CONSTANT_Float = 4, - CONSTANT_Long = 5, - CONSTANT_Double = 6, - CONSTANT_Class = 7, - CONSTANT_String = 8, - CONSTANT_Fieldref = 9, - CONSTANT_Methodref = 10, - CONSTANT_InterfaceMethodref = 11, - CONSTANT_NameAndType = 12, - CONSTANT_MethodHandle = 15, // JSR 292 - CONSTANT_MethodType = 16, // JSR 292 - CONSTANT_InvokeDynamic = 18, - CONSTANT_LIMIT = 19; // Limit to tags found in classfiles - - /** - * Access modifier flags. - */ - static final char - ACC_PUBLIC = 0x0001, - ACC_PRIVATE = 0x0002, - ACC_PROTECTED = 0x0004, - ACC_STATIC = 0x0008, - ACC_FINAL = 0x0010, - ACC_SYNCHRONIZED = 0x0020, - ACC_VOLATILE = 0x0040, - ACC_TRANSIENT = 0x0080, - ACC_NATIVE = 0x0100, - ACC_INTERFACE = 0x0200, - ACC_ABSTRACT = 0x0400, - ACC_STRICT = 0x0800, - ACC_SYNTHETIC = 0x1000, - ACC_ANNOTATION = 0x2000, - ACC_ENUM = 0x4000, - // aliases: - ACC_SUPER = ACC_SYNCHRONIZED, - ACC_BRIDGE = ACC_VOLATILE, - ACC_VARARGS = ACC_TRANSIENT; + MN_IS_METHOD = 0x00010000, // method (not constructor) + MN_IS_CONSTRUCTOR = 0x00020000, // constructor + MN_IS_FIELD = 0x00040000, // field + MN_IS_TYPE = 0x00080000, // nested type + MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected + MN_REFERENCE_KIND_SHIFT = 24, // refKind + MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, + // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers: + MN_SEARCH_SUPERCLASSES = 0x00100000, + MN_SEARCH_INTERFACES = 0x00200000; /** * Constant pool reference-kind codes, as used by CONSTANT_MethodHandle CP entries. From 2e8fb0e5de97a42885be6a39ddddeb1541140085 Mon Sep 17 00:00:00 2001 From: Michael Haupt Date: Tue, 14 Apr 2015 18:26:01 +0300 Subject: [PATCH 17/63] 8033465: JSR292: InvokerBytecodeGenerator: convert a check for REF_invokeVirtual on an interface into an assert Reviewed-by: vlivanov --- .../classes/java/lang/invoke/InvokerBytecodeGenerator.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index a29eed9417a..1cf7e85f6dc 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -847,11 +847,7 @@ class InvokerBytecodeGenerator { refKind = REF_invokeVirtual; } - if (member.getDeclaringClass().isInterface() && refKind == REF_invokeVirtual) { - // Methods from Object declared in an interface can be resolved by JVM to invokevirtual kind. - // Need to convert it back to invokeinterface to pass verification and make the invocation works as expected. - refKind = REF_invokeInterface; - } + assert(!(member.getDeclaringClass().isInterface() && refKind == REF_invokeVirtual)); // push arguments emitPushArguments(name); From b15381aabaff9998ecc02ed20aab5745ab10a5fb Mon Sep 17 00:00:00 2001 From: Zoltan Majo Date: Wed, 15 Apr 2015 09:37:51 +0200 Subject: [PATCH 18/63] 8067648: JVM crashes reproducible with GCM cipher suites in GCTR doFinal Change restore mechanism in GCTR.java to avoid setting counter to null; added length check to constructor Reviewed-by: jrose, kvn, ascarpino --- .../classes/com/sun/crypto/provider/GCTR.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java index d4cd740af7b..f8a3eaa0a4c 100644 --- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java +++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java @@ -38,7 +38,17 @@ import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE; * under section 6.5. It needs to be constructed w/ an initialized * cipher object, and initial counter block(ICB). Given an input X * of arbitrary length, it processes and returns an output which has - * the same length as X. + * the same length as X. The invariants of this class are: + * + * (1) The length of intialCounterBlk (and also of its clones, e.g., + * fields counter and counterSave) is equal to AES_BLOCK_SIZE. + * + * (2) After construction, the field counter never becomes null, it + * always contains a byte array of length AES_BLOCK_SIZE. + * + * If any invariant is broken, failures can occur because the + * AESCrypt.encryptBlock method can be intrinsified on the HotSpot VM + * (see JDK-8067648 for details). * *

This function is used in the implementation of GCM mode. * @@ -59,6 +69,10 @@ final class GCTR { // NOTE: cipher should already be initialized GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) { this.aes = cipher; + if (initialCounterBlk.length != AES_BLOCK_SIZE) { + throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length + + ") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")"); + } this.icb = initialCounterBlk; this.counter = icb.clone(); } @@ -137,6 +151,8 @@ final class GCTR { * Restores the content of this object to the previous saved one. */ void restore() { - this.counter = this.counterSave; + if (this.counterSave != null) { + this.counter = this.counterSave; + } } } From 1c76dd4fbc4bfc3e8fd9450249d9c508696307d8 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 15 Apr 2015 09:38:45 +0200 Subject: [PATCH 19/63] 8077327: ThreadStackTrace.java throws exception: BlockedThread expected to have BLOCKED but got RUNNABLE Reviewed-by: sspitsyn, dfuchs --- .../management/ThreadMXBean/Semaphore.java | 74 ----------- .../ThreadMXBean/ThreadStackTrace.java | 120 +++++++----------- 2 files changed, 44 insertions(+), 150 deletions(-) delete mode 100644 jdk/test/java/lang/management/ThreadMXBean/Semaphore.java diff --git a/jdk/test/java/lang/management/ThreadMXBean/Semaphore.java b/jdk/test/java/lang/management/ThreadMXBean/Semaphore.java deleted file mode 100644 index c5a6635f286..00000000000 --- a/jdk/test/java/lang/management/ThreadMXBean/Semaphore.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2003, 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. - */ - -/* - * @bug 4530538 - * @summary A semaphore utility class. - * @author Mandy Chung - */ - -public class Semaphore { - private Object go = new Object(); - private int semaCount; - private int waiters = 0; - - public Semaphore() { - semaCount = 0; - } - - public Semaphore(int initialCount) { - semaCount = initialCount; - } - - public void semaP() { - synchronized (go) { - waiters++; - while (semaCount == 0) { - try { - go.wait(); - } catch (InterruptedException e) { - e.printStackTrace(); - throw new InternalError(); - } - } - semaCount--; - waiters--; - } - } - public void semaV() { - synchronized (go) { - semaCount++; - go.notify(); - } - } - - public int getWaiterCount() { - synchronized (go) { - return waiters; - } - } - - public Object getLock() { - return go; - } -} diff --git a/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java b/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java index 12cef4a978b..4842d623c35 100644 --- a/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java +++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -28,25 +28,26 @@ * ThreadInfo.getThreadState() * @author Mandy Chung * - * @run build Semaphore Utils + * @run build Utils * @run main ThreadStackTrace */ import java.lang.management.*; +import java.util.concurrent.Phaser; public class ThreadStackTrace { - private static ThreadMXBean mbean + private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); private static boolean notified = false; - private static Object lockA = new Object(); - private static Object lockB = new Object(); + private static final Object lockA = new Object(); + private static final Object lockB = new Object(); private static volatile boolean testFailed = false; - private static String[] blockedStack = {"run", "test", "A", "B", "C", "D"}; - private static int bsDepth = 6; - private static int methodB = 4; - private static String[] examinerStack = {"run", "examine1", "examine2"}; - private static int esDepth = 3; - private static int methodExamine1= 2; + private static final String[] blockedStack = {"run", "test", "A", "B", "C", "D"}; + private static final int bsDepth = 6; + private static final int methodB = 4; + private static final String[] examinerStack = {"run", "examine1", "examine2"}; + private static final int esDepth = 3; + private static final int methodExamine1= 2; private static void checkNullThreadInfo(Thread t) throws Exception { ThreadInfo ti = mbean.getThreadInfo(t.getId()); @@ -69,8 +70,10 @@ public class ThreadStackTrace { trace = true; } - Examiner examiner = new Examiner("Examiner"); - BlockedThread blocked = new BlockedThread("BlockedThread"); + final Phaser p = new Phaser(2); + + Examiner examiner = new Examiner("Examiner", p); + BlockedThread blocked = new BlockedThread("BlockedThread", p); examiner.setThread(blocked); checkNullThreadInfo(examiner); @@ -79,8 +82,8 @@ public class ThreadStackTrace { // Start the threads and check them in Blocked and Waiting states examiner.start(); - // block until examiner begins doing its real work - examiner.waitForStarted(); + // #1 - block until examiner begins doing its real work + p.arriveAndAwaitAdvance(); System.out.println("Checking stack trace for the examiner thread " + "is waiting to begin."); @@ -145,35 +148,11 @@ public class ThreadStackTrace { } static class BlockedThread extends Thread { - private Semaphore handshake = new Semaphore(); + private final Phaser phaser; - BlockedThread(String name) { + BlockedThread(String name, Phaser phaser) { super(name); - } - boolean hasWaitersForBlocked() { - return (handshake.getWaiterCount() > 0); - } - - void waitUntilBlocked() { - handshake.semaP(); - - // give a chance for the examiner thread to really wait - Utils.goSleep(20); - } - - void waitUntilLockAReleased() { - handshake.semaP(); - - // give a chance for the examiner thread to really wait - Utils.goSleep(50); - } - - private void notifyWaiter() { - // wait until the examiner waits on the semaphore - while (handshake.getWaiterCount() == 0) { - Utils.goSleep(20); - } - handshake.semaV(); + this.phaser = phaser; } private void test() { @@ -185,25 +164,24 @@ public class ThreadStackTrace { private void B() { C(); - // notify the examiner about to block on lockB - notifyWaiter(); + // #4 - notify the examiner about to block on lockB + phaser.arriveAndAwaitAdvance(); - synchronized (lockB) { - }; + synchronized (lockB) {}; } private void C() { D(); } private void D() { - // Notify that examiner about to enter lockA - notifyWaiter(); + // #2 - Notify that examiner about to enter lockA + phaser.arriveAndAwaitAdvance(); synchronized (lockA) { notified = false; while (!notified) { try { - // notify the examiner about to release lockA - notifyWaiter(); + // #3 - notify the examiner about to release lockA + phaser.arriveAndAwaitAdvance(); // Wait and let examiner thread check the mbean lockA.wait(); } catch (InterruptedException e) { @@ -216,6 +194,7 @@ public class ThreadStackTrace { } } + @Override public void run() { test(); } // run() @@ -223,28 +202,17 @@ public class ThreadStackTrace { static class Examiner extends Thread { private static BlockedThread blockedThread; - private Semaphore handshake = new Semaphore(); + private final Phaser phaser; - Examiner(String name) { + Examiner(String name, Phaser phaser) { super(name); + this.phaser = phaser; } public void setThread(BlockedThread thread) { blockedThread = thread; } - public synchronized void waitForStarted() { - // wait until the examiner is about to block - handshake.semaP(); - - // wait until the examiner is waiting for blockedThread's notification - while (!blockedThread.hasWaitersForBlocked()) { - Utils.goSleep(50); - } - // give a chance for the examiner thread to really wait - Utils.goSleep(20); - } - private Thread itself; private void examine1() { synchronized (lockB) { @@ -254,8 +222,9 @@ public class ThreadStackTrace { Utils.checkThreadState(itself, Thread.State.RUNNABLE); checkStack(itself, examinerStack, methodExamine1); - // wait until blockedThread is blocked on lockB - blockedThread.waitUntilBlocked(); + // #4 - wait until blockedThread is blocked on lockB + phaser.arriveAndAwaitAdvance(); + Utils.waitForThreadState(blockedThread, State.BLOCKED); System.out.println("Checking stack trace for " + "BlockedThread - should be blocked on lockB."); @@ -271,15 +240,12 @@ public class ThreadStackTrace { private void examine2() { synchronized (lockA) { - // wait until main thread gets signalled of the semaphore - while (handshake.getWaiterCount() == 0) { - Utils.goSleep(20); - } - - handshake.semaV(); // notify the main thread + // #1 - examiner ready to do the real work + phaser.arriveAndAwaitAdvance(); try { - // Wait until BlockedThread is about to block on lockA - blockedThread.waitUntilBlocked(); + // #2 - Wait until BlockedThread is about to block on lockA + phaser.arriveAndAwaitAdvance(); + Utils.waitForThreadState(blockedThread, State.BLOCKED); System.out.println("Checking examiner's its own stack trace"); Utils.checkThreadState(itself, Thread.State.RUNNABLE); @@ -297,9 +263,10 @@ public class ThreadStackTrace { } } - // release lockA and let BlockedThread to get the lock + // #3 - release lockA and let BlockedThread to get the lock // and wait on lockA - blockedThread.waitUntilLockAReleased(); + phaser.arriveAndAwaitAdvance(); + Utils.waitForThreadState(blockedThread, State.WAITING); synchronized (lockA) { try { @@ -321,6 +288,7 @@ public class ThreadStackTrace { Utils.goSleep(50); } // examine2() + @Override public void run() { itself = Thread.currentThread(); examine1(); From cf90c844ebc6d3324c21708cb65dc45c72e4e8cc Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Wed, 15 Apr 2015 13:27:39 +0200 Subject: [PATCH 20/63] 8077611: com/sun/jdi/ConnectedVMs.java should be unquarantined Reviewed-by: sla --- jdk/test/ProblemList.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 31319caf8e9..9a4bff703d2 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -291,9 +291,6 @@ com/sun/jdi/RedefinePop.sh generic-all # 8068645 com/sun/jdi/CatchPatternTest.sh generic-all -# 8069402 -com/sun/jdi/ConnectedVMs.java generic-all - # 8067354 com/sun/jdi/GetLocalVariables4Test.sh windows-all From b705686a86215bc58771d5d8a112414757b6d068 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Fri, 17 Apr 2015 09:40:02 +0200 Subject: [PATCH 21/63] 8042901: Allow com.sun.management to be in a different module to java.lang.management Reviewed-by: mchung, dfuchs, erikj, jbachorik --- jdk/make/lib/Lib-java.management.gmk | 32 +--- jdk/make/lib/Lib-jdk.management.gmk | 75 ++++++++ jdk/make/mapfiles/libmanagement/mapfile-vers | 33 +--- .../mapfiles/libmanagement_ext/mapfile-vers | 60 ++++++ .../classes/build/tools/module/boot.modules | 1 + .../DefaultPlatformMBeanProvider.java | 37 +--- .../lang/management/ManagementFactory.java | 11 +- .../sun/management/GarbageCollectorImpl.java | 153 +-------------- .../sun/management/LazyCompositeData.java | 10 +- .../management/ManagementFactoryHelper.java | 83 +++----- .../sun/management/MappedMXBeanType.java | 99 ++++++---- .../NotificationEmitterSupport.java | 9 +- .../classes/sun/management/ThreadImpl.java | 58 ++++-- .../share/classes/sun/management/Util.java | 4 +- .../management/spi/PlatformMBeanProvider.java | 4 +- .../libmanagement/GarbageCollectorImpl.c | 14 -- .../libmanagement_ext/UnixOperatingSystem.c} | 8 +- .../libmanagement_ext/UnixOperatingSystem.c} | 8 +- .../sun.management.spi.PlatformMBeanProvider | 0 .../management/DiagnosticCommandMBean.java | 0 .../GarbageCollectionNotificationInfo.java | 7 +- .../management/GarbageCollectorMXBean.java | 0 .../classes/com/sun/management/GcInfo.java | 7 +- .../management/HotSpotDiagnosticMXBean.java | 0 .../sun/management/OperatingSystemMXBean.java | 0 .../com/sun/management/ThreadMXBean.java | 0 .../management/UnixOperatingSystemMXBean.java | 0 .../classes/com/sun/management/VMOption.java | 9 +- .../DiagnosticCommandArgumentInfo.java | 4 +- .../internal}/DiagnosticCommandImpl.java | 41 +++- .../internal}/DiagnosticCommandInfo.java | 4 +- .../com/sun/management/internal}/Flag.java | 4 +- ...rbageCollectionNotifInfoCompositeData.java | 12 +- .../internal/GarbageCollectorExtImpl.java | 181 ++++++++++++++++++ .../management/internal}/GcInfoBuilder.java | 12 +- .../internal}/GcInfoCompositeData.java | 15 +- .../internal}/HotSpotDiagnostic.java | 5 +- .../internal/HotSpotThreadImpl.java | 74 +++++++ .../internal/PlatformMBeanProviderImpl.java | 124 +++++++++--- .../internal}/VMOptionCompositeData.java | 6 +- .../com/sun/management/package-info.java | 0 .../DiagnosticCommandImpl.c | 22 +-- .../share/native/libmanagement_ext}/Flag.c | 24 +-- .../GarbageCollectorExtImpl.c | 41 ++++ .../native/libmanagement_ext}/GcInfoBuilder.c | 14 +- .../libmanagement_ext}/HotSpotDiagnostic.c | 8 +- .../libmanagement_ext/management_ext.c} | 52 ++--- .../native/libmanagement_ext/management_ext.h | 38 ++++ .../libmanagement_ext/UnixOperatingSystem.c} | 8 +- .../internal}/OperatingSystemImpl.java | 6 +- .../libmanagement_ext}/OperatingSystemImpl.c | 24 +-- .../internal}/OperatingSystemImpl.java | 14 +- .../libmanagement_ext}/OperatingSystemImpl.c | 24 +-- .../CheckSomeMXBeanImplPackage.java | 81 ++++++++ .../sun/management/VMOptionOpenDataTest.java | 76 ++++++++ jdk/test/java/lang/instrument/NMTHelper.java | 15 +- .../RedefineMethodInBacktraceApp.java | 12 +- ...PlatformMBeanProviderConstructorCheck.java | 89 +++++++++ 58 files changed, 1207 insertions(+), 545 deletions(-) create mode 100644 jdk/make/lib/Lib-jdk.management.gmk create mode 100644 jdk/make/mapfiles/libmanagement_ext/mapfile-vers rename jdk/src/{java.management/unix/native/libmanagement/LinuxOperatingSystem.c => jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c} (97%) rename jdk/src/{java.management/unix/native/libmanagement/MacosxOperatingSystem.c => jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c} (94%) rename jdk/src/{java.management => jdk.management}/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/DiagnosticCommandMBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java (97%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/GarbageCollectorMXBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/GcInfo.java (98%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/OperatingSystemMXBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/ThreadMXBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/UnixOperatingSystemMXBean.java (100%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/VMOption.java (96%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/DiagnosticCommandArgumentInfo.java (97%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/DiagnosticCommandImpl.java (90%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/DiagnosticCommandInfo.java (97%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/Flag.java (97%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/GarbageCollectionNotifInfoCompositeData.java (96%) create mode 100644 jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/GcInfoBuilder.java (95%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/GcInfoCompositeData.java (97%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/HotSpotDiagnostic.java (97%) create mode 100644 jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotThreadImpl.java rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java (63%) rename jdk/src/{java.management/share/classes/sun/management => jdk.management/share/classes/com/sun/management/internal}/VMOptionCompositeData.java (96%) rename jdk/src/{java.management => jdk.management}/share/classes/com/sun/management/package-info.java (100%) rename jdk/src/{java.management/share/native/libmanagement => jdk.management/share/native/libmanagement_ext}/DiagnosticCommandImpl.c (89%) rename jdk/src/{java.management/share/native/libmanagement => jdk.management/share/native/libmanagement_ext}/Flag.c (91%) create mode 100644 jdk/src/jdk.management/share/native/libmanagement_ext/GarbageCollectorExtImpl.c rename jdk/src/{java.management/share/native/libmanagement => jdk.management/share/native/libmanagement_ext}/GcInfoBuilder.c (94%) rename jdk/src/{java.management/share/native/libmanagement => jdk.management/share/native/libmanagement_ext}/HotSpotDiagnostic.c (86%) rename jdk/src/{java.management/share/classes/sun/management/ManagementFactory.java => jdk.management/share/native/libmanagement_ext/management_ext.c} (53%) create mode 100644 jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.h rename jdk/src/{java.management/unix/native/libmanagement/SolarisOperatingSystem.c => jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c} (95%) rename jdk/src/{java.management/unix/classes/sun/management => jdk.management/unix/classes/com/sun/management/internal}/OperatingSystemImpl.java (94%) rename jdk/src/{java.management/unix/native/libmanagement => jdk.management/unix/native/libmanagement_ext}/OperatingSystemImpl.c (93%) rename jdk/src/{java.management/windows/classes/sun/management => jdk.management/windows/classes/com/sun/management/internal}/OperatingSystemImpl.java (91%) rename jdk/src/{java.management/windows/native/libmanagement => jdk.management/windows/native/libmanagement_ext}/OperatingSystemImpl.c (98%) create mode 100644 jdk/test/com/sun/management/CheckSomeMXBeanImplPackage.java create mode 100644 jdk/test/com/sun/management/VMOptionOpenDataTest.java create mode 100644 jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk index 9f4435d7707..989882ea290 100644 --- a/jdk/make/lib/Lib-java.management.gmk +++ b/jdk/make/lib/Lib-java.management.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, 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 @@ -30,28 +30,14 @@ $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk)) ################################################################################ -BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \ +LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \ $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement -BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \ - $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \ +LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \ + $(addprefix -I,$(LIBMANAGEMENT_SRC)) \ -I$(SUPPORT_OUTPUTDIR)/headers/java.management \ $(LIBJAVA_HEADER_FLAGS) \ # -BUILD_LIBMANAGEMENT_EXCLUDES := - -ifneq ($(OPENJDK_TARGET_OS), solaris) - BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c -endif - -ifneq ($(OPENJDK_TARGET_OS), linux) - BUILD_LIBMANAGEMENT_EXCLUDES += LinuxOperatingSystem.c -endif - -ifneq ($(OPENJDK_TARGET_OS), macosx) - BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c -endif - LIBMANAGEMENT_OPTIMIZATION := HIGH ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), ) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) @@ -59,18 +45,14 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), ) endif endif -# Make it possible to override this variable -LIBMANAGEMENT_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers - $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \ LIBRARY := management, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(BUILD_LIBMANAGEMENT_SRC), \ - EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \ + SRC := $(LIBMANAGEMENT_SRC), \ LANG := C, \ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \ - MAPFILE := $(LIBMANAGEMENT_MAPFILE), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_CFLAGS), \ + MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_solaris := -lkstat, \ diff --git a/jdk/make/lib/Lib-jdk.management.gmk b/jdk/make/lib/Lib-jdk.management.gmk new file mode 100644 index 00000000000..819bef81252 --- /dev/null +++ b/jdk/make/lib/Lib-jdk.management.gmk @@ -0,0 +1,75 @@ +# +# Copyright (c) 2015, 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# + +include LibCommon.gmk + +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, lib/Lib-jdk.management.gmk)) + +################################################################################ + +LIBMANAGEMENT_EXT_SRC += $(JDK_TOPDIR)/src/jdk.management/share/native/libmanagement_ext \ + $(JDK_TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_ext \ + $(JDK_TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS)/native/libmanagement_ext +LIBMANAGEMENT_EXT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \ + $(addprefix -I,$(LIBMANAGEMENT_EXT_SRC)) \ + -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management \ + $(LIBJAVA_HEADER_FLAGS) \ + # + +LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH +ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), ) + ifeq ($(ENABLE_DEBUG_SYMBOLS), true) + LIBMANAGEMENT_EXT_OPTIMIZATION := LOW + endif +endif + +$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT_EXT, \ + LIBRARY := management_ext, \ + OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ + SRC := $(LIBMANAGEMENT_EXT_SRC), \ + LANG := C, \ + OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_EXT_CFLAGS), \ + MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement_ext/mapfile-vers, \ + LDFLAGS := $(LDFLAGS_JDKLIB) \ + $(call SET_SHARED_LIBRARY_ORIGIN), \ + LDFLAGS_solaris := -lkstat, \ + LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \ + LDFLAGS_SUFFIX_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \ + LDFLAGS_SUFFIX_aix := -lperfstat,\ + VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ + RC_FLAGS := $(RC_FLAGS) \ + -D "JDK_FNAME=management_ext.dll" \ + -D "JDK_INTERNAL_NAME=management_ext" \ + -D "JDK_FTYPE=0x2L", \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \ + DEBUG_SYMBOLS := true)) + +$(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java) + +TARGETS += $(BUILD_LIBMANAGEMENT_EXT) + +################################################################################ diff --git a/jdk/make/mapfiles/libmanagement/mapfile-vers b/jdk/make/mapfiles/libmanagement/mapfile-vers index a4cb163806a..228ef93abb6 100644 --- a/jdk/make/mapfiles/libmanagement/mapfile-vers +++ b/jdk/make/mapfiles/libmanagement/mapfile-vers @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2015, 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 @@ -27,37 +27,10 @@ SUNWprivate_1.1 { global: - Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0; - Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0; - Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0; - Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0; - Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0; - Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0; - Java_sun_management_OperatingSystemImpl_getProcessCpuTime0; - Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0; - Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0; - Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0; - Java_sun_management_OperatingSystemImpl_initialize0; Java_sun_management_ClassLoadingImpl_setVerboseClass; - Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand; - Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommands; - Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo; - Java_sun_management_DiagnosticCommandImpl_setNotificationEnabled; - Java_sun_management_FileSystemImpl_isAccessUserOnly0; - Java_sun_management_Flag_getAllFlagNames; - Java_sun_management_Flag_getFlags; - Java_sun_management_Flag_getInternalFlagCount; - Java_sun_management_Flag_initialize; - Java_sun_management_Flag_setLongValue; - Java_sun_management_Flag_setBooleanValue; - Java_sun_management_Flag_setStringValue; - Java_sun_management_GarbageCollectorImpl_getCollectionCount; + Java_sun_management_FileSystemImpl_isAccessUserOnly0; + Java_sun_management_GarbageCollectorImpl_getCollectionCount; Java_sun_management_GarbageCollectorImpl_getCollectionTime; - Java_sun_management_GarbageCollectorImpl_setNotificationEnabled; - Java_sun_management_GcInfoBuilder_fillGcAttributeInfo; - Java_sun_management_GcInfoBuilder_getLastGcInfo0; - Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; - Java_sun_management_HotSpotDiagnostic_dumpHeap0; Java_sun_management_HotspotThread_getInternalThreadCount; Java_sun_management_HotspotThread_getInternalThreadTimes0; Java_sun_management_MemoryImpl_getMemoryManagers0; diff --git a/jdk/make/mapfiles/libmanagement_ext/mapfile-vers b/jdk/make/mapfiles/libmanagement_ext/mapfile-vers new file mode 100644 index 00000000000..b8397bf9c1b --- /dev/null +++ b/jdk/make/mapfiles/libmanagement_ext/mapfile-vers @@ -0,0 +1,60 @@ +# +# Copyright (c) 2015, 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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. +# + +# Define library interface. + +SUNWprivate_1.1 { + global: + Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0; + Java_com_sun_management_internal_OperatingSystemImpl_getFreePhysicalMemorySize0; + Java_com_sun_management_internal_OperatingSystemImpl_getFreeSwapSpaceSize0; + Java_com_sun_management_internal_OperatingSystemImpl_getMaxFileDescriptorCount0; + Java_com_sun_management_internal_OperatingSystemImpl_getOpenFileDescriptorCount0; + Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0; + Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuTime0; + Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0; + Java_com_sun_management_internal_OperatingSystemImpl_getTotalPhysicalMemorySize0; + Java_com_sun_management_internal_OperatingSystemImpl_getTotalSwapSpaceSize0; + Java_com_sun_management_internal_OperatingSystemImpl_initialize0; + Java_com_sun_management_internal_DiagnosticCommandImpl_executeDiagnosticCommand; + Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommands; + Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommandInfo; + Java_com_sun_management_internal_DiagnosticCommandImpl_setNotificationEnabled; + Java_com_sun_management_internal_Flag_getAllFlagNames; + Java_com_sun_management_internal_Flag_getFlags; + Java_com_sun_management_internal_Flag_getInternalFlagCount; + Java_com_sun_management_internal_Flag_initialize; + Java_com_sun_management_internal_Flag_setLongValue; + Java_com_sun_management_internal_Flag_setBooleanValue; + Java_com_sun_management_internal_Flag_setStringValue; + Java_com_sun_management_internal_GarbageCollectorExtImpl_setNotificationEnabled; + Java_com_sun_management_internal_GcInfoBuilder_fillGcAttributeInfo; + Java_com_sun_management_internal_GcInfoBuilder_getLastGcInfo0; + Java_com_sun_management_internal_GcInfoBuilder_getNumGcExtAttributes; + Java_com_sun_management_internal_HotSpotDiagnostic_dumpHeap0; + JNI_OnLoad; + local: + *; +}; diff --git a/jdk/make/src/classes/build/tools/module/boot.modules b/jdk/make/src/classes/build/tools/module/boot.modules index 2c32d09526f..eb0ac74d739 100644 --- a/jdk/make/src/classes/build/tools/module/boot.modules +++ b/jdk/make/src/classes/build/tools/module/boot.modules @@ -22,6 +22,7 @@ jdk.deploy.osx jdk.hprof.agent jdk.httpserver jdk.jfr +jdk.management jdk.management.cmm jdk.naming.rmi jdk.sctp diff --git a/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java b/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java index 128b0ba8afd..f265f4c44fe 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java +++ b/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java @@ -33,7 +33,6 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.management.DynamicMBean; import javax.management.ObjectName; import sun.management.ManagementFactoryHelper; import sun.management.spi.PlatformMBeanProvider; @@ -162,8 +161,7 @@ class DefaultPlatformMBeanProvider extends PlatformMBeanProvider { @Override public Set> mbeanInterfaces() { return Stream.of(MemoryManagerMXBean.class, - GarbageCollectorMXBean.class, - com.sun.management.GarbageCollectorMXBean.class).collect(Collectors.toSet()); + GarbageCollectorMXBean.class).collect(Collectors.toSet()); } @Override @@ -464,39 +462,6 @@ class DefaultPlatformMBeanProvider extends PlatformMBeanProvider { }); - /** - * DynamicMBean - */ - HashMap dynmbeans - = ManagementFactoryHelper.getPlatformDynamicMBeans(); - final Set dynamicMBeanInterfaceNames = - Collections.unmodifiableSet(Collections.singleton("javax.management.DynamicMBean")); - for (Map.Entry e : dynmbeans.entrySet()) { - initMBeanList.add(new PlatformComponent() { - @Override - public Set> mbeanInterfaces() { - return Collections.emptySet(); - } - - @Override - public Set mbeanInterfaceNames() { - return dynamicMBeanInterfaceNames; - } - - @Override - public String getObjectNamePattern() { - return e.getKey().getCanonicalName(); - } - - @Override - public Map nameToMBeanMap() { - return Collections.singletonMap( - e.getKey().getCanonicalName(), - e.getValue()); - } - }); - } - initMBeanList.trimToSize(); return initMBeanList; } diff --git a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java index 9a0e1ebbd61..82508822954 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java @@ -582,7 +582,7 @@ public class ManagementFactory { final Class cls = mxbeanInterface; ClassLoader loader = AccessController.doPrivileged( - (PrivilegedAction) () -> cls.getClassLoader()); + (PrivilegedAction) () -> cls.getClassLoader()); if (!sun.misc.VM.isSystemDomainLoader(loader)) { throw new IllegalArgumentException(mxbeanName + " is not a platform MXBean"); @@ -883,7 +883,7 @@ public class ManagementFactory { all.add(new DefaultPlatformMBeanProvider()); return all; }, null, new FilePermission("<>", "read"), - new RuntimePermission("sun.management.spi.PlatformMBeanProvider")); + new RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")); // load all platform components into a map componentMap = providers.stream() @@ -970,4 +970,11 @@ public class ManagementFactory { return singleton; } } + + static { + AccessController.doPrivileged((PrivilegedAction) () -> { + System.loadLibrary("management"); + return null; + }); + } } diff --git a/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java b/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java index 251dad43e04..9c1373f854e 100644 --- a/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java +++ b/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -25,168 +25,31 @@ package sun.management; -import com.sun.management.GarbageCollectorMXBean; -import com.sun.management.GarbageCollectionNotificationInfo; +import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; -import java.lang.management.MemoryPoolMXBean; -import java.lang.management.MemoryUsage; - -import com.sun.management.GcInfo; -import javax.management.openmbean.CompositeData; -import javax.management.MBeanInfo; -import javax.management.MBeanAttributeInfo; import javax.management.ObjectName; -import javax.management.MBeanNotificationInfo; -import javax.management.Notification; -import javax.management.NotificationFilter; -import javax.management.NotificationListener; -import javax.management.ListenerNotFoundException; - -import java.util.List; -import java.util.ListIterator; -import java.util.Map; /** * Implementation class for the garbage collector. - * Standard and committed hotspot-specific metrics if any. * * ManagementFactory.getGarbageCollectorMXBeans() returns a list * of instances of this class. */ -class GarbageCollectorImpl extends MemoryManagerImpl +public class GarbageCollectorImpl extends MemoryManagerImpl implements GarbageCollectorMXBean { - GarbageCollectorImpl(String name) { + protected GarbageCollectorImpl(String name) { super(name); } + @Override public native long getCollectionCount(); + + @Override public native long getCollectionTime(); - - // The memory pools are static and won't be changed. - // TODO: If the hotspot implementation begins to have pools - // dynamically created and removed, this needs to be modified. - private String[] poolNames = null; - synchronized String[] getAllPoolNames() { - if (poolNames == null) { - List pools = ManagementFactory.getMemoryPoolMXBeans(); - poolNames = new String[pools.size()]; - int i = 0; - for (MemoryPoolMXBean m : pools) { - poolNames[i++] = m.getName(); - } - } - return poolNames; - } - - // Sun JDK extension - private GcInfoBuilder gcInfoBuilder; - - private synchronized GcInfoBuilder getGcInfoBuilder() { - if(gcInfoBuilder == null) { - gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames()); - } - return gcInfoBuilder; - } - - public GcInfo getLastGcInfo() { - GcInfo info = getGcInfoBuilder().getLastGcInfo(); - return info; - } - - private final static String notifName = - "javax.management.Notification"; - - private final static String[] gcNotifTypes = { - GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION - }; - - private MBeanNotificationInfo[] notifInfo = null; - public MBeanNotificationInfo[] getNotificationInfo() { - synchronized (this) { - if (notifInfo == null) { - notifInfo = new MBeanNotificationInfo[1]; - notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes, - notifName, - "GC Notification"); - } - } - return notifInfo; - } - - private static long seqNumber = 0; - private static long getNextSeqNumber() { - return ++seqNumber; - } - - void createGCNotification(long timestamp, - String gcName, - String gcAction, - String gcCause, - GcInfo gcInfo) { - - if (!hasListeners()) { - return; - } - - Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION, - getObjectName(), - getNextSeqNumber(), - timestamp, - gcName); - GarbageCollectionNotificationInfo info = - new GarbageCollectionNotificationInfo(gcName, - gcAction, - gcCause, - gcInfo); - - CompositeData cd = - GarbageCollectionNotifInfoCompositeData.toCompositeData(info); - notif.setUserData(cd); - sendNotification(notif); - } - - public synchronized void addNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object handback) - { - boolean before = hasListeners(); - super.addNotificationListener(listener, filter, handback); - boolean after = hasListeners(); - if (!before && after) { - setNotificationEnabled(this, true); - } - } - - public synchronized void removeNotificationListener(NotificationListener listener) - throws ListenerNotFoundException { - boolean before = hasListeners(); - super.removeNotificationListener(listener); - boolean after = hasListeners(); - if (before && !after) { - setNotificationEnabled(this,false); - } - } - - public synchronized void removeNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object handback) - throws ListenerNotFoundException - { - boolean before = hasListeners(); - super.removeNotificationListener(listener,filter,handback); - boolean after = hasListeners(); - if (before && !after) { - setNotificationEnabled(this,false); - } - } - + @Override public ObjectName getObjectName() { return Util.newObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE, getName()); } - - native void setNotificationEnabled(GarbageCollectorMXBean gc, - boolean enabled); - } diff --git a/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java b/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java index 935f09a156b..8d9c4c03b5f 100644 --- a/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java +++ b/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -115,28 +115,28 @@ public abstract class LazyCompositeData protected abstract CompositeData getCompositeData(); // Helper methods - static String getString(CompositeData cd, String itemName) { + public static String getString(CompositeData cd, String itemName) { if (cd == null) throw new IllegalArgumentException("Null CompositeData"); return (String) cd.get(itemName); } - static boolean getBoolean(CompositeData cd, String itemName) { + public static boolean getBoolean(CompositeData cd, String itemName) { if (cd == null) throw new IllegalArgumentException("Null CompositeData"); return ((Boolean) cd.get(itemName)).booleanValue(); } - static long getLong(CompositeData cd, String itemName) { + public static long getLong(CompositeData cd, String itemName) { if (cd == null) throw new IllegalArgumentException("Null CompositeData"); return ((Long) cd.get(itemName)).longValue(); } - static int getInt(CompositeData cd, String itemName) { + public static int getInt(CompositeData cd, String itemName) { if (cd == null) throw new IllegalArgumentException("Null CompositeData"); diff --git a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java index c06fb71b27d..a8d4279d862 100644 --- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java +++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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,8 +26,6 @@ package sun.management; import java.lang.management.*; - -import javax.management.DynamicMBean; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; @@ -38,30 +36,35 @@ import javax.management.RuntimeOperationsException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; - import sun.util.logging.LoggingSupport; - import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import com.sun.management.DiagnosticCommandMBean; -import com.sun.management.HotSpotDiagnosticMXBean; /** * ManagementFactoryHelper provides static factory methods to create * instances of the management interface. */ public class ManagementFactoryHelper { + static { + // make sure that the management lib is loaded within + // java.lang.management.ManagementFactory + sun.misc.Unsafe.getUnsafe().ensureClassInitialized(ManagementFactory.class); + } + + private static final VMManagement jvm = new VMManagementImpl(); + private ManagementFactoryHelper() {}; - private static VMManagement jvm; + public static VMManagement getVMManagement() { + return jvm; + } private static ClassLoadingImpl classMBean = null; private static MemoryImpl memoryMBean = null; private static ThreadImpl threadMBean = null; private static RuntimeImpl runtimeMBean = null; private static CompilationImpl compileMBean = null; - private static OperatingSystemImpl osMBean = null; + private static BaseOperatingSystemImpl osMBean = null; public static synchronized ClassLoadingMXBean getClassLoadingMXBean() { if (classMBean == null) { @@ -100,7 +103,7 @@ public class ManagementFactoryHelper { public static synchronized OperatingSystemMXBean getOperatingSystemMXBean() { if (osMBean == null) { - osMBean = new OperatingSystemImpl(jvm); + osMBean = new BaseOperatingSystemImpl(jvm); } return osMBean; } @@ -123,7 +126,7 @@ public class ManagementFactoryHelper { return result; } - public static List getGarbageCollectorMXBeans() { + public static List getGarbageCollectorMXBeans() { MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers(); List result = new ArrayList<>(mgrs.length); for (MemoryManagerMXBean m : mgrs) { @@ -257,20 +260,11 @@ public class ManagementFactoryHelper { }; } - private static HotSpotDiagnostic hsDiagMBean = null; private static HotspotRuntime hsRuntimeMBean = null; private static HotspotClassLoading hsClassMBean = null; private static HotspotThread hsThreadMBean = null; private static HotspotCompilation hsCompileMBean = null; private static HotspotMemory hsMemoryMBean = null; - private static DiagnosticCommandImpl hsDiagCommandMBean = null; - - public static synchronized HotSpotDiagnosticMXBean getDiagnosticMXBean() { - if (hsDiagMBean == null) { - hsDiagMBean = new HotSpotDiagnostic(); - } - return hsDiagMBean; - } /** * This method is for testing only. @@ -312,14 +306,6 @@ public class ManagementFactoryHelper { return hsMemoryMBean; } - public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { - // Remote Diagnostic Commands may not be supported - if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { - hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); - } - return hsDiagCommandMBean; - } - /** * This method is for testing only. */ @@ -374,18 +360,6 @@ public class ManagementFactoryHelper { private final static String HOTSPOT_THREAD_MBEAN_NAME = "sun.management:type=HotspotThreading"; - final static String HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME = - "com.sun.management:type=DiagnosticCommand"; - - public static HashMap getPlatformDynamicMBeans() { - HashMap map = new HashMap<>(); - DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); - if (diagMBean != null) { - map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); - } - return map; - } - static void registerInternalMBeans(MBeanServer mbs) { // register all internal MBeans if not registered // No exception is thrown if a MBean with that object name @@ -441,17 +415,6 @@ public class ManagementFactoryHelper { } } - static { - AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Void run() { - System.loadLibrary("management"); - return null; - } - }); - jvm = new VMManagementImpl(); - } - public static boolean isThreadSuspended(int state) { return ((state & JMM_THREAD_STATE_FLAG_SUSPENDED) != 0); } @@ -471,4 +434,20 @@ public class ManagementFactoryHelper { private static final int JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000; private static final int JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000; + // Invoked by the VM + private static MemoryPoolMXBean createMemoryPool + (String name, boolean isHeap, long uThreshold, long gcThreshold) { + return new MemoryPoolImpl(name, isHeap, uThreshold, gcThreshold); + } + + private static MemoryManagerMXBean createMemoryManager(String name) { + return new MemoryManagerImpl(name); + } + + private static GarbageCollectorMXBean + createGarbageCollector(String name, String type) { + + // ignore type parameter which is for future extension + return new GarbageCollectorImpl(name); + } } diff --git a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java index 04ab87153f8..85cdfdf1833 100644 --- a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java +++ b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -38,10 +38,8 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import javax.management.*; import javax.management.openmbean.*; import static javax.management.openmbean.SimpleType.*; -import com.sun.management.VMOption; /** * A mapped mxbean type maps a Java type to an open type. @@ -113,7 +111,7 @@ public abstract class MappedMXBeanType { return mt; } - static synchronized MappedMXBeanType getMappedType(Type t) + public static synchronized MappedMXBeanType getMappedType(Type t) throws OpenDataException { MappedMXBeanType mt = convertedTypes.get(t); if (mt == null) { @@ -152,7 +150,7 @@ public abstract class MappedMXBeanType { } // Return the mapped open type - OpenType getOpenType() { + public OpenType getOpenType() { return openType; } @@ -177,10 +175,10 @@ public abstract class MappedMXBeanType { // return name of the class or the generic type abstract String getName(); - abstract Object toOpenTypeData(Object javaTypeData) + public abstract Object toOpenTypeData(Object javaTypeData) throws OpenDataException; - abstract Object toJavaTypeData(Object openTypeData) + public abstract Object toJavaTypeData(Object openTypeData) throws OpenDataException, InvalidObjectException; // Basic Types - Classes that do not require data conversion @@ -208,11 +206,11 @@ public abstract class MappedMXBeanType { return basicType.getName(); } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { return data; } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { return data; @@ -243,11 +241,11 @@ public abstract class MappedMXBeanType { return enumClass.getName(); } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { return ((Enum) data).name(); } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { try { @@ -315,7 +313,7 @@ public abstract class MappedMXBeanType { return arrayClass.getName(); } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { // If the base element type is a basic type // return the data as no conversion is needed. // Primitive types are not converted to wrappers. @@ -340,7 +338,7 @@ public abstract class MappedMXBeanType { } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { // If the base element type is a basic type @@ -457,7 +455,7 @@ public abstract class MappedMXBeanType { return typeName; } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { final List list = (List) data; final Object[] openArray = (Object[]) @@ -470,7 +468,7 @@ public abstract class MappedMXBeanType { return openArray; } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { final Object[] openArray = (Object[]) data; @@ -538,7 +536,7 @@ public abstract class MappedMXBeanType { return typeName; } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { final Map map = (Map) data; final TabularType tabularType = (TabularType) openType; final TabularData table = new TabularDataSupport(tabularType); @@ -556,7 +554,7 @@ public abstract class MappedMXBeanType { return table; } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { final TabularData td = (TabularData) data; @@ -605,8 +603,9 @@ public abstract class MappedMXBeanType { // static class CompositeDataMXBeanType extends MappedMXBeanType { final Class javaClass; - final boolean isCompositeData; + boolean isCompositeData = false; Method fromMethod = null; + Method toMethod = null; CompositeDataMXBeanType(Class c) throws OpenDataException { this.javaClass = c; @@ -624,6 +623,26 @@ public abstract class MappedMXBeanType { // that has no from method to be embeded in another class. } + // check if a static "toCompositeData" method exists + try { + toMethod = AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Method run() throws NoSuchMethodException { + Method m = javaClass.getDeclaredMethod("toCompositeData", javaClass); + if (m != null + && CompositeData.class.isAssignableFrom(m.getReturnType()) + && Modifier.isStatic(m.getModifiers())) { + m.setAccessible(true); + return m; + } else { + return null; + } + } + }); + } catch (PrivilegedActionException e) { + // ignore NoSuchMethodException since we allow classes + // that has no from method to be embeded in another class. + } + if (COMPOSITE_DATA_CLASS.isAssignableFrom(c)) { // c implements CompositeData - set openType to null // defer generating the CompositeType @@ -636,16 +655,16 @@ public abstract class MappedMXBeanType { // Make a CompositeData containing all the getters final Method[] methods = AccessController.doPrivileged(new PrivilegedAction() { - public Method[] run() { - return javaClass.getMethods(); - } - }); + public Method[] run() { + return javaClass.getMethods(); + } + }); final List names = new ArrayList<>(); final List> types = new ArrayList<>(); /* Select public methods that look like "T getX()" or "boolean - isX()", where T is not void and X is not the empty - string. Exclude "Class getClass()" inherited from Object. */ + isX()", where T is not void and X is not the empty + string. Exclude "Class getClass()" inherited from Object. */ for (int i = 0; i < methods.length; i++) { final Method method = methods[i]; final String name = method.getName(); @@ -676,10 +695,10 @@ public abstract class MappedMXBeanType { final String[] nameArray = names.toArray(new String[0]); openType = new CompositeType(c.getName(), - c.getName(), - nameArray, // field names - nameArray, // field descriptions - types.toArray(new OpenType[0])); + c.getName(), + nameArray, // field names + nameArray, // field descriptions + types.toArray(new OpenType[0])); } } @@ -691,7 +710,23 @@ public abstract class MappedMXBeanType { return javaClass.getName(); } - Object toOpenTypeData(Object data) throws OpenDataException { + public Object toOpenTypeData(Object data) throws OpenDataException { + if (toMethod != null) { + try { + return toMethod.invoke(null, data); + } catch (IllegalAccessException e) { + // should never reach here + throw new AssertionError(e); + } catch (InvocationTargetException e) { + final OpenDataException ode + = new OpenDataException("Failed to invoke " + + toMethod.getName() + " to convert " + javaClass.getName() + + " to CompositeData"); + ode.initCause(e); + throw ode; + } + } + if (data instanceof MemoryUsage) { return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data); } @@ -712,10 +747,6 @@ public abstract class MappedMXBeanType { toCompositeData((MemoryNotificationInfo) data); } - if (data instanceof VMOption) { - return VMOptionCompositeData.toCompositeData((VMOption) data); - } - if (isCompositeData) { // Classes that implement CompositeData // @@ -732,7 +763,7 @@ public abstract class MappedMXBeanType { " is not supported for platform MXBeans"); } - Object toJavaTypeData(Object data) + public Object toJavaTypeData(Object data) throws OpenDataException, InvalidObjectException { if (fromMethod == null) { diff --git a/jdk/src/java.management/share/classes/sun/management/NotificationEmitterSupport.java b/jdk/src/java.management/share/classes/sun/management/NotificationEmitterSupport.java index cff7ac39217..a78b3453b0d 100644 --- a/jdk/src/java.management/share/classes/sun/management/NotificationEmitterSupport.java +++ b/jdk/src/java.management/share/classes/sun/management/NotificationEmitterSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -34,13 +34,12 @@ import javax.management.NotificationListener; import java.util.List; import java.util.ArrayList; -import java.util.ListIterator; import java.util.Collections; /** * Abstract helper class for notification emitter support. */ -abstract class NotificationEmitterSupport implements NotificationEmitter { +public abstract class NotificationEmitterSupport implements NotificationEmitter { protected NotificationEmitterSupport() { } @@ -135,7 +134,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter { } } - void sendNotification(Notification notification) { + public void sendNotification(Notification notification) { if (notification == null) { return; @@ -162,7 +161,7 @@ abstract class NotificationEmitterSupport implements NotificationEmitter { } } - boolean hasListeners() { + public boolean hasListeners() { synchronized (listenerLock) { return !listenerList.isEmpty(); } diff --git a/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java b/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java index 9ac9868af22..129ecfcc5da 100644 --- a/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java +++ b/jdk/src/java.management/share/classes/sun/management/ThreadImpl.java @@ -26,20 +26,18 @@ package sun.management; import java.lang.management.ManagementFactory; - import java.lang.management.ThreadInfo; - +import java.lang.management.ThreadMXBean; import javax.management.ObjectName; /** - * Implementation class for the thread subsystem. - * Standard and committed hotspot-specific metrics if any. - * - * ManagementFactory.getThreadMXBean() returns an instance - * of this class. + * Implementation for java.lang.management.ThreadMXBean as well as providing the + * supporting method for com.sun.management.ThreadMXBean. + * The supporting method for com.sun.management.ThreadMXBean can be moved to + * jdk.management in the future. */ -class ThreadImpl implements com.sun.management.ThreadMXBean { +public class ThreadImpl implements ThreadMXBean { private final VMManagement jvm; // default for thread contention monitoring is disabled. @@ -50,32 +48,38 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { /** * Constructor of ThreadImpl class. */ - ThreadImpl(VMManagement vm) { + protected ThreadImpl(VMManagement vm) { this.jvm = vm; this.cpuTimeEnabled = jvm.isThreadCpuTimeEnabled(); this.allocatedMemoryEnabled = jvm.isThreadAllocatedMemoryEnabled(); } + @Override public int getThreadCount() { return jvm.getLiveThreadCount(); } + @Override public int getPeakThreadCount() { return jvm.getPeakThreadCount(); } + @Override public long getTotalStartedThreadCount() { return jvm.getTotalThreadCount(); } + @Override public int getDaemonThreadCount() { return jvm.getDaemonThreadCount(); } + @Override public boolean isThreadContentionMonitoringSupported() { return jvm.isThreadContentionMonitoringSupported(); } + @Override public synchronized boolean isThreadContentionMonitoringEnabled() { if (!isThreadContentionMonitoringSupported()) { throw new UnsupportedOperationException( @@ -84,18 +88,21 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return contentionMonitoringEnabled; } + @Override public boolean isThreadCpuTimeSupported() { return jvm.isOtherThreadCpuTimeSupported(); } + @Override public boolean isCurrentThreadCpuTimeSupported() { return jvm.isCurrentThreadCpuTimeSupported(); } - public boolean isThreadAllocatedMemorySupported() { + protected boolean isThreadAllocatedMemorySupported() { return jvm.isThreadAllocatedMemorySupported(); } + @Override public boolean isThreadCpuTimeEnabled() { if (!isThreadCpuTimeSupported() && !isCurrentThreadCpuTimeSupported()) { @@ -105,7 +112,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return cpuTimeEnabled; } - public boolean isThreadAllocatedMemoryEnabled() { + protected boolean isThreadAllocatedMemoryEnabled() { if (!isThreadAllocatedMemorySupported()) { throw new UnsupportedOperationException( "Thread allocated memory measurement is not supported"); @@ -113,6 +120,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return allocatedMemoryEnabled; } + @Override public long[] getAllThreadIds() { Util.checkMonitorAccess(); @@ -126,6 +134,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return ids; } + @Override public ThreadInfo getThreadInfo(long id) { long[] ids = new long[1]; ids[0] = id; @@ -133,6 +142,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return infos[0]; } + @Override public ThreadInfo getThreadInfo(long id, int maxDepth) { long[] ids = new long[1]; ids[0] = id; @@ -140,6 +150,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return infos[0]; } + @Override public ThreadInfo[] getThreadInfo(long[] ids) { return getThreadInfo(ids, 0); } @@ -157,6 +168,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { } } + @Override public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) { verifyThreadIds(ids); @@ -180,6 +192,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return infos; } + @Override public void setThreadContentionMonitoringEnabled(boolean enable) { if (!isThreadContentionMonitoringSupported()) { throw new UnsupportedOperationException( @@ -213,6 +226,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return isThreadCpuTimeEnabled(); } + @Override public long getCurrentThreadCpuTime() { if (verifyCurrentThreadCpuTime()) { return getThreadTotalCpuTime0(0); @@ -220,6 +234,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return -1; } + @Override public long getThreadCpuTime(long id) { long[] ids = new long[1]; ids[0] = id; @@ -251,7 +266,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return isThreadCpuTimeEnabled(); } - public long[] getThreadCpuTime(long[] ids) { + protected long[] getThreadCpuTime(long[] ids) { boolean verified = verifyThreadCpuTime(ids); int length = ids.length; @@ -272,6 +287,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return times; } + @Override public long getCurrentThreadUserTime() { if (verifyCurrentThreadCpuTime()) { return getThreadUserCpuTime0(0); @@ -279,6 +295,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return -1; } + @Override public long getThreadUserTime(long id) { long[] ids = new long[1]; ids[0] = id; @@ -286,7 +303,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return times[0]; } - public long[] getThreadUserTime(long[] ids) { + protected long[] getThreadUserTime(long[] ids) { boolean verified = verifyThreadCpuTime(ids); int length = ids.length; @@ -307,6 +324,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return times; } + @Override public void setThreadCpuTimeEnabled(boolean enable) { if (!isThreadCpuTimeSupported() && !isCurrentThreadCpuTimeSupported()) { @@ -324,7 +342,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { } } - public long getThreadAllocatedBytes(long id) { + protected long getThreadAllocatedBytes(long id) { long[] ids = new long[1]; ids[0] = id; final long[] sizes = getThreadAllocatedBytes(ids); @@ -343,7 +361,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return isThreadAllocatedMemoryEnabled(); } - public long[] getThreadAllocatedBytes(long[] ids) { + protected long[] getThreadAllocatedBytes(long[] ids) { boolean verified = verifyThreadAllocatedMemory(ids); long[] sizes = new long[ids.length]; @@ -355,7 +373,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return sizes; } - public void setThreadAllocatedMemoryEnabled(boolean enable) { + protected void setThreadAllocatedMemoryEnabled(boolean enable) { if (!isThreadAllocatedMemorySupported()) { throw new UnsupportedOperationException( "Thread allocated memory measurement is not supported."); @@ -371,6 +389,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { } } + @Override public long[] findMonitorDeadlockedThreads() { Util.checkMonitorAccess(); @@ -387,6 +406,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return ids; } + @Override public long[] findDeadlockedThreads() { if (!isSynchronizerUsageSupported()) { throw new UnsupportedOperationException( @@ -408,15 +428,18 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return ids; } + @Override public void resetPeakThreadCount() { Util.checkControlAccess(); resetPeakThreadCount0(); } + @Override public boolean isObjectMonitorUsageSupported() { return jvm.isObjectMonitorUsageSupported(); } + @Override public boolean isSynchronizerUsageSupported() { return jvm.isSynchronizerUsageSupported(); } @@ -436,6 +459,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { Util.checkMonitorAccess(); } + @Override public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers) { @@ -448,6 +472,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { return dumpThreads0(ids, lockedMonitors, lockedSynchronizers); } + @Override public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) { verifyDumpThreads(lockedMonitors, lockedSynchronizers); @@ -477,6 +502,7 @@ class ThreadImpl implements com.sun.management.ThreadMXBean { // tid == 0 to reset contention times for all threads private static native void resetContentionTimes0(long tid); + @Override public ObjectName getObjectName() { return Util.newObjectName(ManagementFactory.THREAD_MXBEAN_NAME); } diff --git a/jdk/src/java.management/share/classes/sun/management/Util.java b/jdk/src/java.management/share/classes/sun/management/Util.java index 6350408735e..145749e40f2 100644 --- a/jdk/src/java.management/share/classes/sun/management/Util.java +++ b/jdk/src/java.management/share/classes/sun/management/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -81,7 +81,7 @@ public class Util { static void checkMonitorAccess() throws SecurityException { checkAccess(monitorPermission); } - static void checkControlAccess() throws SecurityException { + public static void checkControlAccess() throws SecurityException { checkAccess(controlPermission); } } diff --git a/jdk/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java b/jdk/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java index 6f224c95e68..0ce516511bb 100644 --- a/jdk/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java +++ b/jdk/src/java.management/share/classes/sun/management/spi/PlatformMBeanProvider.java @@ -205,7 +205,7 @@ public abstract class PlatformMBeanProvider { * Instantiates a new PlatformMBeanProvider. * * @throws SecurityException if the subclass (and calling code) does not - * have {@code RuntimePermission("sun.management.spi.PlatformMBeanProvider", "subclass")} + * have {@code RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass")} */ protected PlatformMBeanProvider () { this(checkSubclassPermission()); @@ -226,7 +226,7 @@ public abstract class PlatformMBeanProvider { private static Void checkSubclassPermission() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new RuntimePermission(PlatformMBeanProvider.class.getName(), "subclass")); + sm.checkPermission(new RuntimePermission(PlatformMBeanProvider.class.getName()+".subclass")); } return null; } diff --git a/jdk/src/java.management/share/native/libmanagement/GarbageCollectorImpl.c b/jdk/src/java.management/share/native/libmanagement/GarbageCollectorImpl.c index 020335d32ea..3f2e3e75eba 100644 --- a/jdk/src/java.management/share/native/libmanagement/GarbageCollectorImpl.c +++ b/jdk/src/java.management/share/native/libmanagement/GarbageCollectorImpl.c @@ -36,17 +36,3 @@ JNIEXPORT jlong JNICALL Java_sun_management_GarbageCollectorImpl_getCollectionTi (JNIEnv *env, jobject mgr) { return jmm_interface->GetLongAttribute(env, mgr, JMM_GC_TIME_MS); } - - -JNIEXPORT void JNICALL Java_sun_management_GarbageCollectorImpl_setNotificationEnabled -(JNIEnv *env, jobject dummy, jobject gc,jboolean enabled) { - - if (gc == NULL) { - JNU_ThrowNullPointerException(env, "Invalid GarbageCollectorMBean"); - return; - } - if((jmm_version > JMM_VERSION_1_2) - || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=1))) { - jmm_interface->SetGCNotificationEnabled(env, gc, enabled); - } -} diff --git a/jdk/src/java.management/unix/native/libmanagement/LinuxOperatingSystem.c b/jdk/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c similarity index 97% rename from jdk/src/java.management/unix/native/libmanagement/LinuxOperatingSystem.c rename to jdk/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c index 9029bd0a660..95d3eae2da4 100644 --- a/jdk/src/java.management/unix/native/libmanagement/LinuxOperatingSystem.c +++ b/jdk/src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -36,7 +36,7 @@ #include #include #include -#include "sun_management_OperatingSystemImpl.h" +#include "com_sun_management_internal_OperatingSystemImpl.h" struct ticks { uint64_t used; @@ -311,7 +311,7 @@ double get_process_load() { } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0 (JNIEnv *env, jobject dummy) { if(perfInit() == 0) { @@ -322,7 +322,7 @@ Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0 (JNIEnv *env, jobject dummy) { if(perfInit() == 0) { diff --git a/jdk/src/java.management/unix/native/libmanagement/MacosxOperatingSystem.c b/jdk/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c similarity index 94% rename from jdk/src/java.management/unix/native/libmanagement/MacosxOperatingSystem.c rename to jdk/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c index 7771ccd5cb4..edfa7649d46 100644 --- a/jdk/src/java.management/unix/native/libmanagement/MacosxOperatingSystem.c +++ b/jdk/src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -#include "sun_management_OperatingSystemImpl.h" +#include "com_sun_management_internal_OperatingSystemImpl.h" #include #include @@ -32,7 +32,7 @@ #include "jvm.h" JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0 (JNIEnv *env, jobject dummy) { // This code is influenced by the darwin top source @@ -84,7 +84,7 @@ Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0 (JNIEnv *env, jobject dummy) { // This code is influenced by the darwin top source diff --git a/jdk/src/java.management/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider b/jdk/src/jdk.management/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider similarity index 100% rename from jdk/src/java.management/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider rename to jdk/src/jdk.management/share/classes/META-INF/services/sun.management.spi.PlatformMBeanProvider diff --git a/jdk/src/java.management/share/classes/com/sun/management/DiagnosticCommandMBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/DiagnosticCommandMBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java b/jdk/src/jdk.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java similarity index 97% rename from jdk/src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java rename to jdk/src/jdk.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java index 5546f55d05e..b970d2704ba 100644 --- a/jdk/src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -25,13 +25,10 @@ package com.sun.management; -import javax.management.Notification; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeDataView; import javax.management.openmbean.CompositeType; -import java.util.Collection; -import java.util.Collections; -import sun.management.GarbageCollectionNotifInfoCompositeData; +import com.sun.management.internal.GarbageCollectionNotifInfoCompositeData; /** * The information about a garbage collection diff --git a/jdk/src/java.management/share/classes/com/sun/management/GarbageCollectorMXBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/GarbageCollectorMXBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/GarbageCollectorMXBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/GarbageCollectorMXBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/GcInfo.java b/jdk/src/jdk.management/share/classes/com/sun/management/GcInfo.java similarity index 98% rename from jdk/src/java.management/share/classes/com/sun/management/GcInfo.java rename to jdk/src/jdk.management/share/classes/com/sun/management/GcInfo.java index 7257b6c6f62..1ba2eca90a4 100644 --- a/jdk/src/java.management/share/classes/com/sun/management/GcInfo.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/GcInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -33,9 +33,8 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.List; -import sun.management.GcInfoCompositeData; -import sun.management.GcInfoBuilder; +import com.sun.management.internal.GcInfoCompositeData; +import com.sun.management.internal.GcInfoBuilder; /** * Garbage collection information. It contains the following diff --git a/jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/OperatingSystemMXBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/OperatingSystemMXBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/ThreadMXBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/ThreadMXBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/UnixOperatingSystemMXBean.java b/jdk/src/jdk.management/share/classes/com/sun/management/UnixOperatingSystemMXBean.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/UnixOperatingSystemMXBean.java rename to jdk/src/jdk.management/share/classes/com/sun/management/UnixOperatingSystemMXBean.java diff --git a/jdk/src/java.management/share/classes/com/sun/management/VMOption.java b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java similarity index 96% rename from jdk/src/java.management/share/classes/com/sun/management/VMOption.java rename to jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java index 9c66af1ef5b..21a18e012e2 100644 --- a/jdk/src/java.management/share/classes/com/sun/management/VMOption.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/VMOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -25,7 +25,7 @@ package com.sun.management; -import sun.management.VMOptionCompositeData; +import com.sun.management.internal.VMOptionCompositeData; import javax.management.openmbean.CompositeData; /** @@ -241,5 +241,8 @@ public class VMOption { } - + // for sun.management.MappedMXBeanType + static CompositeData toCompositeData(VMOption option) { + return VMOptionCompositeData.toCompositeData(option); + } } diff --git a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandArgumentInfo.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandArgumentInfo.java similarity index 97% rename from jdk/src/java.management/share/classes/sun/management/DiagnosticCommandArgumentInfo.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandArgumentInfo.java index 1ad267b1ecf..3c956a49172 100644 --- a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandArgumentInfo.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandArgumentInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -package sun.management; +package com.sun.management.internal; /** * Diagnostic Command Argument information. It contains the description diff --git a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandImpl.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java similarity index 90% rename from jdk/src/java.management/share/classes/sun/management/DiagnosticCommandImpl.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java index 27730898f1b..a0718a3c2f3 100644 --- a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandImpl.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,21 +23,41 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import com.sun.management.DiagnosticCommandMBean; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.security.Permission; import java.util.*; -import javax.management.*; +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.Descriptor; +import javax.management.ImmutableDescriptor; +import javax.management.InvalidAttributeValueException; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MalformedObjectNameException; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.ReflectionException; +import sun.management.ManagementFactoryHelper; +import sun.management.NotificationEmitterSupport; +import sun.management.VMManagement; /** * Implementation class for the diagnostic commands subsystem. * * @since 1.8 */ -class DiagnosticCommandImpl extends NotificationEmitterSupport +public class DiagnosticCommandImpl extends NotificationEmitterSupport implements DiagnosticCommandMBean { private final VMManagement jvm; @@ -45,6 +65,17 @@ class DiagnosticCommandImpl extends NotificationEmitterSupport private static final String strClassName = "".getClass().getName(); private static final String strArrayClassName = String[].class.getName(); private final boolean isSupported; + private static DiagnosticCommandImpl diagCommandMBean = null; + + static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { + VMManagement jvm = ManagementFactoryHelper.getVMManagement(); + + // Remote Diagnostic Commands may not be supported + if (diagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { + diagCommandMBean = new DiagnosticCommandImpl(jvm); + } + return diagCommandMBean; + } @Override public Object getAttribute(String attribute) throws AttributeNotFoundException, @@ -327,7 +358,7 @@ class DiagnosticCommandImpl extends NotificationEmitterSupport } ObjectName on = null; try { - on = ObjectName.getInstance(ManagementFactoryHelper.HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME); + on = ObjectName.getInstance(PlatformMBeanProviderImpl.DIAGNOSTIC_COMMAND_MBEAN_NAME); } catch (MalformedObjectNameException e) { } Notification notif = new Notification("jmx.mbean.info.changed", on, diff --git a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandInfo.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandInfo.java similarity index 97% rename from jdk/src/java.management/share/classes/sun/management/DiagnosticCommandInfo.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandInfo.java index 08541b3d276..1184a40b64c 100644 --- a/jdk/src/java.management/share/classes/sun/management/DiagnosticCommandInfo.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import java.util.List; diff --git a/jdk/src/java.management/share/classes/sun/management/Flag.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/Flag.java similarity index 97% rename from jdk/src/java.management/share/classes/sun/management/Flag.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/Flag.java index 52da43e8408..3b5402fb040 100644 --- a/jdk/src/java.management/share/classes/sun/management/Flag.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/Flag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import java.util.*; import com.sun.management.VMOption; diff --git a/jdk/src/java.management/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectionNotifInfoCompositeData.java similarity index 96% rename from jdk/src/java.management/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectionNotifInfoCompositeData.java index 722c0dfc55f..ff11d7b5aef 100644 --- a/jdk/src/java.management/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectionNotifInfoCompositeData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -23,11 +23,10 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import com.sun.management.GarbageCollectionNotificationInfo; import com.sun.management.GcInfo; -import java.lang.reflect.Method; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeDataSupport; @@ -38,6 +37,9 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.lang.reflect.Field; import java.util.HashMap; +import sun.management.LazyCompositeData; +import static sun.management.LazyCompositeData.getString; +import sun.management.Util; /** * A CompositeData for GarbageCollectionNotificationInfo for the local management support. @@ -95,7 +97,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData { compositeTypeByBuilder.put(builder,gict); } catch (OpenDataException e) { // shouldn't reach here - throw Util.newException(e); + throw new RuntimeException(e); } } } @@ -205,7 +207,7 @@ public class GarbageCollectionNotifInfoCompositeData extends LazyCompositeData { baseGcNotifInfoItemTypes); } catch (OpenDataException e) { // shouldn't reach here - throw Util.newException(e); + throw new RuntimeException(e); } } return baseGcNotifInfoCompositeType; diff --git a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java new file mode 100644 index 00000000000..8e0512dde5f --- /dev/null +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GarbageCollectorExtImpl.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2003, 2015, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package com.sun.management.internal; + +import com.sun.management.GarbageCollectionNotificationInfo; +import com.sun.management.GarbageCollectorMXBean; +import com.sun.management.GcInfo; +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryPoolMXBean; +import java.util.List; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; +import javax.management.Notification; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.openmbean.CompositeData; +import sun.management.GarbageCollectorImpl; + +/** + * Implementation class for the garbage collector. + * Standard and committed hotspot-specific metrics if any. + * + * ManagementFactory.getGarbageCollectorMXBeans() returns a list + * of instances of this class. + */ +public class GarbageCollectorExtImpl extends GarbageCollectorImpl + implements GarbageCollectorMXBean { + + public GarbageCollectorExtImpl(String name) { + super(name); + } + + // The memory pools are static and won't be changed. + // TODO: If the hotspot implementation begins to have pools + // dynamically created and removed, this needs to be modified. + private String[] poolNames = null; + private synchronized String[] getAllPoolNames() { + if (poolNames == null) { + List pools = ManagementFactory.getMemoryPoolMXBeans(); + poolNames = new String[pools.size()]; + int i = 0; + for (MemoryPoolMXBean m : pools) { + poolNames[i++] = m.getName(); + } + } + return poolNames; + } + + public GcInfo getLastGcInfo() { + GcInfo info = getGcInfoBuilder().getLastGcInfo(); + return info; + } + + private final static String notifName = + "javax.management.Notification"; + + private final static String[] gcNotifTypes = { + GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION + }; + + private MBeanNotificationInfo[] notifInfo = null; + public MBeanNotificationInfo[] getNotificationInfo() { + synchronized (this) { + if (notifInfo == null) { + notifInfo = new MBeanNotificationInfo[1]; + notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes, + notifName, + "GC Notification"); + } + } + return notifInfo; + } + + private static long seqNumber = 0; + private static long getNextSeqNumber() { + return ++seqNumber; + } + + protected void createGCNotification(long timestamp, + String gcName, + String gcAction, + String gcCause, + GcInfo gcInfo) { + if (!hasListeners()) { + return; + } + Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION, + getObjectName(), + getNextSeqNumber(), + timestamp, + gcName); + GarbageCollectionNotificationInfo info = + new GarbageCollectionNotificationInfo(gcName, + gcAction, + gcCause, + gcInfo); + + CompositeData cd = + GarbageCollectionNotifInfoCompositeData.toCompositeData(info); + notif.setUserData(cd); + sendNotification(notif); + } + + public synchronized void addNotificationListener(NotificationListener listener, + NotificationFilter filter, + Object handback) + { + boolean before = hasListeners(); + super.addNotificationListener(listener, filter, handback); + boolean after = hasListeners(); + if (!before && after) { + setNotificationEnabled(this, true); + } + } + + public synchronized void removeNotificationListener(NotificationListener listener) + throws ListenerNotFoundException { + boolean before = hasListeners(); + super.removeNotificationListener(listener); + boolean after = hasListeners(); + + if (before && !after) { + setNotificationEnabled(this,false); + } + } + + public synchronized void removeNotificationListener(NotificationListener listener, + NotificationFilter filter, + Object handback) + throws ListenerNotFoundException + { + boolean before = hasListeners(); + super.removeNotificationListener(listener,filter,handback); + boolean after = hasListeners(); + if (before && !after) { + setNotificationEnabled(this,false); + } + } + + private GcInfoBuilder gcInfoBuilder; + // Invoked also by the VM + private synchronized GcInfoBuilder getGcInfoBuilder() { + if(gcInfoBuilder == null) { + gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames()); + } + return gcInfoBuilder; + } + + private native void setNotificationEnabled(GarbageCollectorMXBean gc, + boolean enabled); + + // Invoked by the VM + private static java.lang.management.GarbageCollectorMXBean + createGarbageCollector(String name, String type) { + + return new GarbageCollectorExtImpl(name); + } +} diff --git a/jdk/src/java.management/share/classes/sun/management/GcInfoBuilder.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java similarity index 95% rename from jdk/src/java.management/share/classes/sun/management/GcInfoBuilder.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java index b503df57ad9..ab5f795f147 100644 --- a/jdk/src/java.management/share/classes/sun/management/GcInfoBuilder.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -22,20 +22,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package sun.management; +package com.sun.management.internal; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.MemoryUsage; import javax.management.openmbean.OpenType; import javax.management.openmbean.SimpleType; -import javax.management.openmbean.TabularType; -import javax.management.openmbean.TabularData; -import javax.management.openmbean.TabularDataSupport; import javax.management.openmbean.CompositeType; -import javax.management.openmbean.CompositeData; -import javax.management.openmbean.CompositeDataSupport; import javax.management.openmbean.OpenDataException; import com.sun.management.GcInfo; +import sun.management.Util; /** * Helper class to build composite data. @@ -164,7 +160,7 @@ public class GcInfoBuilder { allItemTypes); } catch (OpenDataException e) { // shouldn't reach here - throw Util.newException(e); + throw new RuntimeException(e); } gcInfoCompositeType = gict; diff --git a/jdk/src/java.management/share/classes/sun/management/GcInfoCompositeData.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoCompositeData.java similarity index 97% rename from jdk/src/java.management/share/classes/sun/management/GcInfoCompositeData.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoCompositeData.java index b1cb38e16b1..67444a4b5d6 100644 --- a/jdk/src/java.management/share/classes/sun/management/GcInfoCompositeData.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoCompositeData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, 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 @@ -23,16 +23,12 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import java.lang.management.MemoryUsage; import java.lang.reflect.Method; import java.lang.reflect.Field; -import java.util.Iterator; import java.util.Map; -import java.util.HashMap; -import java.util.List; -import java.util.Collections; import java.io.InvalidObjectException; import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeData; @@ -42,9 +38,12 @@ import javax.management.openmbean.SimpleType; import javax.management.openmbean.OpenType; import javax.management.openmbean.OpenDataException; import com.sun.management.GcInfo; -import com.sun.management.GarbageCollectionNotificationInfo; import java.security.AccessController; import java.security.PrivilegedAction; +import sun.management.LazyCompositeData; +import static sun.management.LazyCompositeData.getLong; +import sun.management.MappedMXBeanType; +import sun.management.Util; /** * A CompositeData for GcInfo for the local management support. @@ -266,7 +265,7 @@ public class GcInfoCompositeData extends LazyCompositeData { getBaseGcInfoItemTypes()); } catch (OpenDataException e) { // shouldn't reach here - throw Util.newException(e); + throw new RuntimeException(e); } } return baseGcInfoCompositeType; diff --git a/jdk/src/java.management/share/classes/sun/management/HotSpotDiagnostic.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotDiagnostic.java similarity index 97% rename from jdk/src/java.management/share/classes/sun/management/HotSpotDiagnostic.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotDiagnostic.java index 7c39ea7e9d3..5b9d8efdafc 100644 --- a/jdk/src/java.management/share/classes/sun/management/HotSpotDiagnostic.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotDiagnostic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import java.io.IOException; import java.util.ArrayList; @@ -32,6 +32,7 @@ import javax.management.ObjectName; import com.sun.management.HotSpotDiagnosticMXBean; import com.sun.management.VMOption; +import sun.management.Util; /** * Implementation of the diagnostic MBean for Hotspot VM. diff --git a/jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotThreadImpl.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotThreadImpl.java new file mode 100644 index 00000000000..e31947e4647 --- /dev/null +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/HotSpotThreadImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2015, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.sun.management.internal; + +import com.sun.management.ThreadMXBean; +import sun.management.ManagementFactoryHelper; +import sun.management.ThreadImpl; +import sun.management.VMManagement; + +/** + * + */ +public class HotSpotThreadImpl extends ThreadImpl implements ThreadMXBean { + public HotSpotThreadImpl(VMManagement vm) { + super(ManagementFactoryHelper.getVMManagement()); + } + + @Override + public boolean isThreadAllocatedMemorySupported() { + return super.isThreadAllocatedMemorySupported(); + } + + @Override + public boolean isThreadAllocatedMemoryEnabled() { + return super.isThreadAllocatedMemoryEnabled(); + } + + @Override + public long[] getThreadCpuTime(long[] ids) { + return super.getThreadCpuTime(ids); + } + + @Override + public long[] getThreadUserTime(long[] ids) { + return super.getThreadUserTime(ids); + } + + @Override + public long getThreadAllocatedBytes(long id) { + return super.getThreadAllocatedBytes(id); + } + + @Override + public long[] getThreadAllocatedBytes(long[] ids) { + return super.getThreadAllocatedBytes(ids); + } + + @Override + public void setThreadAllocatedMemoryEnabled(boolean enable) { + super.setThreadAllocatedMemoryEnabled(enable); + } +} diff --git a/jdk/src/java.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java similarity index 63% rename from jdk/src/java.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java index 42d41b65992..24fbbb54c93 100644 --- a/jdk/src/java.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java @@ -24,7 +24,14 @@ */ package com.sun.management.internal; +import com.sun.management.DiagnosticCommandMBean; +import com.sun.management.HotSpotDiagnosticMXBean; +import com.sun.management.ThreadMXBean; import java.lang.management.ManagementFactory; +import java.lang.management.MemoryManagerMXBean; +import java.lang.management.OperatingSystemMXBean; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -34,12 +41,23 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.management.DynamicMBean; -import javax.management.ObjectName; import sun.management.ManagementFactoryHelper; import sun.management.spi.PlatformMBeanProvider; public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { + final static String DIAGNOSTIC_COMMAND_MBEAN_NAME = + "com.sun.management:type=DiagnosticCommand"; + private final List> mxbeanList; + private static HotSpotDiagnostic hsDiagMBean = null; + private static OperatingSystemMXBean osMBean = null; + + static { + AccessController.doPrivileged((PrivilegedAction) () -> { + System.loadLibrary("management_ext"); + return null; + }); + } public PlatformMBeanProviderImpl() { mxbeanList = Collections.unmodifiableList(init()); @@ -55,7 +73,7 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { /** * Garbage Collector in the Java virtual machine. */ - initMBeanList.add(new PlatformComponent() { + initMBeanList.add(new PlatformComponent() { private final Set garbageCollectorMXBeanInterfaceNames = Collections.unmodifiableSet( Stream.of("java.lang.management.MemoryManagerMXBean", @@ -64,8 +82,8 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { .collect(Collectors.toSet())); @Override - public Set> mbeanInterfaces() { - return Stream.of(java.lang.management.MemoryManagerMXBean.class, + public Set> mbeanInterfaces() { + return Stream.of(MemoryManagerMXBean.class, java.lang.management.GarbageCollectorMXBean.class, com.sun.management.GarbageCollectorMXBean.class) .collect(Collectors.toSet()); @@ -87,27 +105,67 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { } @Override - public Map nameToMBeanMap() { + public Map nameToMBeanMap() { List list - = ManagementFactoryHelper.getGarbageCollectorMXBeans();; - Map map; + = ManagementFactoryHelper.getGarbageCollectorMXBeans(); + Map map; if (list.isEmpty()) { - map = Collections.emptyMap(); + map = Collections.emptyMap(); } else { map = new HashMap<>(list.size()); - for (java.lang.management.MemoryManagerMXBean gcm : list) { + for (MemoryManagerMXBean gcm : list) { map.put(gcm.getObjectName().getCanonicalName(), gcm); } } + return map; } }); + /** + * Threading system of the Java virtual machine. + */ + initMBeanList.add(new PlatformComponent() { + private final Set threadMXBeanInterfaceNames + = Collections.unmodifiableSet( + Stream.of("java.lang.management.ThreadMXBean", + "com.sun.management.ThreadMXBean") + .collect(Collectors.toSet())); + private ThreadMXBean threadMBean = null; + + @Override + public Set> mbeanInterfaces() { + return Stream.of(java.lang.management.ThreadMXBean.class, + com.sun.management.ThreadMXBean.class) + .collect(Collectors.toSet()); + } + + @Override + public Set mbeanInterfaceNames() { + return threadMXBeanInterfaceNames; + } + + @Override + public String getObjectNamePattern() { + return ManagementFactory.THREAD_MXBEAN_NAME; + } + + @Override + public synchronized Map nameToMBeanMap() { + if (threadMBean == null) { + threadMBean = new HotSpotThreadImpl(ManagementFactoryHelper.getVMManagement()); + } + return Collections.singletonMap( + ManagementFactory.THREAD_MXBEAN_NAME, + threadMBean); + } + }); + /** * OperatingSystemMXBean */ - initMBeanList.add(new PlatformComponent() { + initMBeanList.add(new PlatformComponent() { private final Set operatingSystemMXBeanInterfaceNames = Collections.unmodifiableSet( Stream.of("java.lang.management.OperatingSystemMXBean", @@ -116,7 +174,7 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { .collect(Collectors.toSet())); @Override - public Set> mbeanInterfaces() { + public Set> mbeanInterfaces() { return Stream.of(java.lang.management.OperatingSystemMXBean.class, com.sun.management.OperatingSystemMXBean.class, com.sun.management.UnixOperatingSystemMXBean.class) @@ -137,7 +195,7 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { public Map nameToMBeanMap() { return Collections.singletonMap( ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, - ManagementFactoryHelper.getOperatingSystemMXBean()); + getOperatingSystemMXBean()); } }); @@ -146,7 +204,8 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { */ initMBeanList.add(new PlatformComponent() { private final Set hotSpotDiagnosticMXBeanInterfaceNames = - Collections.unmodifiableSet(Collections.singleton("com.sun.management.HotSpotDiagnosticMXBean")); + Collections.unmodifiableSet(Collections.singleton( + "com.sun.management.HotSpotDiagnosticMXBean")); @Override public Set> mbeanInterfaces() { @@ -167,19 +226,20 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { public Map nameToMBeanMap() { return Collections.singletonMap( "com.sun.management:type=HotSpotDiagnostic", - ManagementFactoryHelper.getDiagnosticMXBean()); + getDiagnosticMXBean()); } }); /** - * DynamicMBean + * Diagnostic command MBean */ - HashMap dynmbeans - = ManagementFactoryHelper.getPlatformDynamicMBeans(); - final Set dynamicMBeanInterfaceNames = - Collections.unmodifiableSet(Collections.singleton("javax.management.DynamicMBean")); - for (Map.Entry e : dynmbeans.entrySet()) { + DiagnosticCommandMBean diagMBean = DiagnosticCommandImpl.getDiagnosticCommandMBean(); + if (diagMBean != null) { initMBeanList.add(new PlatformComponent() { + final Set dynamicMBeanInterfaceNames + = Collections.unmodifiableSet(Collections.singleton( + "javax.management.DynamicMBean")); + @Override public Set mbeanInterfaceNames() { return dynamicMBeanInterfaceNames; @@ -187,23 +247,39 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { @Override public Set> mbeanInterfaces() { - return Collections.emptySet(); // DynamicMBean cannot be used to find an MBean by ManagementFactory + // DynamicMBean cannot be used to find an MBean by ManagementFactory + return Collections.emptySet(); } @Override public String getObjectNamePattern() { - return e.getKey().getCanonicalName(); + return DIAGNOSTIC_COMMAND_MBEAN_NAME; } @Override public Map nameToMBeanMap() { return Collections.singletonMap( - e.getKey().getCanonicalName(), - e.getValue()); + DIAGNOSTIC_COMMAND_MBEAN_NAME, + diagMBean); } }); } + initMBeanList.trimToSize(); return initMBeanList; } + + private static synchronized HotSpotDiagnosticMXBean getDiagnosticMXBean() { + if (hsDiagMBean == null) { + hsDiagMBean = new HotSpotDiagnostic(); + } + return hsDiagMBean; + } + + private static synchronized OperatingSystemMXBean getOperatingSystemMXBean() { + if (osMBean == null) { + osMBean = new OperatingSystemImpl(ManagementFactoryHelper.getVMManagement()); + } + return osMBean; + } } diff --git a/jdk/src/java.management/share/classes/sun/management/VMOptionCompositeData.java b/jdk/src/jdk.management/share/classes/com/sun/management/internal/VMOptionCompositeData.java similarity index 96% rename from jdk/src/java.management/share/classes/sun/management/VMOptionCompositeData.java rename to jdk/src/jdk.management/share/classes/com/sun/management/internal/VMOptionCompositeData.java index 6eeac787000..9ca81a4d6ea 100644 --- a/jdk/src/java.management/share/classes/sun/management/VMOptionCompositeData.java +++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/VMOptionCompositeData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -23,7 +23,7 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import com.sun.management.VMOption; import com.sun.management.VMOption.Origin; @@ -31,6 +31,8 @@ import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeDataSupport; import javax.management.openmbean.OpenDataException; +import sun.management.LazyCompositeData; +import sun.management.MappedMXBeanType; /** * A CompositeData for VMOption for the local management support. diff --git a/jdk/src/java.management/share/classes/com/sun/management/package-info.java b/jdk/src/jdk.management/share/classes/com/sun/management/package-info.java similarity index 100% rename from jdk/src/java.management/share/classes/com/sun/management/package-info.java rename to jdk/src/jdk.management/share/classes/com/sun/management/package-info.java diff --git a/jdk/src/java.management/share/native/libmanagement/DiagnosticCommandImpl.c b/jdk/src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c similarity index 89% rename from jdk/src/java.management/share/native/libmanagement/DiagnosticCommandImpl.c rename to jdk/src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c index 4c1eeea2f0b..f0267dd3ee3 100644 --- a/jdk/src/java.management/share/native/libmanagement/DiagnosticCommandImpl.c +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -25,10 +25,10 @@ #include #include -#include "management.h" -#include "sun_management_DiagnosticCommandImpl.h" +#include "management_ext.h" +#include "com_sun_management_internal_DiagnosticCommandImpl.h" -JNIEXPORT void JNICALL Java_sun_management_DiagnosticCommandImpl_setNotificationEnabled +JNIEXPORT void JNICALL Java_com_sun_management_internal_DiagnosticCommandImpl_setNotificationEnabled (JNIEnv *env, jobject dummy, jboolean enabled) { if (jmm_version <= JMM_VERSION_1_2_2) { JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", @@ -39,7 +39,7 @@ JNIEXPORT void JNICALL Java_sun_management_DiagnosticCommandImpl_setNotification } JNIEXPORT jobjectArray JNICALL -Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommands +Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommands (JNIEnv *env, jobject dummy) { return jmm_interface->GetDiagnosticCommands(env); @@ -64,7 +64,7 @@ jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command, jmm_interface->GetDiagnosticCommandArgumentsInfo(env, command, dcmd_arg_info_array); dcmdArgInfoCls = (*env)->FindClass(env, - "sun/management/DiagnosticCommandArgumentInfo"); + "com/sun/management/internal/DiagnosticCommandArgumentInfo"); if ((*env)->ExceptionCheck(env)) { free(dcmd_arg_info_array); return NULL; @@ -77,7 +77,7 @@ jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command, } for (i=0; iNewStringUTF(env,dcmd_arg_info_array[i].name), (*env)->NewStringUTF(env,dcmd_arg_info_array[i].description), @@ -113,7 +113,7 @@ jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command, * passed in argument is not supported by the JVM */ JNIEXPORT jobjectArray JNICALL -Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo +Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommandInfo (JNIEnv *env, jobject dummy, jobjectArray commands) { int i; @@ -132,7 +132,7 @@ Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo } num_commands = (*env)->GetArrayLength(env, commands); dcmdInfoCls = (*env)->FindClass(env, - "sun/management/DiagnosticCommandInfo"); + "com/sun/management/internal/DiagnosticCommandInfo"); if ((*env)->ExceptionCheck(env)) { return NULL; } @@ -163,7 +163,7 @@ Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo return NULL; } obj = JNU_NewObjectByName(env, - "sun/management/DiagnosticCommandInfo", + "com/sun/management/internal/DiagnosticCommandInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)V", (*env)->NewStringUTF(env,dcmd_info_array[i].name), (*env)->NewStringUTF(env,dcmd_info_array[i].description), @@ -188,7 +188,7 @@ Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo * passed in argument is not supported by the JVM */ JNIEXPORT jstring JNICALL -Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand +Java_com_sun_management_internal_DiagnosticCommandImpl_executeDiagnosticCommand (JNIEnv *env, jobject dummy, jstring command) { return jmm_interface->ExecuteDiagnosticCommand(env, command); } diff --git a/jdk/src/java.management/share/native/libmanagement/Flag.c b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c similarity index 91% rename from jdk/src/java.management/share/native/libmanagement/Flag.c rename to jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c index 00828f34967..1629468f398 100644 --- a/jdk/src/java.management/share/native/libmanagement/Flag.c +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -27,8 +27,8 @@ #include #include #include -#include "management.h" -#include "sun_management_Flag.h" +#include "management_ext.h" +#include "com_sun_management_internal_Flag.h" static jobject default_origin = NULL; static jobject vm_creation_origin = NULL; @@ -40,7 +40,7 @@ static jobject attach_origin = NULL; static jobject other_origin = NULL; JNIEXPORT jint JNICALL -Java_sun_management_Flag_getInternalFlagCount +Java_com_sun_management_internal_Flag_getInternalFlagCount (JNIEnv *env, jclass cls) { jlong count = jmm_interface->GetLongAttribute(env, NULL, @@ -49,7 +49,7 @@ Java_sun_management_Flag_getInternalFlagCount } JNIEXPORT jobjectArray JNICALL - Java_sun_management_Flag_getAllFlagNames + Java_com_sun_management_internal_Flag_getAllFlagNames (JNIEnv *env, jclass cls) { return jmm_interface->GetVMGlobalNames(env); @@ -66,7 +66,7 @@ static jobject find_origin_constant(JNIEnv* env, const char* enum_name) { } JNIEXPORT void JNICALL -Java_sun_management_Flag_initialize +Java_com_sun_management_internal_Flag_initialize (JNIEnv *env, jclass cls) { default_origin = find_origin_constant(env, "DEFAULT"); @@ -80,13 +80,13 @@ Java_sun_management_Flag_initialize } JNIEXPORT jint JNICALL -Java_sun_management_Flag_getFlags +Java_com_sun_management_internal_Flag_getFlags (JNIEnv *env, jclass cls, jobjectArray names, jobjectArray flags, jint count) { jint num_flags, i, index; jmmVMGlobal* globals; size_t gsize; - const char* class_name = "sun/management/Flag"; + const char* class_name = "com/sun/management/internal/Flag"; const char* signature = "(Ljava/lang/String;Ljava/lang/Object;ZZLcom/sun/management/VMOption$Origin;)V"; jobject origin; jobject valueObj; @@ -196,7 +196,7 @@ Java_sun_management_Flag_getFlags } JNIEXPORT void JNICALL -Java_sun_management_Flag_setLongValue +Java_com_sun_management_internal_Flag_setLongValue (JNIEnv *env, jclass cls, jstring name, jlong value) { jvalue v; @@ -206,7 +206,7 @@ Java_sun_management_Flag_setLongValue } JNIEXPORT void JNICALL -Java_sun_management_Flag_setDoubleValue +Java_com_sun_management_internal_Flag_setDoubleValue (JNIEnv *env, jclass cls, jstring name, jdouble value) { jvalue v; @@ -216,7 +216,7 @@ Java_sun_management_Flag_setDoubleValue } JNIEXPORT void JNICALL -Java_sun_management_Flag_setBooleanValue +Java_com_sun_management_internal_Flag_setBooleanValue (JNIEnv *env, jclass cls, jstring name, jboolean value) { jvalue v; @@ -226,7 +226,7 @@ Java_sun_management_Flag_setBooleanValue } JNIEXPORT void JNICALL -Java_sun_management_Flag_setStringValue +Java_com_sun_management_internal_Flag_setStringValue (JNIEnv *env, jclass cls, jstring name, jstring value) { jvalue v; diff --git a/jdk/src/jdk.management/share/native/libmanagement_ext/GarbageCollectorExtImpl.c b/jdk/src/jdk.management/share/native/libmanagement_ext/GarbageCollectorExtImpl.c new file mode 100644 index 00000000000..f34d1959a32 --- /dev/null +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/GarbageCollectorExtImpl.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2015, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +#include +#include "management_ext.h" +#include "com_sun_management_internal_GarbageCollectorExtImpl.h" + +JNIEXPORT void JNICALL Java_com_sun_management_internal_GarbageCollectorExtImpl_setNotificationEnabled +(JNIEnv *env, jobject dummy, jobject gc,jboolean enabled) { + + if (gc == NULL) { + JNU_ThrowNullPointerException(env, "Invalid GarbageCollectorMBean"); + return; + } + if((jmm_version > JMM_VERSION_1_2) + || (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=1))) { + jmm_interface->SetGCNotificationEnabled(env, gc, enabled); + } +} diff --git a/jdk/src/java.management/share/native/libmanagement/GcInfoBuilder.c b/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c similarity index 94% rename from jdk/src/java.management/share/native/libmanagement/GcInfoBuilder.c rename to jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c index 672cc6a7782..8fb337b8ecd 100644 --- a/jdk/src/java.management/share/native/libmanagement/GcInfoBuilder.c +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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,10 +26,10 @@ #include #include #include -#include "management.h" -#include "sun_management_GcInfoBuilder.h" +#include "management_ext.h" +#include "com_sun_management_internal_GcInfoBuilder.h" -JNIEXPORT jint JNICALL Java_sun_management_GcInfoBuilder_getNumGcExtAttributes +JNIEXPORT jint JNICALL Java_com_sun_management_internal_GcInfoBuilder_getNumGcExtAttributes (JNIEnv *env, jobject dummy, jobject gc) { jlong value; @@ -42,7 +42,7 @@ JNIEXPORT jint JNICALL Java_sun_management_GcInfoBuilder_getNumGcExtAttributes return (jint) value; } -JNIEXPORT void JNICALL Java_sun_management_GcInfoBuilder_fillGcAttributeInfo +JNIEXPORT void JNICALL Java_com_sun_management_internal_GcInfoBuilder_fillGcAttributeInfo (JNIEnv *env, jobject dummy, jobject gc, jint num_attributes, jobjectArray attributeNames, jcharArray types, jobjectArray descriptions) { @@ -173,7 +173,7 @@ static void setCharValueAtObjectArray(JNIEnv *env, jobjectArray array, (*env)->SetObjectArrayElement(env, array, index, obj); } -JNIEXPORT jobject JNICALL Java_sun_management_GcInfoBuilder_getLastGcInfo0 +JNIEXPORT jobject JNICALL Java_com_sun_management_internal_GcInfoBuilder_getLastGcInfo0 (JNIEnv *env, jobject builder, jobject gc, jint ext_att_count, jobjectArray ext_att_values, jcharArray ext_att_types, jobjectArray usageBeforeGC, jobjectArray usageAfterGC) { @@ -273,7 +273,7 @@ JNIEXPORT jobject JNICALL Java_sun_management_GcInfoBuilder_getLastGcInfo0 return JNU_NewObjectByName(env, "com/sun/management/GcInfo", - "(Lsun/management/GcInfoBuilder;JJJ[Ljava/lang/management/MemoryUsage;[Ljava/lang/management/MemoryUsage;[Ljava/lang/Object;)V", + "(Lcom/sun/management/internal/GcInfoBuilder;JJJ[Ljava/lang/management/MemoryUsage;[Ljava/lang/management/MemoryUsage;[Ljava/lang/Object;)V", builder, gc_stat.gc_index, gc_stat.start_time, diff --git a/jdk/src/java.management/share/native/libmanagement/HotSpotDiagnostic.c b/jdk/src/jdk.management/share/native/libmanagement_ext/HotSpotDiagnostic.c similarity index 86% rename from jdk/src/java.management/share/native/libmanagement/HotSpotDiagnostic.c rename to jdk/src/jdk.management/share/native/libmanagement_ext/HotSpotDiagnostic.c index fe6b2c6e7d2..d4b26771be6 100644 --- a/jdk/src/java.management/share/native/libmanagement/HotSpotDiagnostic.c +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/HotSpotDiagnostic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -25,11 +25,11 @@ #include #include "jvm.h" -#include "management.h" -#include "sun_management_HotSpotDiagnostic.h" +#include "management_ext.h" +#include "com_sun_management_internal_HotSpotDiagnostic.h" JNIEXPORT void JNICALL -Java_sun_management_HotSpotDiagnostic_dumpHeap0 +Java_com_sun_management_internal_HotSpotDiagnostic_dumpHeap0 (JNIEnv *env, jobject dummy, jstring outputfile, jboolean live) { jmm_interface->DumpHeap0(env, outputfile, live); diff --git a/jdk/src/java.management/share/classes/sun/management/ManagementFactory.java b/jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.c similarity index 53% rename from jdk/src/java.management/share/classes/sun/management/ManagementFactory.java rename to jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.c index b12a1c80b08..9d22c0a10a6 100644 --- a/jdk/src/java.management/share/classes/sun/management/ManagementFactory.java +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,33 +23,39 @@ * questions. */ -package sun.management; +#include +#include +#include "jvm.h" +#include "management_ext.h" -import java.lang.management.MemoryManagerMXBean; -import java.lang.management.MemoryPoolMXBean; -import java.lang.management.GarbageCollectorMXBean; +#define ERR_MSG_SIZE 128 -/** - * ManagementFactory class provides the methods that the HotSpot VM - * will invoke. So the class and method names cannot be renamed. - */ -class ManagementFactory { - private ManagementFactory() {}; +const JmmInterface* jmm_interface = NULL; +JavaVM* jvm = NULL; +jint jmm_version = 0; - // Invoked by the VM - private static MemoryPoolMXBean createMemoryPool - (String name, boolean isHeap, long uThreshold, long gcThreshold) { - return new MemoryPoolImpl(name, isHeap, uThreshold, gcThreshold); +JNIEXPORT jint JNICALL + JNI_OnLoad(JavaVM *vm, void *reserved) { + JNIEnv* env; + + jvm = vm; + if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) { + return JNI_ERR; } - private static MemoryManagerMXBean createMemoryManager(String name) { - return new MemoryManagerImpl(name); + jmm_interface = (JmmInterface*) JVM_GetManagement(JMM_VERSION_1_0); + if (jmm_interface == NULL) { + JNU_ThrowInternalError(env, "Unsupported Management version"); + return JNI_ERR; } - private static GarbageCollectorMXBean - createGarbageCollector(String name, String type) { - - // ignore type parameter which is for future extension - return new GarbageCollectorImpl(name); - } + jmm_version = jmm_interface->GetVersion(env); + return (*env)->GetVersion(env); +} + +void throw_internal_error(JNIEnv* env, const char* msg) { + char errmsg[128]; + + sprintf(errmsg, "errno: %d error: %s\n", errno, msg); + JNU_ThrowInternalError(env, errmsg); } diff --git a/jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.h b/jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.h new file mode 100644 index 00000000000..843de66872b --- /dev/null +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/management_ext.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2015, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +#include + +#include "jni_util.h" +#include "jmm.h" + +#ifndef _MANAGEMENT_EXT_H_ +#define _MANAGEMENT_EXT_H_ + +extern const JmmInterface* jmm_interface; +extern jint jmm_version; +extern void throw_internal_error(JNIEnv* env, const char* msg); + +#endif diff --git a/jdk/src/java.management/unix/native/libmanagement/SolarisOperatingSystem.c b/jdk/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c similarity index 95% rename from jdk/src/java.management/unix/native/libmanagement/SolarisOperatingSystem.c rename to jdk/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c index d13a1b3d814..7628ed770a5 100644 --- a/jdk/src/java.management/unix/native/libmanagement/SolarisOperatingSystem.c +++ b/jdk/src/jdk.management/solaris/native/libmanagement_ext/UnixOperatingSystem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -38,7 +38,7 @@ #include #include #include "jvm.h" -#include "sun_management_OperatingSystemImpl.h" +#include "com_sun_management_internal_OperatingSystemImpl.h" typedef struct { kstat_t *kstat; @@ -226,14 +226,14 @@ double get_process_load(void) { } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0 (JNIEnv *env, jobject dummy) { return get_cpu_load(-1); } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0 (JNIEnv *env, jobject dummy) { return get_process_load(); diff --git a/jdk/src/java.management/unix/classes/sun/management/OperatingSystemImpl.java b/jdk/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java similarity index 94% rename from jdk/src/java.management/unix/classes/sun/management/OperatingSystemImpl.java rename to jdk/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java index b99c8008b1d..d1ce39c854b 100644 --- a/jdk/src/java.management/unix/classes/sun/management/OperatingSystemImpl.java +++ b/jdk/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,10 @@ * questions. */ -package sun.management; +package com.sun.management.internal; +import sun.management.BaseOperatingSystemImpl; +import sun.management.VMManagement; /** * Implementation class for the operating system. * Standard and committed hotspot-specific metrics if any. diff --git a/jdk/src/java.management/unix/native/libmanagement/OperatingSystemImpl.c b/jdk/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c similarity index 93% rename from jdk/src/java.management/unix/native/libmanagement/OperatingSystemImpl.c rename to jdk/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c index 00c4d558c96..1adeaf7bb53 100644 --- a/jdk/src/java.management/unix/native/libmanagement/OperatingSystemImpl.c +++ b/jdk/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -27,8 +27,8 @@ #include "jni_util.h" #include "jlong.h" #include "jvm.h" -#include "management.h" -#include "sun_management_OperatingSystemImpl.h" +#include "management_ext.h" +#include "com_sun_management_internal_OperatingSystemImpl.h" #include #include @@ -179,14 +179,14 @@ static jlong get_total_or_available_swap_space_size(JNIEnv* env, jboolean availa } JNIEXPORT void JNICALL -Java_sun_management_OperatingSystemImpl_initialize0 +Java_com_sun_management_internal_OperatingSystemImpl_initialize0 (JNIEnv *env, jclass cls) { page_size = sysconf(_SC_PAGESIZE); } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { #ifdef __solaris__ @@ -256,21 +256,21 @@ Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0 +Java_com_sun_management_internal_OperatingSystemImpl_getTotalSwapSpaceSize0 (JNIEnv *env, jobject mbean) { return get_total_or_available_swap_space_size(env, JNI_FALSE); } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0 +Java_com_sun_management_internal_OperatingSystemImpl_getFreeSwapSpaceSize0 (JNIEnv *env, jobject mbean) { return get_total_or_available_swap_space_size(env, JNI_TRUE); } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuTime0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuTime0 (JNIEnv *env, jobject mbean) { #ifdef __APPLE__ @@ -312,7 +312,7 @@ Java_sun_management_OperatingSystemImpl_getProcessCpuTime0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getFreePhysicalMemorySize0 (JNIEnv *env, jobject mbean) { #ifdef __APPLE__ @@ -346,7 +346,7 @@ Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getTotalPhysicalMemorySize0 (JNIEnv *env, jobject mbean) { #ifdef _ALLBSD_SOURCE @@ -377,7 +377,7 @@ Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0 JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0 +Java_com_sun_management_internal_OperatingSystemImpl_getOpenFileDescriptorCount0 (JNIEnv *env, jobject mbean) { #ifdef __APPLE__ @@ -466,7 +466,7 @@ Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0 +Java_com_sun_management_internal_OperatingSystemImpl_getMaxFileDescriptorCount0 (JNIEnv *env, jobject mbean) { struct rlimit rlp; diff --git a/jdk/src/java.management/windows/classes/sun/management/OperatingSystemImpl.java b/jdk/src/jdk.management/windows/classes/com/sun/management/internal/OperatingSystemImpl.java similarity index 91% rename from jdk/src/java.management/windows/classes/sun/management/OperatingSystemImpl.java rename to jdk/src/jdk.management/windows/classes/com/sun/management/internal/OperatingSystemImpl.java index 52fb709b923..3ab491d422f 100644 --- a/jdk/src/java.management/windows/classes/sun/management/OperatingSystemImpl.java +++ b/jdk/src/jdk.management/windows/classes/com/sun/management/internal/OperatingSystemImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,9 +23,11 @@ * questions. */ -package sun.management; +package com.sun.management.internal; import com.sun.management.OperatingSystemMXBean; +import sun.management.BaseOperatingSystemImpl; +import sun.management.VMManagement; /** * Implementation class for the operating system. @@ -45,36 +47,44 @@ class OperatingSystemImpl extends BaseOperatingSystemImpl super(vm); } + @Override public long getCommittedVirtualMemorySize() { synchronized (psapiLock) { return getCommittedVirtualMemorySize0(); } } + @Override public long getTotalSwapSpaceSize() { return getTotalSwapSpaceSize0(); } + @Override public long getFreeSwapSpaceSize() { return getFreeSwapSpaceSize0(); } + @Override public long getProcessCpuTime() { return getProcessCpuTime0(); } + @Override public long getFreePhysicalMemorySize() { return getFreePhysicalMemorySize0(); } + @Override public long getTotalPhysicalMemorySize() { return getTotalPhysicalMemorySize0(); } + @Override public double getSystemCpuLoad() { return getSystemCpuLoad0(); } + @Override public double getProcessCpuLoad() { return getProcessCpuLoad0(); } diff --git a/jdk/src/java.management/windows/native/libmanagement/OperatingSystemImpl.c b/jdk/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c similarity index 98% rename from jdk/src/java.management/windows/native/libmanagement/OperatingSystemImpl.c rename to jdk/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c index 04dbf8497c8..9ff4980f0ba 100644 --- a/jdk/src/java.management/windows/native/libmanagement/OperatingSystemImpl.c +++ b/jdk/src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -27,8 +27,8 @@ #include "jni_util.h" #include "jlong.h" #include "jvm.h" -#include "management.h" -#include "sun_management_OperatingSystemImpl.h" +#include "management_ext.h" +#include "com_sun_management_internal_OperatingSystemImpl.h" #include #include @@ -75,7 +75,7 @@ static HANDLE main_process; static void perfInit(void); JNIEXPORT void JNICALL -Java_sun_management_OperatingSystemImpl_initialize0 +Java_com_sun_management_internal_OperatingSystemImpl_initialize0 (JNIEnv *env, jclass cls) { main_process = GetCurrentProcess(); @@ -83,7 +83,7 @@ Java_sun_management_OperatingSystemImpl_initialize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0 (JNIEnv *env, jobject mbean) { PROCESS_MEMORY_COUNTERS pmc; @@ -95,7 +95,7 @@ Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0 +Java_com_sun_management_internal_OperatingSystemImpl_getTotalSwapSpaceSize0 (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; @@ -105,7 +105,7 @@ Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0 +Java_com_sun_management_internal_OperatingSystemImpl_getFreeSwapSpaceSize0 (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; @@ -115,7 +115,7 @@ Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuTime0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuTime0 (JNIEnv *env, jobject mbean) { @@ -134,7 +134,7 @@ Java_sun_management_OperatingSystemImpl_getProcessCpuTime0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getFreePhysicalMemorySize0 (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; @@ -144,7 +144,7 @@ Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0 } JNIEXPORT jlong JNICALL -Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0 +Java_com_sun_management_internal_OperatingSystemImpl_getTotalPhysicalMemorySize0 (JNIEnv *env, jobject mbean) { MEMORYSTATUSEX ms; @@ -1349,14 +1349,14 @@ perfGetCPULoad(int which) { } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0 (JNIEnv *env, jobject dummy) { return perfGetCPULoad(-1); } JNIEXPORT jdouble JNICALL -Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0 +Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0 (JNIEnv *env, jobject dummy) { return perfGetProcessCPULoad(); diff --git a/jdk/test/com/sun/management/CheckSomeMXBeanImplPackage.java b/jdk/test/com/sun/management/CheckSomeMXBeanImplPackage.java new file mode 100644 index 00000000000..4879a01bc82 --- /dev/null +++ b/jdk/test/com/sun/management/CheckSomeMXBeanImplPackage.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.management.ManagementFactory; +import java.lang.management.PlatformManagedObject; + +/* + * @test + * @bug 8042901 + * @summary If jdk.management is present, GarbageCollectorMXBean and ThreadMXBean + * must be from com.sun.management.internal + * @author Shanliang Jiang + */ +public class CheckSomeMXBeanImplPackage { + private static String implPackageName = "com.sun.management.internal"; + + public static void main(String[] args) throws Exception { + boolean present = false; + try { + Class.forName("com.sun.management.GarbageCollectorMXBean"); + present = true; + } catch (ClassNotFoundException cnfe) {} + + if (present) { + Class klazz = + java.lang.management.GarbageCollectorMXBean.class; + for (Object obj : + ManagementFactory.getPlatformMXBeans(klazz)) { + check(klazz.getName(), obj); + } + + klazz = com.sun.management.GarbageCollectorMXBean.class; + for (Object obj : + ManagementFactory.getPlatformMXBeans(klazz)) { + check(klazz.getName(), obj); + } + + klazz = java.lang.management.ThreadMXBean.class; + check(klazz.getName(), + ManagementFactory.getPlatformMXBean(klazz)); + + klazz = com.sun.management.ThreadMXBean.class; + check(klazz.getName(), + ManagementFactory.getPlatformMXBean(klazz)); + + System.out.println("--- PASSED!"); + } else { + System.out.println("--- Skip the test, jdk.management module is not present!"); + } + } + + private static void check(String mbeanName, Object impl) { + if (!impl.getClass().getName().startsWith(implPackageName)) { + throw new RuntimeException(mbeanName+" implementation package " + + "should be: " + implPackageName + + ", but got: " + impl.getClass()); + } else { + System.out.println("--- Good, "+mbeanName+" got right implementation: " + impl); + } + } +} diff --git a/jdk/test/com/sun/management/VMOptionOpenDataTest.java b/jdk/test/com/sun/management/VMOptionOpenDataTest.java new file mode 100644 index 00000000000..7f90fd5c705 --- /dev/null +++ b/jdk/test/com/sun/management/VMOptionOpenDataTest.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2015, 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. + */ + +import com.sun.management.VMOption; +import java.io.InvalidObjectException; +import java.util.Objects; +import javax.management.openmbean.OpenDataException; +import sun.management.MappedMXBeanType; + +/* + * @test + * @bug 8042901 + * @summary Check that MappedMXBeanType.toOpenTypeData supports VMOption + * @author Shanliang Jiang + */ +public class VMOptionOpenDataTest { + public static void main(String[] args) throws Exception { + System.out.println("--- VMOptionOpenDataTest-main: Checking that " + + "MappedMXBeanType.toOpenTypeData supports VMOption"); + Exception failed = null; + try { + VMOption vo = new VMOption("toto", "titi", true, VMOption.Origin.OTHER); + System.out.println("--- Construct a VMOption object: \"" + vo + "\""); + + Object open = MappedMXBeanType.toOpenTypeData(vo, VMOption.class); + System.out.println("--- Map it to an open type: \"" + open +" \""); + + Object back = MappedMXBeanType.toJavaTypeData(open, VMOption.class); + System.out.println("--- Map it back to java type: \"" + back +" \""); + + if (back == null) { + failed = new RuntimeException("Failed, mapping back got null."); + } else if (!(back instanceof VMOption)) { + failed = new RuntimeException("Failed, not mapped back to a VMOption: " + +back.getClass()); + } else { + VMOption mapBack = (VMOption)back; + if (!Objects.equals(vo.getName(), mapBack.getName()) || + !Objects.equals(vo.getOrigin(), mapBack.getOrigin()) || + !Objects.equals(vo.getValue(), mapBack.getValue()) || + vo.isWriteable() != mapBack.isWriteable()) { + failed = new RuntimeException( + "Failed, failed to map back the original VMOtion."); + } + } + } catch (OpenDataException | InvalidObjectException ode) { + failed = ode; + } + if (failed == null) { + System.out.println("--- PASSED!"); + } else { + System.out.println("--- Failed: "+failed.getMessage()); + throw failed; + } + } +} diff --git a/jdk/test/java/lang/instrument/NMTHelper.java b/jdk/test/java/lang/instrument/NMTHelper.java index ee5d1e1b882..09e60e4a623 100644 --- a/jdk/test/java/lang/instrument/NMTHelper.java +++ b/jdk/test/java/lang/instrument/NMTHelper.java @@ -27,8 +27,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.Arrays; import java.util.stream.Collectors; -import sun.management.ManagementFactoryHelper; -import com.sun.management.DiagnosticCommandMBean; +import java.lang.management.ManagementFactory; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; public class NMTHelper { @@ -53,7 +54,12 @@ public class NMTHelper } private static String executeDcmd(String cmd, String ... args) { - DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); + ObjectName oname = null; + try { + oname = ObjectName.getInstance("com.sun.management:type=DiagnosticCommand"); + } catch (MalformedObjectNameException mone) { + throw new RuntimeException(mone); + } Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; @@ -63,7 +69,8 @@ public class NMTHelper System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); - String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); + String result = (String)ManagementFactory.getPlatformMBeanServer(). + invoke(oname, cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { diff --git a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java index 60ab8e4347a..d406ae0ceed 100644 --- a/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java +++ b/jdk/test/java/lang/instrument/RedefineMethodInBacktraceApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -31,7 +31,8 @@ import java.lang.management.ThreadInfo; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; -import sun.management.ManagementFactoryHelper; +import javax.management.JMX; +import javax.management.ObjectName; /** * When an exception is thrown, the JVM collects just enough information @@ -103,8 +104,11 @@ public class RedefineMethodInBacktraceApp { String[] threadPrintArgs = {}; Object[] dcmdArgs = {threadPrintArgs}; String[] signature = {String[].class.getName()}; - DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); - System.out.println(dcmd.invoke("threadPrint", dcmdArgs, signature)); + System.out.println(ManagementFactory.getPlatformMBeanServer().invoke( + ObjectName.getInstance("com.sun.management:type=DiagnosticCommand"), + "threadPrint", + dcmdArgs, + signature)); // release the thread stop.countDown(); diff --git a/jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java b/jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java new file mode 100644 index 00000000000..3c806864419 --- /dev/null +++ b/jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.security.AccessControlException; +import java.security.Permission; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.List; + +/* + * @test + * @bug 8042901 + * @summary Check permission for PlatformMBeanProvider Constructor + * @author Shanliang Jiang + */ +public class PlatformMBeanProviderConstructorCheck { + public static void main(String[] args) throws Exception { + Policy origPolicy = Policy.getPolicy(); + SecurityManager origSM = System.getSecurityManager(); + try { + System.out.println("---PlatformMBeanProviderConstructorCheck starting..."); + + Policy.setPolicy(new MyPolicy()); + System.setSecurityManager(new SecurityManager()); + + System.out.println("---PlatformMBeanProviderConstructorCheck Testing without permission..."); + try { + new MyProvider(); + throw new RuntimeException("Does not get expected AccessControlException!"); + } catch (AccessControlException ace) { + System.out.println("---PlatformMBeanProviderConstructorCheck got the expected exception: " + + ace); + } + + System.out.println("---PlatformMBeanProviderConstructorCheck Testing with permission..."); + MyPolicy.allowed = true; + new MyProvider(); + + System.out.println("---PlatformMBeanProviderConstructorCheck PASSED!"); + } finally { + System.setSecurityManager(origSM); + Policy.setPolicy(origPolicy); + } + } + + private static class MyPolicy extends Policy { + private static String permName = "sun.management.spi.PlatformMBeanProvider.subclass"; + private static boolean allowed = false; + + @Override + public boolean implies(ProtectionDomain domain, Permission permission) { + if (permName.equals(permission.getName())) { + System.out.println("---MyPolicy-implies checks permission for " + +permName+" and returns "+allowed); + + return allowed; + } else { + return true; + } + } + } + + private static class MyProvider extends sun.management.spi.PlatformMBeanProvider { + @Override + public List> getPlatformComponentList() { + return null; + } + } +} From f0f9b42b17794ff6cdeb4ed7d5d3a0fcb8769b91 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 17 Apr 2015 18:15:13 +0300 Subject: [PATCH 22/63] 8057967: CallSite dependency tracking scales devastatingly poorly Reviewed-by: jrose, roland, plevart, shade --- .../classes/java/lang/invoke/CallSite.java | 55 +++++++++++++++++-- .../java/lang/invoke/MethodHandleNatives.java | 4 ++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java index 10ac1c0716e..11e452b96c9 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java @@ -25,9 +25,10 @@ package java.lang.invoke; -import sun.invoke.empty.Empty; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; +import java.lang.reflect.Field; +import sun.misc.Cleaner; /** * A {@code CallSite} is a holder for a variable {@link MethodHandle}, @@ -135,6 +136,50 @@ public class CallSite { this.target = boundTarget; } + /** + * {@code CallSite} dependency context. + * VM uses context class to store nmethod dependencies on the call site target. + * Can be in 2 states: (a) null; or (b) {@code Cleaner} instance pointing to some Class instance. + * Lazily initialized when CallSite instance is linked to some indy call site or VM needs + * it to store dependencies. As a corollary, "null" context means there are no dependencies + * registered yet. {@code Cleaner} is used in 2 roles: + * (a) context class access for VM; + * (b) stale context class cleanup. + * {@code Cleaner} holds the context class until cleanup action is finished (see {@code PhantomReference}). + * Though it's impossible to get the context class using {@code Reference.get()}, VM extracts it directly + * from {@code Reference.referent} field. + */ + private volatile Cleaner context = null; + + /** + * Default context. + * VM uses it to initialize non-linked CallSite context. + */ + private static class DefaultContext {} + private static final Cleaner DEFAULT_CONTEXT = makeContext(DefaultContext.class, null); + + private static Cleaner makeContext(Class referent, final CallSite holder) { + return Cleaner.create(referent, + new Runnable() { + @Override public void run() { + MethodHandleNatives.invalidateDependentNMethods(holder); + } + }); + } + + /** Initialize context class used for nmethod dependency tracking */ + /*package-private*/ + void initContext(Class newContext) { + // If there are concurrent actions, exactly one succeeds. + if (context == null) { + UNSAFE.compareAndSwapObject(this, CONTEXT_OFFSET, /*expected=*/null, makeContext(newContext, this)); + // No need to care about failed CAS attempt. + // Since initContext is called from indy call site linkage in newContext class, there's no risk + // that the context class becomes dead while corresponding context cleaner is alive (causing cleanup + // action in the wrong context). + } + } + /** * Returns the type of this call site's target. * Although targets may change, any call site's type is permanent, and can never change to an unequal type. @@ -246,11 +291,13 @@ public class CallSite { } // unsafe stuff: - private static final long TARGET_OFFSET; + private static final long TARGET_OFFSET; + private static final long CONTEXT_OFFSET; static { try { - TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target")); - } catch (Exception ex) { throw new Error(ex); } + TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target")); + CONTEXT_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("context")); + } catch (Exception ex) { throw newInternalError(ex); } } /*package-private*/ diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java index 0e32d397c35..3d3c47f689c 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -61,6 +61,9 @@ class MethodHandleNatives { static native void setCallSiteTargetNormal(CallSite site, MethodHandle target); static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target); + /** Invalidate CallSite context: clean up dependent nmethods and reset call site context to initial state (null). */ + static native void invalidateDependentNMethods(CallSite site); + private static native void registerNatives(); static { registerNatives(); @@ -232,6 +235,7 @@ class MethodHandleNatives { return Invokers.linkToTargetMethod(type); } else { appendixResult[0] = callSite; + callSite.initContext(caller); return Invokers.linkToCallSiteMethod(type); } } From c1b5c1b53a6e32069de818e7451b0e6153621676 Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Mon, 20 Apr 2015 08:45:54 +0200 Subject: [PATCH 23/63] 8077423: jstatd is not terminated even though it cannot contact or bind to RMI Registry Reviewed-by: sla --- .../classes/sun/tools/jstatd/Jstatd.java | 27 ++++++------ jdk/test/sun/tools/jstatd/JstatdTest.java | 43 +++++++++---------- .../jstatd/TestJstatdExternalRegistry.java | 1 + 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java index ff2cca02269..160314aa7a3 100644 --- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java +++ b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java @@ -64,15 +64,9 @@ public class Jstatd { int localport = (port < 0) ? Registry.REGISTRY_PORT : port; registry = LocateRegistry.createRegistry(localport); bind(name, remoteHost); + } else { + throw e; } - else { - System.out.println("Could not contact registry\n" - + e.getMessage()); - e.printStackTrace(); - } - } catch (RemoteException e) { - System.err.println("Could not bind " + name + " to RMI Registry"); - e.printStackTrace(); } } @@ -148,19 +142,22 @@ public class Jstatd { if (rminame != null) { System.out.println("Bad RMI server name: " + rminame); } else { - System.out.println("Bad RMI URL: " + name + " : " - + e.getMessage()); + System.out.println("Bad RMI URL: " + name); } + e.printStackTrace(System.out); System.exit(1); } catch (java.rmi.ConnectException e) { // could not attach to or create a registry - System.out.println("Could not contact RMI registry\n" - + e.getMessage()); + System.out.println("Could not contact RMI registry"); + e.printStackTrace(System.out); + System.exit(1); + } catch (RemoteException e) { + System.out.println("Could not bind " + name + " to RMI Registry"); + e.printStackTrace(System.out); System.exit(1); } catch (Exception e) { - System.out.println("Could not create remote object\n" - + e.getMessage()); - e.printStackTrace(); + System.out.println("Could not create remote object"); + e.printStackTrace(System.out); System.exit(1); } } diff --git a/jdk/test/sun/tools/jstatd/JstatdTest.java b/jdk/test/sun/tools/jstatd/JstatdTest.java index 39110123b84..cdf880d1f1e 100644 --- a/jdk/test/sun/tools/jstatd/JstatdTest.java +++ b/jdk/test/sun/tools/jstatd/JstatdTest.java @@ -135,30 +135,12 @@ public final class JstatdTest { log("Start jps", cmd); ProcessBuilder processBuilder = new ProcessBuilder(cmd); - OutputAnalyzer output = waitForJstatdRMI(processBuilder); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); System.out.println(output.getOutput()); return output; } - private OutputAnalyzer waitForJstatdRMI(ProcessBuilder pb) throws Exception { - OutputAnalyzer output = ProcessTools.executeProcess(pb); - - String remoteHost = (serverName != null) ? serverName : "JStatRemoteHost"; - while (output.getExitValue() != 0) { - String out = output.getOutput(); - - if (out.contains("RMI Registry not available") || - out.contains("RMI Server " + remoteHost + " not available")) { - Thread.sleep(100); - output = ProcessTools.executeProcess(pb); - } else { - output.shouldHaveExitValue(0); - } - } - return output; - } - /** * Verifies output form jps contains pids and programs' name information. * The function will discard any lines that come before the first line with pid. @@ -208,7 +190,7 @@ public final class JstatdTest { log("Start jstat", cmd); ProcessBuilder processBuilder = new ProcessBuilder(cmd); - OutputAnalyzer output = waitForJstatdRMI(processBuilder); + OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); System.out.println(output.getOutput()); return output; @@ -282,6 +264,9 @@ public final class JstatdTest { launcher.addToolArg("-n"); launcher.addToolArg(serverName); } + if (withExternalRegistry) { + launcher.addToolArg("-nr"); + } String[] cmd = launcher.getCommand(); log("Start jstatd", cmd); @@ -315,17 +300,21 @@ public final class JstatdTest { } public void doTest() throws Throwable { + if (useDefaultPort) { + verifyNoRmiRegistryOnDefaultPort(); + } + ProcessThread jstatdThread = null; try { while (jstatdThread == null) { - if (!useDefaultPort || withExternalRegistry) { + if (!useDefaultPort) { port = String.valueOf(Utils.getFreePort()); } if (withExternalRegistry) { Registry registry = startRegistry(); if (registry == null) { - // The port is already in use. Cancel and try with new one. + // The port is already in use. Cancel and try with a new one. continue; } } @@ -347,4 +336,14 @@ public final class JstatdTest { "jstatd process exited with unexpected exit code"); } + private void verifyNoRmiRegistryOnDefaultPort() throws Exception { + try { + Registry registry = LocateRegistry.getRegistry(); + registry.list(); + throw new Exception("There is already RMI registry on the default port: " + registry); + } catch (RemoteException e) { + // No RMI registry on default port is detected + } + } + } diff --git a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java index fdf2e484c46..eef692729e2 100644 --- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java +++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java @@ -32,6 +32,7 @@ public class TestJstatdExternalRegistry { public static void main(String[] args) throws Throwable { JstatdTest test = new JstatdTest(); + test.setUseDefaultPort(false); test.setWithExternalRegistry(true); test.doTest(); } From 999f0f1fd489a453593d2981659a178ca775b6df Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 21 Apr 2015 10:24:20 +0200 Subject: [PATCH 24/63] 8078144: many nightly tests failed due to NoSuchMethodError: sun.management.ManagementFactoryHelper.getDiagnosticMXBean Reviewed-by: alanb, sla --- .../sun/tools/jinfo/JInfoRunningProcessFlagTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java index deb3c860d63..81398d84079 100644 --- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java +++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -23,10 +23,8 @@ * questions. */ -import sun.management.ManagementFactoryHelper; - +import java.lang.management.ManagementFactory; import com.sun.management.HotSpotDiagnosticMXBean; - import jdk.testlibrary.OutputAnalyzer; import static jdk.testlibrary.Platform.isSolaris; import static jdk.testlibrary.Asserts.assertEquals; @@ -114,13 +112,15 @@ public class JInfoRunningProcessFlagTest { } private static void verifyIsEnabled(String flag) { - HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + HotSpotDiagnosticMXBean hotspotDiagnostic = + ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled"); } private static void verifyIsDisabled(String flag) { - HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + HotSpotDiagnosticMXBean hotspotDiagnostic = + ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled"); } From ad2c8376dd263a913e49c1621b5b0cb347176cd0 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 21 Apr 2015 21:06:06 +0300 Subject: [PATCH 25/63] 8078290: Customize adapted MethodHandle in MH.invoke() case Reviewed-by: jrose --- jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java index 7b7d7432996..e674829338e 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -281,7 +281,7 @@ class Invokers { outArgs[0] = names[CHECK_TYPE]; } if (CHECK_CUSTOM != -1) { - names[CHECK_CUSTOM] = new Name(NF_checkCustomized, names[CALL_MH]); + names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]); } names[LINKER_CALL] = new Name(outCallType, outArgs); lform = new LambdaForm(debugName, INARG_LIMIT, names); From 650d8b7cb65259a7fc719b5a7ba223bbbfc023fa Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Fri, 24 Apr 2015 11:01:37 +0000 Subject: [PATCH 26/63] 8075930: AARCH64: Use FP Register in C2 Modify to allow C2 to allocate FP (R29) as a general register Reviewed-by: aph, kvn, dlong --- hotspot/src/cpu/aarch64/vm/aarch64.ad | 6 +++--- hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp | 12 ------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index 9df5db4fb84..fd92690312f 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -449,7 +449,7 @@ reg_class no_special_reg32( R26 /* R27, */ // heapbase /* R28, */ // thread - /* R29, */ // fp + R29, // fp /* R30, */ // lr /* R31 */ // sp ); @@ -483,7 +483,7 @@ reg_class no_special_reg( R26, R26_H, /* R27, R27_H, */ // heapbase /* R28, R28_H, */ // thread - /* R29, R29_H, */ // fp + R29, R29_H, // fp /* R30, R30_H, */ // lr /* R31, R31_H */ // sp ); @@ -2538,7 +2538,7 @@ RegMask Matcher::modL_proj_mask() { } const RegMask Matcher::method_handle_invoke_SP_save_mask() { - return RegMask(); + return FP_REG_mask(); } // helper for encoding java_to_runtime calls on sim diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp index eb0c9a1f20c..5a9ae786638 100644 --- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp +++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp @@ -77,12 +77,6 @@ inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) { inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) { intptr_t a = intptr_t(sp); intptr_t b = intptr_t(fp); -#ifndef PRODUCT - if (fp) - if (sp > fp || (fp - sp > 0x100000)) - for(;;) - asm("nop"); -#endif _sp = sp; _unextended_sp = unextended_sp; _fp = fp; @@ -104,12 +98,6 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address inline frame::frame(intptr_t* sp, intptr_t* fp) { intptr_t a = intptr_t(sp); intptr_t b = intptr_t(fp); -#ifndef PRODUCT - if (fp) - if (sp > fp || (fp - sp > 0x100000)) - for(;;) - asm("nop"); -#endif _sp = sp; _unextended_sp = sp; _fp = fp; From a4c5e8666b4f45c9365aa7fd77fe5b9134b6d790 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 24 Apr 2015 16:28:29 +0100 Subject: [PATCH 27/63] 8078621: AARCH64: Fails to build without precompiled headers Fix #includes. Reviewed-by: kvn --- hotspot/src/cpu/aarch64/vm/aarch64.ad | 2 ++ .../src/cpu/aarch64/vm/macroAssembler_aarch64.cpp | 14 +++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index fd92690312f..956a4ac3fd0 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -758,6 +758,8 @@ definitions %{ source_hpp %{ +#include "memory/cardTableModRefBS.hpp" + class CallStubImpl { //-------------------------------------------------------------- diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index 080d25b89f8..5653e44affd 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -32,22 +32,14 @@ #include "compiler/disassembler.hpp" #include "memory/resourceArea.hpp" +#include "nativeInst_aarch64.hpp" +#include "opto/compile.hpp" +#include "opto/node.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/icache.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/sharedRuntime.hpp" -// #include "gc_interface/collectedHeap.inline.hpp" -// #include "interpreter/interpreter.hpp" -// #include "memory/cardTableModRefBS.hpp" -// #include "prims/methodHandles.hpp" -// #include "runtime/biasedLocking.hpp" -// #include "runtime/interfaceSupport.hpp" -// #include "runtime/objectMonitor.hpp" -// #include "runtime/os.hpp" -// #include "runtime/sharedRuntime.hpp" -// #include "runtime/stubRoutines.hpp" - #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" From 883ba1923651351a774d78d0c49d91d7e4d7a776 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 27 Apr 2015 10:12:56 +0200 Subject: [PATCH 28/63] 8077402: JMXStartStopTest fails intermittently on slow hosts Reviewed-by: sla, dholmes --- .../lib/testlibrary/jdk/testlibrary/ProcessTools.java | 3 ++- .../jmxremote/bootstrap/LocalManagementTest.java | 10 +++------- .../jmxremote/startstop/JMXStartStopTest.java | 10 +++++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java index 31c2e3327cc..98239775661 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java @@ -227,7 +227,8 @@ public final class ProcessTools { * The default redirects of STDOUT and STDERR are started *

* It is possible to wait for the process to get to a warmed-up state - * via {@linkplain Predicate} condition on the STDOUT + * via {@linkplain Predicate} condition on the STDOUT. The warm-up will + * wait indefinitely. *

* @param name The process name * @param processBuilder The process builder diff --git a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java index 1306f4e31a6..9abb9d38ae2 100644 --- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java +++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -120,9 +120,7 @@ public class LocalManagementTest { return true; } return false; - }, - 5, - TimeUnit.SECONDS + } ); System.out.println("Attaching test manager:"); @@ -142,9 +140,7 @@ public class LocalManagementTest { clientPrc = ProcessTools.startProcess( "TestManager", client, - (String line) -> line.startsWith("Starting TestManager for PID"), - 10, - TimeUnit.SECONDS + (String line) -> line.startsWith("Starting TestManager for PID") ); int clientExitCode = clientPrc.waitFor(); diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index 7f49fe2396d..0974ae2b7f5 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -311,9 +311,7 @@ public class JMXStartStopTest { error.set(line.contains("BindException")); return ok || error.get(); - }, - 5, - TimeUnit.SECONDS + } ); if (error.get()) { throw new BindException("Starting process failed due to " + @@ -321,8 +319,10 @@ public class JMXStartStopTest { } pid = p.getPid(); } catch (TimeoutException e) { - p.destroy(); - p.waitFor(); + if (p != null) { + p.destroy(); + p.waitFor(); + } throw e; } } From a79d202015aed15c5b68a193162ea38e4c91ea13 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Mon, 27 Apr 2015 10:13:21 +0200 Subject: [PATCH 29/63] 8076971: sun/management/jmxremote/startstop/JMXStatusTest.java failed with AssertionError Reviewed-by: sla, dholmes --- .../sun/management/jmxremote/startstop/JMXStartStopTest.java | 3 ++- jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index 0974ae2b7f5..232a97d1ce3 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -363,7 +363,8 @@ public class JMXStartStopTest { throws Exception { List pbArgs = new ArrayList<>(Arrays.asList( "-cp", - System.getProperty("test.class.path") + System.getProperty("test.class.path"), + "-XX:+UsePerfData" )); pbArgs.addAll(Arrays.asList(args)); pbArgs.add(TEST_APP_NAME); diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java index f9757762ee2..808b5a3c339 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java @@ -37,7 +37,7 @@ import jdk.testlibrary.ProcessTools; * The test asserts that the expected text is being printed. * @library /lib/testlibrary * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd - * @run testng JMXStatusTest + * @run testng/othervm -XX:+UsePerfData JMXStatusTest */ public class JMXStatusTest { private final static String TEST_APP_NAME = "TestApp"; @@ -74,6 +74,7 @@ public class JMXStatusTest { public static void setupClass() throws Exception { testAppPb = ProcessTools.createJavaProcessBuilder( "-cp", System.getProperty("test.class.path"), + "-XX:+UsePerfData", TEST_APP_NAME ); } From 9becc306efa63bedc4763114a3eb833187b5f294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 27 Apr 2015 12:27:33 +0200 Subject: [PATCH 30/63] 8066407: Function with same body not reparsed after SyntaxError Reviewed-by: attila, lagergren --- .../runtime/regexp/RegExpFactory.java | 24 +++++----- nashorn/test/script/basic/JDK-8066407.js | 48 +++++++++++++++++++ 2 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8066407.js diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java index 77b1b3dcd3e..2d37a7614c2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java @@ -26,7 +26,7 @@ package jdk.nashorn.internal.runtime.regexp; import java.util.Collections; -import java.util.Set; +import java.util.Map; import java.util.WeakHashMap; import jdk.nashorn.internal.runtime.ParserException; import jdk.nashorn.internal.runtime.options.Options; @@ -45,11 +45,10 @@ public class RegExpFactory { /** Weak cache of already validated regexps - when reparsing, we don't, for example * need to recompile (reverify) all regexps that have previously been parsed by this * RegExpFactory in a previous compilation. This saves significant time in e.g. avatar - * startup */ - private static final Set VALID_CACHE_SET = - Collections.newSetFromMap( - Collections.synchronizedMap( - new WeakHashMap())); + * startup + */ + private static final Map REGEXP_CACHE = + Collections.synchronizedMap(new WeakHashMap()); static { final String impl = Options.getStringProperty("nashorn.regexp.impl", JONI); @@ -87,7 +86,13 @@ public class RegExpFactory { * @throws ParserException if invalid source or flags */ public static RegExp create(final String pattern, final String flags) { - return instance.compile(pattern, flags); + final String key = pattern + "/" + flags; + RegExp regexp = REGEXP_CACHE.get(key); + if (regexp == null) { + regexp = instance.compile(pattern, flags); + REGEXP_CACHE.put(key, regexp); + } + return regexp; } /** @@ -98,11 +103,8 @@ public class RegExpFactory { * * @throws ParserException if invalid source or flags */ - // @SuppressWarnings({"unused"}) public static void validate(final String pattern, final String flags) throws ParserException { - if (VALID_CACHE_SET.add(pattern + flags)) { - instance.compile(pattern, flags); - } + create(pattern, flags); } /** diff --git a/nashorn/test/script/basic/JDK-8066407.js b/nashorn/test/script/basic/JDK-8066407.js new file mode 100644 index 00000000000..bc0290f5729 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8066407.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2015, 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. + */ + +/** + * JDK-8066407: Function with same body not reparsed after SyntaxError + * + * @test + * @run + */ + +function testFunction(body) { + try { + Function(body); + Assert.fail("Should have thrown"); + } catch (e) { + Assert.assertEquals(e.name, "SyntaxError"); + count++; + } + +} + +var count = 0; + +testFunction("/a/r"); +testFunction("/a/r"); +testFunction("/a/r"); + +Assert.assertTrue(count === 3); From c8634327e8517837d054e96ae9d578af998d6ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 27 Apr 2015 12:50:21 +0200 Subject: [PATCH 31/63] 8053905: Eager code generation fails for earley boyer with split threshold set to 1000 Reviewed-by: attila, lagergren --- .../internal/codegen/CodeGenerator.java | 2 +- .../internal/codegen/CompilationPhase.java | 14 +-- .../nashorn/internal/codegen/CompileUnit.java | 34 ++++++++ .../nashorn/internal/codegen/Compiler.java | 31 ++----- .../internal/codegen/TypeEvaluator.java | 3 +- .../jdk/nashorn/internal/runtime/Context.java | 47 +--------- .../internal/runtime/FunctionInitializer.java | 13 +-- .../RecompilableScriptFunctionData.java | 67 +++------------ .../internal/runtime/StoredScript.java | 86 ++++++++++++------- nashorn/test/script/basic/JDK-8053905.js | 38 ++++++++ .../test/script/basic/JDK-8053905.js.EXPECTED | 2 + .../script/basic/compile-octane-splitter.js | 5 +- 12 files changed, 159 insertions(+), 183 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8053905.js create mode 100644 nashorn/test/script/basic/JDK-8053905.js.EXPECTED diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java index 21542874cbc..2b52713b6ab 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java @@ -4526,7 +4526,7 @@ final class CodeGenerator extends NodeOperatorVisitor initializers = compiler.getFunctionInitializers(); - if (initializers != null) { - for (final Entry entry : initializers.entrySet()) { - final FunctionInitializer initializer = entry.getValue(); - initializer.setCode(installedClasses.get(initializer.getClassName())); - compiler.getScriptFunctionData(entry.getKey()).initializeCode(initializer); - } - } + unit.initializeFunctionsCode(); } if (log.isEnabled()) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java index a428e5bc5d2..86feeeda0a5 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java @@ -26,10 +26,16 @@ package jdk.nashorn.internal.codegen; import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.TreeSet; import jdk.nashorn.internal.ir.CompileUnitHolder; +import jdk.nashorn.internal.ir.FunctionNode; +import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData; /** * Used to track split class compilation. Note that instances of the class are serializable, but all fields are @@ -50,6 +56,8 @@ public final class CompileUnit implements Comparable, Serializable private transient Class clazz; + private transient Map functions = new IdentityHashMap<>(); + private transient boolean isUsed; private static int emittedUnitCount; @@ -121,6 +129,32 @@ public final class CompileUnit implements Comparable, Serializable this.classEmitter = null; } + void addFunctionInitializer(final RecompilableScriptFunctionData data, final FunctionNode functionNode) { + functions.put(functionNode, data); + } + + /** + * Returns true if this compile unit is responsible for initializing the specified function data with specified + * function node. + * @param data the function data to check + * @param functionNode the function node to check + * @return true if this unit is responsible for initializing the function data with the function node, otherwise + * false + */ + public boolean isInitializing(final RecompilableScriptFunctionData data, final FunctionNode functionNode) { + return functions.get(functionNode) == data; + } + + void initializeFunctionsCode() { + for(final Map.Entry entry : functions.entrySet()) { + entry.getValue().initializeCode(entry.getKey()); + } + } + + Collection getFunctionNodes() { + return Collections.unmodifiableCollection(functions.keySet()); + } + /** * Add weight to this compile unit * @param w weight to add diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java index 740022b2909..7cdd9be378f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java @@ -565,7 +565,7 @@ public final class Compiler implements Loggable { * @return a copy of this compiler's current mapping of invalidated optimistic program points to their types. */ public Map getInvalidatedProgramPoints() { - return invalidatedProgramPoints == null ? null : new TreeMap<>(invalidatedProgramPoints); + return invalidatedProgramPoints.isEmpty() ? null : new TreeMap<>(invalidatedProgramPoints); } TypeMap getTypeMap() { @@ -704,21 +704,6 @@ public final class Compiler implements Loggable { return sb.toString(); } - Map functionInitializers; - - void addFunctionInitializer(final RecompilableScriptFunctionData functionData, final FunctionNode functionNode) { - if (functionInitializers == null) { - functionInitializers = new HashMap<>(); - } - if (!functionInitializers.containsKey(functionData)) { - functionInitializers.put(functionData.getFunctionNodeId(), new FunctionInitializer(functionNode)); - } - } - - Map getFunctionInitializers() { - return functionInitializers; - } - /** * Persist current compilation with the given {@code cacheKey}. * @param cacheKey cache key @@ -726,15 +711,17 @@ public final class Compiler implements Loggable { */ public void persistClassInfo(final String cacheKey, final FunctionNode functionNode) { if (cacheKey != null && env._persistent_cache) { - Map initializers; // If this is an on-demand compilation create a function initializer for the function being compiled. // Otherwise use function initializer map generated by codegen. - if (functionInitializers == null) { - initializers = new HashMap<>(); - final FunctionInitializer initializer = new FunctionInitializer(functionNode, getInvalidatedProgramPoints()); - initializers.put(functionNode.getId(), initializer); + Map initializers = new HashMap<>(); + if (isOnDemandCompilation()) { + initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints())); } else { - initializers = functionInitializers; + for (final CompileUnit compileUnit : getCompileUnits()) { + for (final FunctionNode fn : compileUnit.getFunctionNodes()) { + initializers.put(fn.getId(), new FunctionInitializer(fn)); + } + } } final String mainClassName = getFirstCompileUnit().getUnitClassName(); installer.storeScript(cacheKey, source, mainClassName, bytecode, initializers, constantData.toArray(), compilationId); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeEvaluator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeEvaluator.java index d5282a8b9db..ba9d7fd6aa2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeEvaluator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeEvaluator.java @@ -227,7 +227,8 @@ final class TypeEvaluator { // gradually introduce them as needed. An easy one would be to do the same for .call(this) idiom. final CallNode callExpr = (CallNode)expr; final Expression fnExpr = callExpr.getFunction(); - if (fnExpr instanceof FunctionNode) { + // Skip evaluation if running with eager compilation as we may violate constraints in RecompilableScriptFunctionData + if (fnExpr instanceof FunctionNode && compiler.getContext().getEnv()._lazy_compilation) { final FunctionNode fn = (FunctionNode)fnExpr; if (callExpr.getArgs().isEmpty()) { final RecompilableScriptFunctionData data = compiler.getScriptFunctionData(fn.getId()); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java index 5c4bbd662f5..d3289b2a20e 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java @@ -1281,7 +1281,7 @@ public final class Context { compiler.persistClassInfo(cacheKey, compiledFunction); } else { Compiler.updateCompilationId(storedScript.getCompilationId()); - script = install(storedScript, source, installer); + script = storedScript.installScript(source, installer); } cacheClass(source, script); @@ -1302,51 +1302,6 @@ public final class Context { return uniqueScriptId.getAndIncrement(); } - /** - * Install a previously compiled class from the code cache. - * - * @param storedScript cached script containing class bytes and constants - * @return main script class - */ - private static Class install(final StoredScript storedScript, final Source source, final CodeInstaller installer) { - - final Map> installedClasses = new HashMap<>(); - final Map classBytes = storedScript.getClassBytes(); - final Object[] constants = storedScript.getConstants(); - final String mainClassName = storedScript.getMainClassName(); - final byte[] mainClassBytes = classBytes.get(mainClassName); - final Class mainClass = installer.install(mainClassName, mainClassBytes); - final Map initializers = storedScript.getInitializers(); - - installedClasses.put(mainClassName, mainClass); - - for (final Map.Entry entry : classBytes.entrySet()) { - final String className = entry.getKey(); - if (className.equals(mainClassName)) { - continue; - } - final byte[] code = entry.getValue(); - - installedClasses.put(className, installer.install(className, code)); - } - - installer.initialize(installedClasses.values(), source, constants); - - for (final Object constant : constants) { - if (constant instanceof RecompilableScriptFunctionData) { - final RecompilableScriptFunctionData data = (RecompilableScriptFunctionData) constant; - data.initTransients(source, installer); - final FunctionInitializer initializer = initializers.get(data.getFunctionNodeId()); - if (initializer != null) { - initializer.setCode(installedClasses.get(initializer.getClassName())); - data.initializeCode(initializer); - } - } - } - - return mainClass; - } - /** * Cache for compiled script classes. */ diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java index 906024d7ffa..a2139ccafc4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java @@ -59,17 +59,6 @@ public final class FunctionInitializer implements Serializable { this(functionNode, null); } - /** - * Copy constructor. - * - * @param init original initializer - */ - FunctionInitializer(final FunctionInitializer init) { - this.className = init.getClassName(); - this.methodType = init.getMethodType(); - this.flags = init.getFlags(); - } - /** * Constructor. * @@ -130,7 +119,7 @@ public final class FunctionInitializer implements Serializable { * Set the class implementing the function * @param code the class */ - public void setCode(final Class code) { + void setCode(final Class code) { // Make sure code has not been set and has expected class name if (this.code != null) { throw new IllegalStateException("code already set"); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java index c65b031e010..3217c1c450b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java @@ -32,7 +32,6 @@ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -503,7 +502,7 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp if (script != null) { Compiler.updateCompilationId(script.getCompilationId()); - return installStoredScript(script, newInstaller); + return script.installFunction(this, newInstaller); } } @@ -518,56 +517,6 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp return new FunctionInitializer(compiledFn, compiler.getInvalidatedProgramPoints()); } - private static Map> installStoredScriptClasses(final StoredScript script, final CodeInstaller installer) { - final Map> installedClasses = new HashMap<>(); - final Map classBytes = script.getClassBytes(); - final String mainClassName = script.getMainClassName(); - final byte[] mainClassBytes = classBytes.get(mainClassName); - - final Class mainClass = installer.install(mainClassName, mainClassBytes); - - installedClasses.put(mainClassName, mainClass); - - for (final Map.Entry entry : classBytes.entrySet()) { - final String className = entry.getKey(); - final byte[] bytecode = entry.getValue(); - - if (className.equals(mainClassName)) { - continue; - } - - installedClasses.put(className, installer.install(className, bytecode)); - } - return installedClasses; - } - - /** - * Install this script using the given {@code installer}. - * - * @param script the compiled script - * @return the function initializer - */ - private FunctionInitializer installStoredScript(final StoredScript script, final CodeInstaller newInstaller) { - final Map> installedClasses = installStoredScriptClasses(script, newInstaller); - - final Map initializers = script.getInitializers(); - assert initializers != null; - assert initializers.size() == 1; - final FunctionInitializer initializer = initializers.values().iterator().next(); - - final Object[] constants = script.getConstants(); - for (int i = 0; i < constants.length; i++) { - if (constants[i] instanceof RecompilableScriptFunctionData) { - // replace deserialized function data with the ones we already have - constants[i] = getScriptFunctionData(((RecompilableScriptFunctionData) constants[i]).getFunctionNodeId()); - } - } - - newInstaller.initialize(installedClasses.values(), source, constants); - initializer.setCode(installedClasses.get(initializer.getClassName())); - return initializer; - } - boolean usePersistentCodeCache() { final ScriptEnvironment env = installer.getOwner(); return env._persistent_cache && env._optimistic_types; @@ -645,13 +594,21 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp * by the compiler internals in Nashorn and is public for implementation reasons only. Attempting to invoke it * externally will result in an exception. * - * @param initializer FunctionInitializer for this data + * @param functionNode FunctionNode for this data */ - public void initializeCode(final FunctionInitializer initializer) { + public void initializeCode(final FunctionNode functionNode) { // Since the method is public, we double-check that we aren't invoked with an inappropriate compile unit. - if(!code.isEmpty()) { + if (!code.isEmpty() || functionNode.getId() != functionNodeId || !functionNode.getCompileUnit().isInitializing(this, functionNode)) { throw new IllegalStateException(name); } + addCode(lookup(functionNode), null, null, functionNode.getFlags()); + } + + /** + * Initializes this function with the given function code initializer. + * @param initializer function code initializer + */ + void initializeCode(final FunctionInitializer initializer) { addCode(lookup(initializer, true), null, null, initializer.getFlags()); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java index b36cec8b9d1..66153e28337 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java @@ -27,7 +27,7 @@ package jdk.nashorn.internal.runtime; import java.io.Serializable; import java.util.Arrays; -import java.util.LinkedHashMap; +import java.util.HashMap; import java.util.Map; /** @@ -77,44 +77,70 @@ public final class StoredScript implements Serializable { return compilationId; } - /** - * Returns the main class name. - * @return the main class name - */ - public String getMainClassName() { - return mainClassName; - } + private Map> installClasses(final Source source, final CodeInstaller installer) { + final Map> installedClasses = new HashMap<>(); + final byte[] mainClassBytes = classBytes.get(mainClassName); + final Class mainClass = installer.install(mainClassName, mainClassBytes); + + installedClasses.put(mainClassName, mainClass); - /** - * Returns a map of class names to class bytes. - * @return map of class bytes - */ - public Map getClassBytes() { - final Map clonedMap = new LinkedHashMap<>(); for (final Map.Entry entry : classBytes.entrySet()) { - clonedMap.put(entry.getKey(), entry.getValue().clone()); + final String className = entry.getKey(); + + if (!className.equals(mainClassName)) { + installedClasses.put(className, installer.install(className, entry.getValue())); + } } - return clonedMap; + + installer.initialize(installedClasses.values(), source, constants); + return installedClasses; + } + + FunctionInitializer installFunction(final RecompilableScriptFunctionData data, final CodeInstaller installer) { + final Map> installedClasses = installClasses(data.getSource(), installer); + + assert initializers != null; + assert initializers.size() == 1; + final FunctionInitializer initializer = initializers.values().iterator().next(); + + for (int i = 0; i < constants.length; i++) { + if (constants[i] instanceof RecompilableScriptFunctionData) { + // replace deserialized function data with the ones we already have + final RecompilableScriptFunctionData newData = data.getScriptFunctionData(((RecompilableScriptFunctionData) constants[i]).getFunctionNodeId()); + assert newData != null; + newData.initTransients(data.getSource(), installer); + constants[i] = newData; + } + } + + initializer.setCode(installedClasses.get(initializer.getClassName())); + return initializer; } /** - * Returns the constants array. - * @return constants array + * Install as script. + * + * @param source the source + * @param installer the installer + * @return main script class */ - public Object[] getConstants() { - return constants.clone(); - } + Class installScript(final Source source, final CodeInstaller installer) { - /** - * Returns the function initializers map. - * @return The initializers map. - */ - public Map getInitializers() { - final Map clonedMap = new LinkedHashMap<>(); - for (final Map.Entry entry : initializers.entrySet()) { - clonedMap.put(entry.getKey(), new FunctionInitializer(entry.getValue())); + final Map> installedClasses = installClasses(source, installer); + + for (final Object constant : constants) { + if (constant instanceof RecompilableScriptFunctionData) { + final RecompilableScriptFunctionData data = (RecompilableScriptFunctionData) constant; + data.initTransients(source, installer); + final FunctionInitializer initializer = initializers.get(data.getFunctionNodeId()); + if (initializer != null) { + initializer.setCode(installedClasses.get(initializer.getClassName())); + data.initializeCode(initializer); + } + } } - return clonedMap; + + return installedClasses.get(mainClassName); } @Override diff --git a/nashorn/test/script/basic/JDK-8053905.js b/nashorn/test/script/basic/JDK-8053905.js new file mode 100644 index 00000000000..aa6c9db2d6f --- /dev/null +++ b/nashorn/test/script/basic/JDK-8053905.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * JDK-8053905: Eager code generation fails for earley boyer with split threshold set to 1000 + * + * @test + * @runif external.octane + * @fork + * @option -Dnashorn.compiler.splitter.threshold=1000 + * @option -scripting + * @option --lazy-compilation=false + */ + +var fn = __DIR__ + 'compile-octane.js'; +arguments.push("earley-boyer"); // run only earley-boyer +var url = new java.io.File(fn).toURL(); +load(url); diff --git a/nashorn/test/script/basic/JDK-8053905.js.EXPECTED b/nashorn/test/script/basic/JDK-8053905.js.EXPECTED new file mode 100644 index 00000000000..d8c6c887ae0 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8053905.js.EXPECTED @@ -0,0 +1,2 @@ +Compiling 'earley-boyer'... +Done. diff --git a/nashorn/test/script/basic/compile-octane-splitter.js b/nashorn/test/script/basic/compile-octane-splitter.js index 58c5966a2a7..4fffaa85476 100644 --- a/nashorn/test/script/basic/compile-octane-splitter.js +++ b/nashorn/test/script/basic/compile-octane-splitter.js @@ -29,11 +29,10 @@ * forever, so make this test future safe, we specify them explicitly * * @test - * @fork - * @option -Dnashorn.compiler.splitter.threshold=1000 - * @fork * @runif external.octane + * @fork * @option -scripting + * @option -Dnashorn.compiler.splitter.threshold=1000 * @option -Dnashorn.typeInfo.disabled=true * @option --class-cache-size=0 * @option --persistent-code-cache=false From b97b136530213450a535b119429c5e011ff6bf2e Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 27 Apr 2015 16:31:29 +0200 Subject: [PATCH 32/63] 8077605: Initializing static fields causes unbounded recursion in javac Improving detection of potential constant variable initializers; preventing infinite recursion on exception during Attr.visitLambda. Reviewed-by: mcimadamore, vromero --- .../com/sun/tools/javac/comp/Attr.java | 5 + .../com/sun/tools/javac/comp/MemberEnter.java | 58 ++++++---- .../lambda/AvoidInfiniteReattribution.java | 107 ++++++++++++++++++ .../test/tools/javac/lambda/T8077605.java | 43 +++++++ 4 files changed, 190 insertions(+), 23 deletions(-) create mode 100644 langtools/test/tools/javac/lambda/AvoidInfiniteReattribution.java create mode 100644 langtools/test/tools/javac/lambda/T8077605.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 310786bc04d..5c0ed141f2c 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2425,6 +2425,11 @@ public class Attr extends JCTree.Visitor { resultInfo.checkContext.report(that, cause); result = that.type = types.createErrorType(pt()); return; + } catch (Throwable t) { + //when an unexpected exception happens, avoid attempts to attribute the same tree again + //as that would likely cause the same exception again. + needsRecovery = false; + throw t; } finally { localEnv.info.scope.leave(); if (needsRecovery) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 46b65e5be4d..48ebd8e74ca 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -25,6 +25,9 @@ package com.sun.tools.javac.comp; +import java.util.EnumSet; +import java.util.Set; + import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.tree.*; @@ -335,43 +338,49 @@ public class MemberEnter extends JCTree.Visitor { return initTreeVisitor.result; } - /** Visitor class for expressions which might be constant expressions. + /** Visitor class for expressions which might be constant expressions, + * as per JLS 15.28 (Constant Expressions). */ static class InitTreeVisitor extends JCTree.Visitor { + private static final Set ALLOWED_OPERATORS = + EnumSet.of(Tag.POS, Tag.NEG, Tag.NOT, Tag.COMPL, Tag.PLUS, Tag.MINUS, + Tag.MUL, Tag.DIV, Tag.MOD, Tag.SL, Tag.SR, Tag.USR, + Tag.LT, Tag.LE, Tag.GT, Tag.GE, Tag.EQ, Tag.NE, + Tag.BITAND, Tag.BITXOR, Tag.BITOR, Tag.AND, Tag.OR); + private boolean result = true; @Override - public void visitTree(JCTree tree) {} - - @Override - public void visitNewClass(JCNewClass that) { + public void visitTree(JCTree tree) { result = false; } @Override - public void visitNewArray(JCNewArray that) { - result = false; + public void visitLiteral(JCLiteral that) {} + + @Override + public void visitTypeCast(JCTypeCast tree) { + tree.expr.accept(this); } @Override - public void visitLambda(JCLambda that) { - result = false; + public void visitUnary(JCUnary that) { + if (!ALLOWED_OPERATORS.contains(that.getTag())) { + result = false; + return ; + } + that.arg.accept(this); } @Override - public void visitReference(JCMemberReference that) { - result = false; - } - - @Override - public void visitApply(JCMethodInvocation that) { - result = false; - } - - @Override - public void visitSelect(JCFieldAccess tree) { - tree.selected.accept(this); + public void visitBinary(JCBinary that) { + if (!ALLOWED_OPERATORS.contains(that.getTag())) { + result = false; + return ; + } + that.lhs.accept(this); + that.rhs.accept(this); } @Override @@ -387,8 +396,11 @@ public class MemberEnter extends JCTree.Visitor { } @Override - public void visitTypeCast(JCTypeCast tree) { - tree.expr.accept(this); + public void visitIdent(JCIdent that) {} + + @Override + public void visitSelect(JCFieldAccess tree) { + tree.selected.accept(this); } } diff --git a/langtools/test/tools/javac/lambda/AvoidInfiniteReattribution.java b/langtools/test/tools/javac/lambda/AvoidInfiniteReattribution.java new file mode 100644 index 00000000000..ed17821912d --- /dev/null +++ b/langtools/test/tools/javac/lambda/AvoidInfiniteReattribution.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2015, 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 8077605 + * @summary Check that when an exception occurs during Attr.visitLambda, an attempt to attribute + the lambda again is avoided rather than falling into an infinite recursion. + */ + +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import java.util.List; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; + +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.comp.Attr; +import com.sun.tools.javac.tree.JCTree.JCVariableDecl; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.Context.Factory; + +public class AvoidInfiniteReattribution { + + public static void main(String... args) throws Exception { + new AvoidInfiniteReattribution().run(); + } + + void run() throws IOException { + JavacTool tool = JavacTool.create(); + JavaSource source = new JavaSource("class Test {" + + " I i = STOP -> {};" + + " interface I {" + + " public void test(int i) {}" + + " }" + + "}"); + Context context = new Context(); + CrashingAttr.preRegister(context); + List inputs = Arrays.asList(source); + JavacTaskImpl task = + (JavacTaskImpl) tool.getTask(null, null, null, null, null, inputs, context); + try { + task.analyze(null); + throw new AssertionError("Expected exception not seen."); + } catch (StopException ex) { + //ok + } + } + + static class CrashingAttr extends Attr { + + static void preRegister(Context context) { + context.put(attrKey, (Factory) c -> new CrashingAttr(c)); + } + + CrashingAttr(Context context) { + super(context); + } + + @Override public void visitVarDef(JCVariableDecl tree) { + if (tree.name.contentEquals("STOP")) + throw new StopException(); + super.visitVarDef(tree); + } + } + + static class StopException extends NullPointerException {} + + class JavaSource extends SimpleJavaFileObject { + + String source; + + JavaSource(String source) { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + this.source = source; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source; + } + + } + +} diff --git a/langtools/test/tools/javac/lambda/T8077605.java b/langtools/test/tools/javac/lambda/T8077605.java new file mode 100644 index 00000000000..a3591311680 --- /dev/null +++ b/langtools/test/tools/javac/lambda/T8077605.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2015, 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 8077605 + * @summary Lambda with parameters in field initializer should not break compilation + * (MemberEnter.needsLazyConstValue should detect the initializer cannot be a constant) + * @compile T8077605.java + */ + +public class T8077605 { + static final String C = "" + m(str -> str); + + private static String m(I function) { + return null; + } + + interface I { + public String run(String str); + } +} + From 8abeeabcef2311ce7bdfa4debf03008e43680f3a Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Mon, 27 Apr 2015 09:02:48 -0700 Subject: [PATCH 33/63] 8022853: add ability to load uncompressed object and Klass references in a compressed environment to Unsafe Reviewed-by: coleenp, jrose, kvn --- .../share/classes/sun/misc/Unsafe.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java index ccbe0ed1d0e..1d3454e281e 100644 --- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java +++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java @@ -183,7 +183,7 @@ public final class Unsafe { *

* Unless the reference {@code x} being stored is either null * or matches the field type, the results are undefined. - * If the reference {@code o} is non-null, car marks or + * If the reference {@code o} is non-null, card marks or * other store barriers for that object (if the VM requires them) * are updated. * @see #putInt(Object, long, int) @@ -219,6 +219,35 @@ public final class Unsafe { /** @see #putInt(Object, long, int) */ public native void putDouble(Object o, long offset, double x); + // These read VM internal data. + + /** + * Fetches an uncompressed reference value from a given native variable + * ignoring the VM's compressed references mode. + * + * @param address a memory address locating the variable + * @return the value fetched from the indicated native variable + */ + public native Object getUncompressedObject(long address); + + /** + * Fetches the {@link java.lang.Class} Java mirror for the given native + * metaspace {@code Klass} pointer. + * + * @param metaspaceKlass a native metaspace {@code Klass} pointer + * @return the {@link java.lang.Class} Java mirror + */ + public native Class getJavaMirror(long metaspaceKlass); + + /** + * Fetches a native metaspace {@code Klass} pointer for the given Java + * object. + * + * @param o Java heap object for which to fetch the class pointer + * @return a native metaspace {@code Klass} pointer + */ + public native long getKlassPointer(Object o); + // These work on values in the C heap. /** From 153dc079bb94e4c84f348ec249e0fe65cb28a42e Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Tue, 28 Apr 2015 11:08:25 +0300 Subject: [PATCH 34/63] 8044537: Implement classfile tests for Synthetic attribute Reviewed-by: jjg, shurailine, anazarov --- .../AccessToPrivateInnerClassMembersTest.java | 92 ++++++++ .../AccessToPrivateSiblingsTest.java | 109 +++++++++ .../attributes/Synthetic/AssertFieldTest.java | 45 ++++ .../BridgeMethodForGenericMethodTest.java | 48 ++++ .../Synthetic/BridgeMethodsForLambdaTest.java | 122 ++++++++++ .../attributes/Synthetic/EnumTest.java | 44 ++++ .../attributes/Synthetic/ExpectedClass.java | 36 +++ .../attributes/Synthetic/ExpectedClasses.java | 30 +++ .../attributes/Synthetic/PackageInfoTest.java | 36 +++ .../Synthetic/SyntheticTestDriver.java | 210 ++++++++++++++++++ .../attributes/Synthetic/ThisFieldTest.java | 54 +++++ .../package_info_test/package-info.java | 24 ++ 12 files changed, 850 insertions(+) create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClass.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClasses.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java create mode 100644 langtools/test/tools/javac/classfiles/attributes/Synthetic/package_info_test/package-info.java diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java new file mode 100644 index 00000000000..385641aa501 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for access method +* generated to access to private methods and fields. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build AccessToPrivateInnerClassMembersTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver AccessToPrivateInnerClassMembersTest 1 + */ + +/** + * Access from top level class to inner classes. + * Synthetic members: + * 1. inner classes for Inner*. + * 2. getter/setter for private field var. + * 3. access method for private method function(). + * 4. getter/setter for private field staticVar. + * 5. access method for private method staticFunction(). + * 6. field this in Inner1. + * 7. constructor for Inner*. + */ +@ExpectedClass(className = "AccessToPrivateInnerClassMembersTest", + expectedMethods = {"()", "()"}) +@ExpectedClass(className = "AccessToPrivateInnerClassMembersTest$Inner1", + expectedMethods = {"(AccessToPrivateInnerClassMembersTest)", "function()"}, + expectedFields = "var", + expectedNumberOfSyntheticMethods = 4, + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "AccessToPrivateInnerClassMembersTest$Inner2", + expectedMethods = {"function()", "staticFunction()", "()"}, + expectedFields = {"staticVar", "var"}, + expectedNumberOfSyntheticMethods = 7) +public class AccessToPrivateInnerClassMembersTest { + + private class Inner1 { + private Inner1() {} + private int var; + private void function() {} + } + + { + Inner1 inner = new Inner1(); + inner.var = 0; + int i = inner.var; + inner.function(); + } + + private static class Inner2 { + private Inner2() {} + private int var; + private static int staticVar; + private void function() {} + private static void staticFunction() {} + } + + { + Inner2 inner = new Inner2(); + inner.var = 0; + int i = inner.var; + inner.function(); + } + + static { + Inner2.staticFunction(); + Inner2.staticVar = 0; + int i = Inner2.staticVar; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java new file mode 100644 index 00000000000..f82bcf8bddd --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for access method + * generated to access to private methods and fields. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build AccessToPrivateSiblingsTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver AccessToPrivateSiblingsTest 1 + */ + +/** + * Access from sibling classes to sibling classes. + * Synthetic members: + * 1. inner classes for Inner*. + * 2. getter/setter for private field var. + * 3. access method for private method function(). + * 4. getter/setter for private field staticVar. + * 5. access method for private method staticFunction(). + * 6. field this in Inner1. + * 7. constructor for Inner*. + */ +@ExpectedClass(className = "AccessToPrivateSiblingsTest", expectedMethods = "()") +@ExpectedClass(className = "AccessToPrivateSiblingsTest$Inner1", + expectedMethods = {"function()", "(AccessToPrivateSiblingsTest)"}, + expectedFields = "var", + expectedNumberOfSyntheticMethods = 4, + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "AccessToPrivateSiblingsTest$Inner2", + expectedMethods = "(AccessToPrivateSiblingsTest)", + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "AccessToPrivateSiblingsTest$Inner3", + expectedMethods = {"()", "function()", "staticFunction()", "()"}, + expectedFields = {"var", "staticVar"}, + expectedNumberOfSyntheticMethods = 4) +@ExpectedClass(className = "AccessToPrivateSiblingsTest$Inner4", + expectedMethods = {"()", "function()", "staticFunction()"}, + expectedFields = {"var", "staticVar"}, + expectedNumberOfSyntheticMethods = 4) +public class AccessToPrivateSiblingsTest { + + private class Inner1 { + private Inner1() {} + private int var; + private void function() {} + + { + Inner3 inner = new Inner3(); + inner.var = 0; + int i = inner.var; + inner.function(); + } + } + + private class Inner2 { + { + Inner1 inner = new Inner1(); + inner.var = 0; + int i = inner.var; + inner.function(); + } + } + + private static class Inner3 { + private Inner3() {} + private int var; + private static int staticVar; + private void function() {} + private static void staticFunction() {} + + static { + Inner4 inner = new Inner4(); + inner.var = 0; + int i = inner.var; + inner.function(); + } + } + + private static class Inner4 { + private Inner4() {} + private int var; + private static int staticVar; + private void function() {} + private static void staticFunction() {} + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java new file mode 100644 index 00000000000..fa8e8395bff --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for assert statement. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build AssertFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver AssertFieldTest + */ + +/** + * Synthetic field for assert. + */ +@ExpectedClass(className = "AssertFieldTest", + expectedMethods = {"()", "function(boolean)", "()"}, + expectedNumberOfSyntheticFields = 1) +public class AssertFieldTest { + + public void function(boolean flag) { + assert flag; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java new file mode 100644 index 00000000000..18a00e2e066 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for bridge method generated for generic method. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build BridgeMethodForGenericMethodTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver BridgeMethodForGenericMethodTest + */ + +import java.util.ArrayList; + +/** + * Synthetic method add(Object i) for method add(Integer) + */ +@ExpectedClass(className = "BridgeMethodForGenericMethodTest", + expectedMethods = {"()", "add(java.lang.Integer)"}, + expectedNumberOfSyntheticMethods = 1) +public class BridgeMethodForGenericMethodTest extends ArrayList { + + @Override + public boolean add(Integer i) { + return true; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java new file mode 100644 index 00000000000..6c32fa54737 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for bridge method + * generated for lambda expressions and method references. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build BridgeMethodsForLambdaTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver BridgeMethodsForLambdaTest 1 + */ + +import java.util.Comparator; +import java.util.stream.IntStream; + +/** + * Synthetic members: + * 1. inner class for Inner1. + * 2. method for () -> {} in Inner1 + * 3. method for () -> {} in Inner2 + * 4. method references to private methods. + * 5. method for super::function() + * 6. method references to private static methods. + * 7. access method for private method function(). + * 8. access method for private static method staticFunction(). + * 9. method reference to vararg method. + * 10. method reference to array's method. + * 11. constructors for Inner1 and Inner2. + */ +@ExpectedClass(className = "BridgeMethodsForLambdaTest", + expectedMethods = {"()", "()", "function(java.lang.Integer[])"}, + expectedNumberOfSyntheticMethods = 6) +@ExpectedClass(className = "BridgeMethodsForLambdaTest$Inner1", + expectedMethods = {"(BridgeMethodsForLambdaTest)", "function()", "run()"}, + expectedFields = "lambda1", + expectedNumberOfSyntheticMethods = 4, + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "BridgeMethodsForLambdaTest$Inner2", + expectedMethods = {"()", "staticFunction()"}, + expectedFields = "lambda1", + expectedNumberOfSyntheticMethods = 3) +@ExpectedClass(className = "BridgeMethodsForLambdaTest$Inner3", + expectedMethods = {"(BridgeMethodsForLambdaTest)", "function()"}, + expectedNumberOfSyntheticMethods = 1, + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "BridgeMethodsForLambdaTest$Inner4", + expectedMethods = {"(BridgeMethodsForLambdaTest)", "function()"}, + expectedNumberOfSyntheticMethods = 1, + expectedNumberOfSyntheticFields = 1) +public class BridgeMethodsForLambdaTest { + + private class Inner1 implements Runnable { + private Inner1() { + } + private Runnable lambda1 = () -> { + }; + private void function() { + } + @Override + public void run() { + } + } + + private static class Inner2 { + private Runnable lambda1 = () -> { + }; + private static void staticFunction() { + } + } + + private class Inner3 { + public void function() { + } + } + + private class Inner4 extends Inner3 { + @Override + public void function() { + Runnable r = super::function; + } + } + + private static int function(Integer...vararg) { + return 0; + } + + { + Inner1 inner = new Inner1(); + Runnable l1 = inner::function; + Runnable l2 = Inner1::new; + inner.lambda1 = inner::function; + Comparator c = BridgeMethodsForLambdaTest::function; + IntStream.of(2).mapToObj(int[]::new); + } + + static { + Inner2 inner = new Inner2(); + Runnable l1 = Inner2::staticFunction; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java new file mode 100644 index 00000000000..41226d38192 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/EnumTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for enum members. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build EnumTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver EnumTest + */ + +/** + * Synthetic members: + * 1. field $VALUES. + */ +@ExpectedClass(className = "EnumTest", + expectedMethods = {"values()", "valueOf(java.lang.String)", "()", "(java.lang.String, int)"}, + expectedFields = {"A", "B"}, + expectedNumberOfSyntheticFields = 1) +public enum EnumTest { + A, B +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClass.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClass.java new file mode 100644 index 00000000000..9ac7ec29d15 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClass.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Repeatable(ExpectedClasses.class) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExpectedClass { + String className(); + String[] expectedMethods() default {}; + String[] expectedFields() default {}; + int expectedNumberOfSyntheticMethods() default 0; + int expectedNumberOfSyntheticFields() default 0; +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClasses.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClasses.java new file mode 100644 index 00000000000..43e1631f243 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ExpectedClasses.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface ExpectedClasses { + ExpectedClass[] value(); +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java new file mode 100644 index 00000000000..055cf691f10 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for package-info. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build SyntheticTestDriver ExpectedClass ExpectedClasses + * @compile -Xpkginfo:always package_info_test/package-info.java + * @run main SyntheticTestDriver package_info_test.package-info 1 + */ + +public class PackageInfoTest { +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java new file mode 100644 index 00000000000..69a056c97d7 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.sun.tools.classfile.*; + +/** + * The tests work as follows. Firstly, it looks through the test cases + * and extracts the appropriate compiled classes. Each test case contains + * a set of expected classes, methods and fields. Those class members must not have + * the Synthetic attribute, while other found classes, methods and fields must have + * the Synthetic attribute if they are not in the set of expected class members. + * + * Each test executes SyntheticTestDriver specifying the name of test cases and + * the number of expected synthetic classes. Each test class is annotated by + * annotations which contains non-synthetic class members. + * + * See the appropriate class for more information about a test case. + */ +public class SyntheticTestDriver extends TestResult { + + private static final String ACC_SYNTHETIC = "ACC_SYNTHETIC"; + + private final String testCaseName; + private final Map classes; + private final Map expectedClasses; + + public static void main(String[] args) + throws TestFailedException, ConstantPoolException, IOException, ClassNotFoundException { + if (args.length != 1 && args.length != 2) { + throw new IllegalArgumentException("Usage: SyntheticTestDriver []"); + } + int numberOfSyntheticClasses = args.length == 1 ? 0 : Integer.parseInt(args[1]); + new SyntheticTestDriver(args[0]).test(numberOfSyntheticClasses); + } + + public SyntheticTestDriver(String testCaseName) throws IOException, ConstantPoolException, ClassNotFoundException { + Class clazz = Class.forName(testCaseName); + this.testCaseName = testCaseName; + this.expectedClasses = Stream.of(clazz.getAnnotationsByType(ExpectedClass.class)) + .collect(Collectors.toMap(ExpectedClass::className, Function.identity())); + this.classes = new HashMap<>(); + Path classDir = getClassDir().toPath(); + String sourceFileName = testCaseName.replace('.', '/'); + List paths = Files.walk(classDir) + .map(p -> classDir.relativize(p.toAbsolutePath())) + .filter(p -> p.toString().matches(sourceFileName + ".*\\.class")) + .collect(Collectors.toList()); + for (Path path : paths) { + String className = path.toString().replace(".class", "").replace('/', '.'); + classes.put(className, readClassFile(classDir.resolve(path).toFile())); + } + if (classes.isEmpty()) { + throw new RuntimeException("Classes have not been found."); + } + boolean success = classes.entrySet().stream() + .allMatch(e -> e.getKey().startsWith(testCaseName)); + if (!success) { + classes.forEach((className, $) -> printf("Found class: %s\n", className)); + throw new RuntimeException("Found classes are not from the test case : " + testCaseName); + } + } + + private String getMethodName(ClassFile classFile, Method method) + throws ConstantPoolException, Descriptor.InvalidDescriptor { + String methodName = method.getName(classFile.constant_pool); + String parameters = method.descriptor.getParameterTypes(classFile.constant_pool); + return methodName + parameters; + } + + public void test(int expectedNumberOfSyntheticClasses) throws TestFailedException { + try { + addTestCase(testCaseName); + Set foundClasses = new HashSet<>(); + + int numberOfSyntheticClasses = 0; + for (Map.Entry entry : classes.entrySet()) { + String className = entry.getKey(); + ClassFile classFile = entry.getValue(); + foundClasses.add(className); + if (testAttribute( + classFile, + () -> (Synthetic_attribute) classFile.getAttribute(Attribute.Synthetic), + classFile.access_flags::getClassFlags, + expectedClasses.keySet(), + className, + "Testing class " + className)) { + ++numberOfSyntheticClasses; + } + ExpectedClass expectedClass = expectedClasses.get(className); + Set expectedMethods = expectedClass != null + ? toSet(expectedClass.expectedMethods()) + : new HashSet<>(); + int numberOfSyntheticMethods = 0; + Set foundMethods = new HashSet<>(); + for (Method method : classFile.methods) { + String methodName = getMethodName(classFile, method); + foundMethods.add(methodName); + if (testAttribute( + classFile, + () -> (Synthetic_attribute) method.attributes.get(Attribute.Synthetic), + method.access_flags::getMethodFlags, + expectedMethods, + methodName, + "Testing method " + methodName + " in class " + + className)) { + ++numberOfSyntheticMethods; + } + } + checkContains(foundMethods, expectedMethods, + "Checking that all methods of class " + className + + " without Synthetic attribute have been found"); + checkEquals(numberOfSyntheticMethods, + expectedClass == null ? 0 : expectedClass.expectedNumberOfSyntheticMethods(), + "Checking number of synthetic methods in class: " + className); + + Set expectedFields = expectedClass != null + ? toSet(expectedClass.expectedFields()) + : new HashSet<>(); + int numberOfSyntheticFields = 0; + Set foundFields = new HashSet<>(); + for (Field field : classFile.fields) { + String fieldName = field.getName(classFile.constant_pool); + foundFields.add(fieldName); + if (testAttribute( + classFile, + () -> (Synthetic_attribute) field.attributes.get(Attribute.Synthetic), + field.access_flags::getFieldFlags, + expectedFields, + fieldName, + "Testing field " + fieldName + " in class " + + className)) { + ++numberOfSyntheticFields; + } + } + checkContains(foundFields, expectedFields, + "Checking that all fields of class " + className + + " without Synthetic attribute have been found"); + checkEquals(numberOfSyntheticFields, + expectedClass == null ? 0 : expectedClass.expectedNumberOfSyntheticFields(), + "Checking number of synthetic fields in class: " + className); + } + checkContains(foundClasses, expectedClasses.keySet(), + "Checking that all classes have been found"); + checkEquals(numberOfSyntheticClasses, expectedNumberOfSyntheticClasses, + "Checking number of synthetic classes"); + } catch (Exception e) { + addFailure(e); + } finally { + checkStatus(); + } + } + + private boolean testAttribute(ClassFile classFile, + Supplier getSyntheticAttribute, + Supplier> getAccessFlags, + Set expectedMembers, String memberName, + String info) throws ConstantPoolException { + echo(info); + String className = classFile.getName(); + Synthetic_attribute attr = getSyntheticAttribute.get(); + Set flags = getAccessFlags.get(); + if (expectedMembers.contains(memberName)) { + checkNull(attr, "Member must not have synthetic attribute : " + + memberName); + checkFalse(flags.contains(ACC_SYNTHETIC), + "Member must not have synthetic flag : " + memberName + + " in class : " + className); + return false; + } else { + return checkNull(attr, "Synthetic attribute should not be generated") + && checkTrue(flags.contains(ACC_SYNTHETIC), "Member must have synthetic flag : " + + memberName + " in class : " + className); + } + } + + private Set toSet(String[] strings) { + HashSet set = new HashSet<>(); + Collections.addAll(set, strings); + return set; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java new file mode 100644 index 00000000000..9d50bc75763 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2015, 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 8044537 + * @summary Checking ACC_SYNTHETIC flag is generated for "this$0" field. + * @library /tools/lib /tools/javac/lib ../lib + * @build TestBase TestResult InMemoryFileManager ToolBox + * @build ThisFieldTest SyntheticTestDriver ExpectedClass ExpectedClasses + * @run main SyntheticTestDriver ThisFieldTest + */ + +/** + * Synthetic members: + * 1. fields this$0 for local and anonymous classes. + */ +@ExpectedClass(className = "ThisFieldTest", + expectedMethods = "()") +@ExpectedClass(className = "ThisFieldTest$1Local", + expectedMethods = "(ThisFieldTest)", + expectedNumberOfSyntheticFields = 1) +@ExpectedClass(className = "ThisFieldTest$1", + expectedMethods = "(ThisFieldTest)", + expectedNumberOfSyntheticFields = 1) +public class ThisFieldTest { + { + class Local { + } + + new Local() { + }; + } +} diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/package_info_test/package-info.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/package_info_test/package-info.java new file mode 100644 index 00000000000..5f826b03c32 --- /dev/null +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/package_info_test/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2015, 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. + */ + +package package_info_test; \ No newline at end of file From 4c307784aea4f682bfdd84cf8a7c4fc669d1f357 Mon Sep 17 00:00:00 2001 From: Andreas Lundblad Date: Tue, 28 Apr 2015 22:25:36 +0200 Subject: [PATCH 35/63] 8078600: Infinite loop when compiling annotations with -XDcompletionDeps Added Completer::isTerminal and added NULL_COMPLETER. Reviewed-by: jlahoda, mcimadamore --- .../com/sun/tools/javac/code/ClassFinder.java | 6 +- .../com/sun/tools/javac/code/Symbol.java | 49 +++++++++--- .../com/sun/tools/javac/code/Symtab.java | 79 ++++++++++--------- .../com/sun/tools/javac/code/Type.java | 14 ++-- .../com/sun/tools/javac/code/Types.java | 2 +- .../com/sun/tools/javac/comp/Annotate.java | 2 +- .../com/sun/tools/javac/comp/Check.java | 2 +- .../com/sun/tools/javac/comp/Enter.java | 4 +- .../com/sun/tools/javac/comp/Lower.java | 2 +- .../com/sun/tools/javac/comp/TypeEnter.java | 2 +- .../JavacProcessingEnvironment.java | 4 +- .../sun/tools/javac/util/Dependencies.java | 7 +- .../com/sun/tools/javadoc/ClassDocImpl.java | 6 +- .../com/sun/tools/javadoc/JavadocTool.java | 5 +- .../javac/completionDeps/DepsAndAnno.java | 49 ++++++++++++ 15 files changed, 158 insertions(+), 75 deletions(-) create mode 100644 langtools/test/tools/javac/completionDeps/DepsAndAnno.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java index a2abf1bc46b..b5d01533650 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java @@ -128,7 +128,7 @@ public class ClassFinder { * the completer to be used for ".java" files. If this remains unassigned * ".java" files will not be loaded. */ - public Completer sourceCompleter = null; + public Completer sourceCompleter = Completer.NULL_COMPLETER; /** The path name of the class file currently being read. */ @@ -341,7 +341,7 @@ public class ClassFinder { reader.readClassFile(c); c.flags_field |= getSupplementaryFlags(c); } else { - if (sourceCompleter != null) { + if (!sourceCompleter.isTerminal()) { sourceCompleter.complete(c); } else { throw new IllegalStateException("Source completer required to read " @@ -392,7 +392,7 @@ public class ClassFinder { public ClassSymbol loadClass(Name flatname) throws CompletionFailure { boolean absent = syms.classes.get(flatname) == null; ClassSymbol c = syms.enterClass(flatname); - if (c.members_field == null && c.completer != null) { + if (c.members_field == null) { try { c.complete(); } catch (CompletionFailure ex) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java index d19cda62150..1b7f28799e1 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java @@ -96,6 +96,7 @@ public abstract class Symbol extends AnnoConstruct implements Element { public Symbol owner; /** The completer of this symbol. + * This should never equal null (NULL_COMPLETER should be used instead). */ public Completer completer; @@ -193,6 +194,10 @@ public abstract class Symbol extends AnnoConstruct implements Element { return (metadata != null && !metadata.isTypesEmpty()); } + public boolean isCompleted() { + return completer.isTerminal(); + } + public void prependAttributes(List l) { if (l.nonEmpty()) { initedMetadata().prepend(l); @@ -243,7 +248,7 @@ public abstract class Symbol extends AnnoConstruct implements Element { this.flags_field = flags; this.type = type; this.owner = owner; - this.completer = null; + this.completer = Completer.NULL_COMPLETER; this.erasure_field = null; this.name = name; } @@ -568,9 +573,9 @@ public abstract class Symbol extends AnnoConstruct implements Element { /** Complete the elaboration of this symbol's definition. */ public void complete() throws CompletionFailure { - if (completer != null) { + if (completer != Completer.NULL_COMPLETER) { Completer c = completer; - completer = null; + completer = Completer.NULL_COMPLETER; c.complete(this); } } @@ -872,19 +877,19 @@ public abstract class Symbol extends AnnoConstruct implements Element { } public WriteableScope members() { - if (completer != null) complete(); + complete(); return members_field; } public long flags() { - if (completer != null) complete(); + complete(); return flags_field; } @Override public List getRawAttributes() { - if (completer != null) complete(); - if (package_info != null && package_info.completer != null) { + complete(); + if (package_info != null) { package_info.complete(); mergeAttributes(); } @@ -1000,24 +1005,24 @@ public abstract class Symbol extends AnnoConstruct implements Element { } public long flags() { - if (completer != null) complete(); + complete(); return flags_field; } public WriteableScope members() { - if (completer != null) complete(); + complete(); return members_field; } @Override public List getRawAttributes() { - if (completer != null) complete(); + complete(); return super.getRawAttributes(); } @Override public List getRawTypeAttributes() { - if (completer != null) complete(); + complete(); return super.getRawTypeAttributes(); } @@ -1782,7 +1787,29 @@ public abstract class Symbol extends AnnoConstruct implements Element { /** Symbol completer interface. */ public static interface Completer { + + /** Dummy completer to be used when the symbol has been completed or + * does not need completion. + */ + public final static Completer NULL_COMPLETER = new Completer() { + public void complete(Symbol sym) { } + public boolean isTerminal() { return true; } + }; + void complete(Symbol sym) throws CompletionFailure; + + /** Returns true if this completer is terminal. A terminal + * completer is used as a place holder when the symbol is completed. + * Calling complete on a terminal completer will not affect the symbol. + * + * The dummy NULL_COMPLETER and the GraphDependencies completer are + * examples of terminal completers. + * + * @return true iff this completer is terminal + */ + default boolean isTerminal() { + return false; + } } public static class CompletionFailure extends RuntimeException { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java index 357e10d6738..9456af32f9c 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -259,49 +259,54 @@ public class Symtab { public void synthesizeEmptyInterfaceIfMissing(final Type type) { final Completer completer = type.tsym.completer; - if (completer != null) { - type.tsym.completer = new Completer() { - public void complete(Symbol sym) throws CompletionFailure { - try { - completer.complete(sym); - } catch (CompletionFailure e) { - sym.flags_field |= (PUBLIC | INTERFACE); - ((ClassType) sym.type).supertype_field = objectType; - } + type.tsym.completer = new Completer() { + public void complete(Symbol sym) throws CompletionFailure { + try { + completer.complete(sym); + } catch (CompletionFailure e) { + sym.flags_field |= (PUBLIC | INTERFACE); + ((ClassType) sym.type).supertype_field = objectType; } - }; - } + } + + @Override + public boolean isTerminal() { + return completer.isTerminal(); + } + }; } public void synthesizeBoxTypeIfMissing(final Type type) { ClassSymbol sym = enterClass(boxedName[type.getTag().ordinal()]); final Completer completer = sym.completer; - if (completer != null) { - sym.completer = new Completer() { - public void complete(Symbol sym) throws CompletionFailure { - try { - completer.complete(sym); - } catch (CompletionFailure e) { - sym.flags_field |= PUBLIC; - ((ClassType) sym.type).supertype_field = objectType; - MethodSymbol boxMethod = - new MethodSymbol(PUBLIC | STATIC, names.valueOf, - new MethodType(List.of(type), sym.type, - List.nil(), methodClass), - sym); - sym.members().enter(boxMethod); - MethodSymbol unboxMethod = - new MethodSymbol(PUBLIC, - type.tsym.name.append(names.Value), // x.intValue() - new MethodType(List.nil(), type, - List.nil(), methodClass), - sym); - sym.members().enter(unboxMethod); - } + sym.completer = new Completer() { + public void complete(Symbol sym) throws CompletionFailure { + try { + completer.complete(sym); + } catch (CompletionFailure e) { + sym.flags_field |= PUBLIC; + ((ClassType) sym.type).supertype_field = objectType; + MethodSymbol boxMethod = + new MethodSymbol(PUBLIC | STATIC, names.valueOf, + new MethodType(List.of(type), sym.type, + List.nil(), methodClass), + sym); + sym.members().enter(boxMethod); + MethodSymbol unboxMethod = + new MethodSymbol(PUBLIC, + type.tsym.name.append(names.Value), // x.intValue() + new MethodType(List.nil(), type, + List.nil(), methodClass), + sym); + sym.members().enter(unboxMethod); } - }; - } + } + @Override + public boolean isTerminal() { + return completer.isTerminal(); + } + }; } // Enter a synthetic class that is used to mark classes in ct.sym. @@ -309,7 +314,7 @@ public class Symtab { private Type enterSyntheticAnnotation(String name) { ClassType type = (ClassType)enterClass(name); ClassSymbol sym = (ClassSymbol)type.tsym; - sym.completer = null; + sym.completer = Completer.NULL_COMPLETER; sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; sym.erasure_field = type; sym.members_field = WriteableScope.create(sym); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java index 1818d9f7999..d538a7e0b75 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java @@ -580,12 +580,10 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public boolean isCompound() { - return tsym.completer == null - // Compound types can't have a completer. Calling - // flags() will complete the symbol causing the - // compiler to load classes unnecessarily. This led - // to regression 6180021. - && (tsym.flags() & COMPOUND) != 0; + // Compound types can't have a (non-terminal) completer. Calling + // flags() will complete the symbol causing the compiler to load + // classes unnecessarily. This led to regression 6180021. + return tsym.isCompleted() && (tsym.flags() & COMPOUND) != 0; } public boolean isIntersection() { @@ -1124,7 +1122,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public void complete() { - if (tsym.completer != null) tsym.complete(); + tsym.complete(); } @DefinedBy(Api.LANGUAGE_MODEL) @@ -1212,7 +1210,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { Assert.check((csym.flags() & COMPOUND) != 0); supertype_field = bounds.head; interfaces_field = bounds.tail; - Assert.check(supertype_field.tsym.completer != null || + Assert.check(!supertype_field.tsym.isCompleted() || !supertype_field.isInterface(), supertype_field); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java index 94c3d210e33..f2c141f948f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java @@ -645,7 +645,7 @@ public class Types { Symbol descSym = findDescriptorSymbol(targets.head.tsym); Type descType = findDescriptorType(targets.head); ClassSymbol csym = new ClassSymbol(cflags, name, env.enclClass.sym.outermostClass()); - csym.completer = null; + csym.completer = Completer.NULL_COMPLETER; csym.members_field = WriteableScope.create(csym); MethodSymbol instDescSym = new MethodSymbol(descSym.flags(), descSym.name, descType, csym); csym.members_field.enter(instDescSym); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java index 8394d321cf6..1e445f30de0 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java @@ -1241,7 +1241,7 @@ public class Annotate { private void init() { // Make sure metaDataFor is member entered - while (metaDataFor.completer != null) + while (!metaDataFor.isCompleted()) metaDataFor.complete(); if (annotationTypeCompleter != null) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 3e9f80ea24e..cd24d685bbc 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -2268,7 +2268,7 @@ public class Check { } } if (complete) - complete = ((c.flags_field & UNATTRIBUTED) == 0) && c.completer == null; + complete = ((c.flags_field & UNATTRIBUTED) == 0) && c.isCompleted(); if (complete) c.flags_field |= ACYCLIC; return complete; } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index 7ab179305ef..fea99831fed 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -320,7 +320,7 @@ public class Enter extends JCTree.Visitor { ClassSymbol c = syms.enterClass(name, tree.packge); c.flatname = names.fromString(tree.packge + "." + name); c.sourcefile = tree.sourcefile; - c.completer = null; + c.completer = Completer.NULL_COMPLETER; c.members_field = WriteableScope.create(c); tree.packge.package_info = c; } @@ -386,7 +386,7 @@ public class Enter extends JCTree.Visitor { typeEnvs.put(c, localEnv); // Fill out class fields. - c.completer = null; // do not allow the initial completer linger on. + c.completer = Completer.NULL_COMPLETER; // do not allow the initial completer linger on. c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree); c.sourcefile = env.toplevel.sourcefile; c.members_field = WriteableScope.create(c); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index 72a432676ff..09d3a87aa16 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -641,7 +641,7 @@ public class Lower extends TreeTranslator { c.flatname = chk.localClassName(c); } c.sourcefile = owner.sourcefile; - c.completer = null; + c.completer = Completer.NULL_COMPLETER; c.members_field = WriteableScope.create(c); c.flags_field = flags; ClassType ctype = (ClassType) c.type; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java index c54cfd6db65..96e8e86e7e7 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java @@ -903,7 +903,7 @@ public class TypeEnter implements Completer { memberEnter.memberEnter(tree.defs, env); if (tree.sym.isAnnotationType()) { - Assert.checkNull(tree.sym.completer); + Assert.check(tree.sym.isCompleted()); tree.sym.setAnnotationTypeMetadata(new AnnotationTypeMetadata(tree.sym, annotate.annotationTypeSourceCompleter())); } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index eedd14a4b8c..5ec2246ff72 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -1092,7 +1092,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea if (cs.classfile != null || cs.kind == ERR) { cs.reset(); cs.type = new ClassType(cs.type.getEnclosingType(), null, cs); - if (cs.completer == null) { + if (cs.isCompleted()) { cs.completer = initialCompleter; } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java index 37c3e40f010..947586e10e6 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -468,6 +468,11 @@ public abstract class Dependencies { sym.completer = this; } + @Override + public boolean isTerminal() { + return true; + } + /** * This visitor is used to generate the special side-effect dependencies * given a graph containing only standard dependencies. diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java index b2ea9b764f5..da964c82e24 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/ClassDocImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -796,9 +796,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc { } // make sure that this symbol has been completed - if (tsym.completer != null) { - tsym.complete(); - } + tsym.complete(); // search imports diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java index 3937ff95720..ae5b7c67991 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/JavadocTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -40,6 +40,7 @@ import javax.tools.StandardJavaFileManager; import javax.tools.StandardLocation; import com.sun.tools.javac.code.ClassFinder; +import com.sun.tools.javac.code.Symbol.Completer; import com.sun.tools.javac.code.Symbol.CompletionFailure; import com.sun.tools.javac.comp.Enter; import com.sun.tools.javac.tree.JCTree; @@ -141,7 +142,7 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { docenv.docClasses = docClasses; docenv.legacyDoclet = legacyDoclet; - javadocFinder.sourceCompleter = docClasses ? null : sourceCompleter; + javadocFinder.sourceCompleter = docClasses ? Completer.NULL_COMPLETER : sourceCompleter; ListBuffer names = new ListBuffer<>(); ListBuffer classTrees = new ListBuffer<>(); diff --git a/langtools/test/tools/javac/completionDeps/DepsAndAnno.java b/langtools/test/tools/javac/completionDeps/DepsAndAnno.java new file mode 100644 index 00000000000..af88e249b8f --- /dev/null +++ b/langtools/test/tools/javac/completionDeps/DepsAndAnno.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015, 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 8078600 + * @summary Make sure -XDcompletionDeps does not cause an infinite loop. + * @library /tools/lib + * @build ToolBox + * @run main/othervm/timeout=10 DepsAndAnno + */ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +public class DepsAndAnno { + + @Target(ElementType.METHOD) + @interface Test { } + + public static void main(String[] args) { + ToolBox toolBox = new ToolBox(); + toolBox.new JavacTask(ToolBox.Mode.CMDLINE) + .options("-XDcompletionDeps") + .outdir(".") + .files(ToolBox.testSrc + "/DepsAndAnno.java") + .run(); + } +} From 8923c3022581a33d42152a8ce49226ef33039c41 Mon Sep 17 00:00:00 2001 From: Christian Tornqvist Date: Tue, 28 Apr 2015 14:45:57 -0700 Subject: [PATCH 36/63] 8077994: [TESTBUG] Exclude compiler/floatingpoint/ModNaN.java Reviewed-by: hseigel, ccheung --- hotspot/test/compiler/floatingpoint/ModNaN.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/test/compiler/floatingpoint/ModNaN.java b/hotspot/test/compiler/floatingpoint/ModNaN.java index 84672566cde..4cd2f4aefde 100644 --- a/hotspot/test/compiler/floatingpoint/ModNaN.java +++ b/hotspot/test/compiler/floatingpoint/ModNaN.java @@ -25,7 +25,7 @@ * @test * @bug 8015396 * @summary double a%b returns NaN for some (a,b) (|a| < inf, |b|>0) (on Core i7 980X) - * + * @ignore 8015396 * @run main ModNaN */ public class ModNaN { From fae244a8b0c371cd6853c33afd0120f4f81fe539 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Tue, 28 Apr 2015 14:46:19 -0700 Subject: [PATCH 37/63] 8077590: windows_i586_6.2-product-c2-runThese8_Xcomp_vm failing after win compiler upgrade Add /arch:IA32 flag to windows ia32 builds to force x87 codepath Reviewed-by: kvn, dholmes --- hotspot/make/windows/makefiles/compile.make | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/make/windows/makefiles/compile.make b/hotspot/make/windows/makefiles/compile.make index 8523bfd2eb6..0ca02a18a96 100644 --- a/hotspot/make/windows/makefiles/compile.make +++ b/hotspot/make/windows/makefiles/compile.make @@ -74,7 +74,8 @@ LP64=1 !if "$(BUILDARCH)" == "i486" MACHINE=I386 -CXX_FLAGS=$(CXX_FLAGS) /D "IA32" +# VS2013 generates bad l2f without /arch:IA32 +CXX_FLAGS=$(CXX_FLAGS) /D "IA32" /arch:IA32 !endif CXX_FLAGS=$(CXX_FLAGS) /D "WIN32" /D "_WINDOWS" From 74169dee6e38e39f4fe91dd63ce2d727cc92e5f5 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 28 Apr 2015 18:57:51 -0700 Subject: [PATCH 38/63] 8078861: tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java fails on Windows Reviewed-by: vromero --- .../attributes/Synthetic/SyntheticTestDriver.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java b/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java index 69a056c97d7..5c5d67792d9 100644 --- a/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java +++ b/langtools/test/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java @@ -21,12 +21,14 @@ * questions. */ +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; +import java.util.regex.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -69,13 +71,13 @@ public class SyntheticTestDriver extends TestResult { .collect(Collectors.toMap(ExpectedClass::className, Function.identity())); this.classes = new HashMap<>(); Path classDir = getClassDir().toPath(); - String sourceFileName = testCaseName.replace('.', '/'); + Pattern filePattern = Pattern.compile(Pattern.quote(testCaseName.replace('.', File.separatorChar)) + ".*\\.class"); List paths = Files.walk(classDir) .map(p -> classDir.relativize(p.toAbsolutePath())) - .filter(p -> p.toString().matches(sourceFileName + ".*\\.class")) + .filter(p -> filePattern.matcher(p.toString()).matches()) .collect(Collectors.toList()); for (Path path : paths) { - String className = path.toString().replace(".class", "").replace('/', '.'); + String className = path.toString().replace(".class", "").replace(File.separatorChar, '.'); classes.put(className, readClassFile(classDir.resolve(path).toFile())); } if (classes.isEmpty()) { From 86c109e149061e623f080fa7fe4da489cca6fd03 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 29 Apr 2015 10:25:53 -0700 Subject: [PATCH 39/63] 8078334: Mark regression tests using randomness Reviewed-by: xuelei, alanb --- jdk/test/TEST.ROOT | 11 +++++++++-- .../security/ucrypto/CipherSignNotSupported.java | 1 + jdk/test/com/oracle/security/ucrypto/TestAES.java | 1 + .../com/oracle/security/ucrypto/TestCICOWithGCM.java | 1 + .../security/ucrypto/TestCICOWithGCMAndAAD.java | 1 + jdk/test/com/oracle/security/ucrypto/TestDigest.java | 1 + .../com/oracle/security/ucrypto/TestGCMKeyWrap.java | 1 + jdk/test/com/sun/crypto/provider/Cipher/AES/CICO.java | 1 + jdk/test/com/sun/crypto/provider/Cipher/AES/CTR.java | 1 + .../com/sun/crypto/provider/Cipher/AES/Padding.java | 1 + .../sun/crypto/provider/Cipher/AES/Test4513830.java | 1 + .../sun/crypto/provider/Cipher/AES/Test4517355.java | 1 + .../sun/crypto/provider/Cipher/AES/TestAESCipher.java | 1 + .../crypto/provider/Cipher/AES/TestCICOWithGCM.java | 1 + .../provider/Cipher/AES/TestCICOWithGCMAndAAD.java | 1 + .../provider/Cipher/AES/TestISO10126Padding.java | 1 + .../crypto/provider/Cipher/AES/TestNonexpanding.java | 1 + .../crypto/provider/Cipher/AES/TestSameBuffer.java | 1 + .../com/sun/crypto/provider/Cipher/DES/FlushBug.java | 1 + .../crypto/provider/Cipher/PBE/PBESealedObject.java | 1 + .../crypto/provider/Cipher/PBE/PBKDF2Translate.java | 1 + .../sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java | 1 + .../Cipher/PBE/TestCipherKeyWrapperPBEKey.java | 1 + .../com/sun/crypto/provider/Cipher/RSA/TestOAEP.java | 1 + .../com/sun/crypto/provider/Cipher/RSA/TestRSA.java | 1 + .../com/sun/crypto/provider/Mac/HmacSaltLengths.java | 1 + jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java | 1 + .../management/ThreadMXBean/ThreadCpuTimeArray.java | 1 + jdk/test/java/io/DataInputStream/ReadUTF.java | 1 + jdk/test/java/io/File/GetXSpace.java | 1 + jdk/test/java/io/InputStream/TransferTo.java | 1 + .../java/io/PrintStream/OversynchronizedTest.java | 1 + .../CorruptedUTFConsumption.java | 1 + .../java/io/Serializable/longString/LongString.java | 1 + jdk/test/java/io/Serializable/proxy/Basic.java | 1 + .../java/io/Serializable/sanityCheck/SanityCheck.java | 1 + jdk/test/java/lang/Boolean/MakeBooleanComparable.java | 1 + jdk/test/java/lang/ClassLoader/Assert.java | 1 + jdk/test/java/lang/Compare.java | 1 + jdk/test/java/lang/Double/ParseHexFloatingPoint.java | 1 + jdk/test/java/lang/Enum/ValueOf.java | 1 + jdk/test/java/lang/HashCode.java | 1 + jdk/test/java/lang/Integer/BitTwiddle.java | 1 + jdk/test/java/lang/Long/BitTwiddle.java | 1 + jdk/test/java/lang/Math/CubeRootTests.java | 1 + jdk/test/java/lang/Math/HypotTests.java | 1 + jdk/test/java/lang/Math/IeeeRecommendedTests.java | 1 + jdk/test/java/lang/Math/Log1pTests.java | 1 + jdk/test/java/lang/Runtime/exec/WinCommand.java | 1 + jdk/test/java/lang/String/ContentEquals.java | 1 + jdk/test/java/lang/String/ICCBasher.java | 1 + jdk/test/java/lang/String/SBConstructor.java | 2 +- jdk/test/java/lang/String/Split.java | 1 + .../java/lang/StringBuffer/AppendCharSequence.java | 1 + jdk/test/java/lang/StringBuffer/AppendSB.java | 1 + .../java/lang/StringBuffer/AppendStringBuilder.java | 1 + jdk/test/java/lang/StringBuffer/Capacity.java | 1 + jdk/test/java/lang/StringBuffer/IndexOf.java | 1 + jdk/test/java/lang/StringBuffer/SBBasher.java | 2 +- jdk/test/java/lang/StringBuffer/Trim.java | 1 + .../java/lang/StringBuilder/AppendStringBuffer.java | 1 + jdk/test/java/lang/ToString.java | 1 + .../java/lang/instrument/SingleTransformerTest.java | 1 + .../java/lang/instrument/TransformMethodTest.java | 1 + .../lang/invoke/MethodHandles/CatchExceptionTest.java | 2 +- .../java/lang/management/BufferPoolMXBean/Basic.java | 1 + jdk/test/java/math/BigDecimal/StringConstructor.java | 1 + jdk/test/java/math/BigInteger/BigIntegerTest.java | 1 + jdk/test/java/math/BigInteger/ModPow65537.java | 1 + jdk/test/java/math/BigInteger/PrimeTest.java | 1 + .../java/math/BigInteger/SymmetricRangeTests.java | 1 + jdk/test/java/net/InetAddress/HashSpread.java | 1 + jdk/test/java/nio/Buffer/Chars.java | 1 + jdk/test/java/nio/MappedByteBuffer/Force.java | 1 + jdk/test/java/nio/MappedByteBuffer/ZeroMap.java | 1 + .../nio/channels/AsynchronousChannelGroup/Basic.java | 1 + .../channels/AsynchronousChannelGroup/Identity.java | 1 + .../channels/AsynchronousChannelGroup/Restart.java | 1 + .../nio/channels/AsynchronousFileChannel/Basic.java | 1 + .../nio/channels/AsynchronousFileChannel/Lock.java | 1 + .../AsynchronousFileChannel/LotsOfWrites.java | 1 + .../nio/channels/AsynchronousSocketChannel/Basic.java | 1 + .../AsynchronousSocketChannel/StressLoopback.java | 1 + jdk/test/java/nio/channels/Channels/Basic2.java | 1 + jdk/test/java/nio/channels/Channels/ShortWrite.java | 1 + .../channels/DatagramChannel/AdaptDatagramSocket.java | 1 + .../DatagramChannel/MulticastSendReceiveTests.java | 1 + .../nio/channels/DatagramChannel/Promiscuous.java | 1 + .../java/nio/channels/FileChannel/AtomicAppend.java | 1 + .../nio/channels/FileChannel/ClosedByInterrupt.java | 1 + jdk/test/java/nio/channels/FileChannel/MapTest.java | 1 + jdk/test/java/nio/channels/FileChannel/Position.java | 1 + jdk/test/java/nio/channels/FileChannel/Pread.java | 1 + jdk/test/java/nio/channels/FileChannel/Pwrite.java | 1 + jdk/test/java/nio/channels/FileChannel/Size.java | 1 + jdk/test/java/nio/channels/FileChannel/Transfer.java | 1 + jdk/test/java/nio/channels/FileChannel/Truncate.java | 1 + jdk/test/java/nio/channels/Pipe/PipeChannel.java | 3 ++- jdk/test/java/nio/channels/Pipe/ScatteringRead.java | 3 ++- jdk/test/java/nio/channels/Pipe/SelectPipe.java | 1 + jdk/test/java/nio/channels/Selector/SelectorTest.java | 1 + .../ServerSocketChannel/NonBlockingAccept.java | 1 + .../nio/channels/SocketChannel/CloseDuringWrite.java | 1 + .../java/nio/channels/SocketChannel/OutOfBand.java | 1 + .../java/nio/channels/SocketChannel/ShortWrite.java | 1 + .../java/nio/channels/SocketChannel/VectorIO.java | 1 + .../nio/channels/etc/AdaptorCloseAndInterrupt.java | 1 + jdk/test/java/nio/charset/coders/BashCache.java | 1 + jdk/test/java/nio/charset/coders/BashStreams.java | 1 + jdk/test/java/nio/file/Files/BytesAndLines.java | 1 + jdk/test/java/nio/file/Files/CopyAndMove.java | 1 + .../nio/file/Files/walkFileTree/SkipSiblings.java | 1 + .../java/nio/file/Files/walkFileTree/SkipSubtree.java | 1 + .../nio/file/Files/walkFileTree/TerminateWalk.java | 1 + jdk/test/java/nio/file/WatchService/LotsOfEvents.java | 1 + jdk/test/java/nio/file/WatchService/MayFlies.java | 1 + .../nio/file/WatchService/SensitivityModifier.java | 1 + .../file/attribute/AclFileAttributeView/Basic.java | 1 + jdk/test/java/nio/file/attribute/FileTime/Basic.java | 1 + .../attribute/UserDefinedFileAttributeView/Basic.java | 1 + jdk/test/java/security/MessageDigest/ByteBuffers.java | 1 + .../security/MessageDigest/TestDigestIOStream.java | 1 + .../java/security/MessageDigest/TestSameLength.java | 1 + .../java/security/MessageDigest/TestSameValue.java | 1 + jdk/test/java/security/Signature/ByteBuffers.java | 1 + jdk/test/java/security/Signature/NONEwithRSA.java | 1 + jdk/test/java/security/spec/EllipticCurveMatch.java | 1 + jdk/test/java/sql/JavatimeTest.java | 1 + .../java/text/Format/MessageFormat/Bug7003643.java | 1 + jdk/test/java/util/Arrays/ArrayObjectMethods.java | 1 + jdk/test/java/util/Arrays/CopyMethods.java | 1 + jdk/test/java/util/Arrays/Correct.java | 1 + jdk/test/java/util/Base64/TestBase64.java | 1 + jdk/test/java/util/BitSet/BSMethods.java | 1 + jdk/test/java/util/BitSet/ImportExport.java | 1 + jdk/test/java/util/BitSet/PreviousBits.java | 1 + jdk/test/java/util/Calendar/JavatimeTest.java | 1 + jdk/test/java/util/Collection/MOAT.java | 1 + jdk/test/java/util/Collections/AddAll.java | 1 + jdk/test/java/util/Collections/CheckedListBash.java | 1 + jdk/test/java/util/Collections/CheckedMapBash.java | 1 + jdk/test/java/util/Collections/CheckedSetBash.java | 1 + jdk/test/java/util/Collections/Disjoint.java | 1 + jdk/test/java/util/Collections/Rotate.java | 1 + jdk/test/java/util/EnumSet/EnumSetBash.java | 1 + jdk/test/java/util/HashSet/Serialization.java | 1 + jdk/test/java/util/IdentityHashMap/Capacity.java | 1 + jdk/test/java/util/List/LockStep.java | 1 + jdk/test/java/util/Map/LockStep.java | 1 + jdk/test/java/util/NavigableMap/LockStep.java | 1 + .../util/Properties/ConcurrentLoadAndStoreXML.java | 1 + jdk/test/java/util/Random/DistinctSeeds.java | 1 + jdk/test/java/util/Random/RandomStreamTest.java | 1 + jdk/test/java/util/Random/RandomTest.java | 1 + .../java/util/ResourceBundle/Control/StressTest.java | 1 + .../util/SplittableRandom/SplittableRandomTest.java | 1 + jdk/test/java/util/Timer/DelayOverflow.java | 1 + jdk/test/java/util/Timer/Purge.java | 1 + jdk/test/java/util/UUID/Serial.java | 1 + jdk/test/java/util/UUID/UUIDTest.java | 1 + jdk/test/java/util/WeakHashMap/GCDuringIteration.java | 1 + jdk/test/java/util/logging/CheckZombieLockTest.java | 1 + jdk/test/java/util/logging/DrainFindDeadlockTest.java | 1 + jdk/test/java/util/logging/FileHandlerLongLimit.java | 1 + jdk/test/java/util/logging/FileHandlerPath.java | 1 + .../util/logging/FileHandlerPatternExceptions.java | 1 + .../Configuration/ParentLoggerWithHandlerGC.java | 1 + jdk/test/java/util/logging/LoggingDeadlock.java | 4 ++++ jdk/test/java/util/logging/LoggingDeadlock2.java | 4 ++++ .../logging/TestLogConfigurationDeadLockWithConf.java | 1 + jdk/test/java/util/regex/RegExTest.java | 1 + jdk/test/java/util/zip/3GBZipFiles.sh | 1 + jdk/test/java/util/zip/DeInflate.java | 1 + jdk/test/java/util/zip/DeflateIn_InflateOut.java | 1 + jdk/test/java/util/zip/FlaterTest.java | 1 + jdk/test/java/util/zip/GZIP/Accordion.java | 1 + jdk/test/java/util/zip/GZIP/GZIPInputStreamRead.java | 1 + jdk/test/java/util/zip/InflateIn_DeflateOut.java | 1 + jdk/test/java/util/zip/InflaterBufferSize.java | 1 + jdk/test/java/util/zip/TimeChecksum.java | 1 + jdk/test/java/util/zip/TotalInOut.java | 1 + jdk/test/java/util/zip/ZipFile/Assortment.java | 1 + .../zip/ZipFile/ClearStaleZipFileInputStreams.java | 1 + jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java | 1 + .../java/util/zip/ZipFile/MultiThreadedReadTest.java | 1 + jdk/test/java/util/zip/ZipFile/ReadZip.java | 1 + jdk/test/javax/crypto/Cipher/ByteBuffers.java | 1 + .../javax/crypto/CipherSpi/DirectBBRemaining.java | 1 + .../javax/crypto/CryptoPermission/AllPermCheck.java | 1 + .../javax/crypto/CryptoPermission/RC2PermCheck.java | 1 + .../crypto/JceSecurity/SunJCE_BC_LoadOrdering.java | 1 + jdk/test/javax/crypto/KeyGenerator/TestKGParity.java | 1 + jdk/test/javax/crypto/Mac/ByteBuffers.java | 1 + jdk/test/javax/crypto/NullCipher/TestNPE.java | 1 + .../javax/management/monitor/MultiMonitorTest.java | 1 + .../javax/management/mxbean/ThreadMXBeanTest.java | 1 + .../remote/mandatory/loading/MissingClassTest.java | 1 + .../management/timer/MissingNotificationTest.java | 1 + jdk/test/javax/net/ssl/SSLEngine/LargeBufs.java | 1 + jdk/test/javax/smartcardio/TestCommandAPDU.java | 1 + .../jmxremote/startstop/JMXStartStopTest.java | 1 + jdk/test/sun/misc/CopyMemory.java | 1 + .../sun/misc/FloatingDecimal/TestFloatingDecimal.java | 1 + jdk/test/sun/net/www/ParseUtil_4922813.java | 1 + jdk/test/sun/nio/cs/FindDecoderBugs.java | 1 + jdk/test/sun/nio/cs/FindEncoderBugs.java | 1 + jdk/test/sun/nio/cs/TestStringCoding.java | 1 + jdk/test/sun/nio/cs/TestStringCodingUTF8.java | 1 + jdk/test/sun/security/mscapi/PrngSlow.java | 1 + jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java | 1 + .../sun/security/pkcs11/Cipher/TestRSACipher.java | 1 + .../sun/security/pkcs11/Cipher/TestRawRSACipher.java | 1 + .../sun/security/pkcs11/Cipher/TestSymmCiphers.java | 3 ++- .../security/pkcs11/Cipher/TestSymmCiphersNoPad.java | 1 + .../sun/security/pkcs11/KeyGenerator/DESParity.java | 1 + jdk/test/sun/security/pkcs11/Mac/MacSameTest.java | 1 + jdk/test/sun/security/pkcs11/Mac/ReinitMac.java | 1 + .../security/pkcs11/MessageDigest/ByteBuffers.java | 1 + .../security/pkcs11/MessageDigest/ReinitDigest.java | 1 + .../security/pkcs11/MessageDigest/TestCloning.java | 1 + .../sun/security/pkcs11/Secmod/AddPrivateKey.java | 1 + jdk/test/sun/security/pkcs11/Secmod/Crypto.java | 1 + .../sun/security/pkcs11/Secmod/GetPrivateKey.java | 1 + jdk/test/sun/security/pkcs11/SecureRandom/Basic.java | 1 + .../sun/security/pkcs11/Signature/ByteBuffers.java | 1 + .../security/pkcs11/Signature/ReinitSignature.java | 1 + jdk/test/sun/security/pkcs11/Signature/TestDSA.java | 1 + .../security/pkcs11/Signature/TestDSAKeyLength.java | 1 + jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java | 1 + jdk/test/sun/security/pkcs11/ec/TestCurves.java | 1 + jdk/test/sun/security/pkcs11/ec/TestECDSA.java | 1 + jdk/test/sun/security/pkcs11/rsa/KeyWrap.java | 1 + .../sun/security/pkcs11/rsa/TestKeyPairGenerator.java | 2 +- jdk/test/sun/security/pkcs11/rsa/TestSignatures.java | 1 + jdk/test/sun/security/provider/DSA/TestDSA.java | 1 + jdk/test/sun/security/provider/DSA/TestDSA2.java | 1 + .../provider/SeedGenerator/Priority_Inversion.java | 1 + jdk/test/sun/security/rsa/TestKeyPairGenerator.java | 1 + jdk/test/sun/security/rsa/TestSignatures.java | 1 + .../ssl/ClientHandshaker/LengthCheckTest.java | 1 + jdk/test/sun/security/ssl/GenSSLConfigs/main.java | 1 + 241 files changed, 258 insertions(+), 9 deletions(-) diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index cf9bdb246ff..76e0c407cba 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -1,8 +1,15 @@ # This file identifies the root of the test-suite hierarchy. # It also contains test-suite configuration information. -# The list of keywords supported in the entire test suite -keys=2d dnd i18n intermittent +# The list of keywords supported in the entire test suite. The +# "intermittent" keyword marks tests known to fail intermittently. +# The "randomness" keyword marks tests using randomness with test +# cases differing from run to run. (A test using a fixed random seed +# would not count as "randomness" by this definition.) Extra care +# should be taken to handle test failures of intermittent or +# randomness tests. + +keys=2d dnd i18n intermittent randomness # Tests that must run in othervm mode othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation diff --git a/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java b/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java index bf463227ed3..7e141b615b5 100644 --- a/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java +++ b/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java @@ -27,6 +27,7 @@ * @summary Make sure signing via encrypt and verifying via decrypt are not * supported by OracleUcrypto provider. * @author Anthony Scarpino + * @key randomness */ import java.util.Random; diff --git a/jdk/test/com/oracle/security/ucrypto/TestAES.java b/jdk/test/com/oracle/security/ucrypto/TestAES.java index 61594f381c0..4ed48659c86 100644 --- a/jdk/test/com/oracle/security/ucrypto/TestAES.java +++ b/jdk/test/com/oracle/security/ucrypto/TestAES.java @@ -25,6 +25,7 @@ * @test * @bug 7088989 8014374 * @summary Ensure the AES ciphers of OracleUcrypto provider works correctly + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java b/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java index f12ee740a1a..3191fd8b321 100644 --- a/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java +++ b/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCM.java @@ -26,6 +26,7 @@ * @bug 8014374 * @summary Test basic CipherInputStream/OutputStream func w/ GCM mode. * @author Valerie Peng + * @key randomness */ import java.security.*; diff --git a/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCMAndAAD.java b/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCMAndAAD.java index 782cea6145e..6075672dbcb 100644 --- a/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCMAndAAD.java +++ b/jdk/test/com/oracle/security/ucrypto/TestCICOWithGCMAndAAD.java @@ -26,6 +26,7 @@ * @bug 8014374 * @summary Test CipherInputStream/OutputStream func w/ GCM mode and AAD. * @author Valerie Peng + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/oracle/security/ucrypto/TestDigest.java b/jdk/test/com/oracle/security/ucrypto/TestDigest.java index a9057ba3c87..5bd6f412f29 100644 --- a/jdk/test/com/oracle/security/ucrypto/TestDigest.java +++ b/jdk/test/com/oracle/security/ucrypto/TestDigest.java @@ -25,6 +25,7 @@ * @test * @bug 7088989 * @summary Ensure the various message digests works correctly + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/oracle/security/ucrypto/TestGCMKeyWrap.java b/jdk/test/com/oracle/security/ucrypto/TestGCMKeyWrap.java index 89d5e02efbd..c64367ab46e 100644 --- a/jdk/test/com/oracle/security/ucrypto/TestGCMKeyWrap.java +++ b/jdk/test/com/oracle/security/ucrypto/TestGCMKeyWrap.java @@ -25,6 +25,7 @@ * @test * @bug 8014374 * @summary Ensure key wrap/unwrap works using AES/GCM/NoPadding + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/CICO.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/CICO.java index 811724be8ce..1bb9f0d061f 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/CICO.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/CICO.java @@ -44,6 +44,7 @@ import javax.crypto.spec.IvParameterSpec; * @summary Test AES ciphers with different modes and padding schemes (ECB mode * doesn't use IV). The test tries 3 different read methods of * CipherInputStream. + * @key randomness */ public class CICO { private static final String ALGORITHM = "aEs"; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/CTR.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/CTR.java index 808f3e26916..d569965bca1 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/CTR.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/CTR.java @@ -43,6 +43,7 @@ import javax.crypto.spec.IvParameterSpec; * @bug 8043836 * @summary Test AES ciphers with 4 different modes with NoPadding. Check if * data before encryption and after decryption is the same. + * @key randomness */ public class CTR { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/Padding.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/Padding.java index 6023ec7cc67..9185efdf02c 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/Padding.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/Padding.java @@ -42,6 +42,7 @@ import javax.crypto.spec.IvParameterSpec; * @summary Test AES ciphers with different modes and padding schemes (ECB mode * doesn't use IV). The test tries 3 different read methods of * CipherInputStream. + * @key randomness */ public class Padding { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java index d3ecc9e27bf..c421b169c4a 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4513830.java @@ -27,6 +27,7 @@ * @summary Verify the output size returned by AES cipher.getOutputSize * method in DECRYPT mode does not add extra bytes for padding * @author Valerie Peng + * @key randomness */ import java.io.PrintStream; import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4517355.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4517355.java index a4716482918..7ea6b8316f8 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4517355.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/Test4517355.java @@ -27,6 +27,7 @@ * @summary Verify that AES cipher.doFinal method does NOT need more * than necessary bytes in decrypt mode * @author Valerie Peng + * @key randomness */ import java.io.PrintStream; import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCipher.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCipher.java index 190b58630cc..0ea8d01bc92 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCipher.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCipher.java @@ -43,6 +43,7 @@ import javax.crypto.spec.IvParameterSpec; * doesn't use IV). * @author Liwen Wang * @author Parag Salvi + * @key randomness */ public class TestAESCipher { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java index 8fec041d0a9..1d5e5abbb62 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCM.java @@ -29,6 +29,7 @@ * @run main TestCICOWithGCM * @summary Test CipherInputStream/OutputStream with AES GCM mode. * @author Valerie Peng + * @key randomness */ import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java index 816f764f9ba..edc43d61ae3 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestCICOWithGCMAndAAD.java @@ -29,6 +29,7 @@ * @run main TestCICOWithGCMAndAAD * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD. * @author Valerie Peng + * @key randomness */ import java.io.*; import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java index edb62cb2b1f..926320393dd 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestISO10126Padding.java @@ -26,6 +26,7 @@ * @bug 4921443 * @summary Ensure ISO10126Padding works correctly. * @author Valerie Peng + * @key randomness */ import java.util.Arrays; import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestNonexpanding.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestNonexpanding.java index 200d38b547b..3ed865f5a98 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestNonexpanding.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestNonexpanding.java @@ -40,6 +40,7 @@ import javax.crypto.spec.GCMParameterSpec; * @bug 8043836 * @summary Test AES encryption with no padding. Expect the original data length * is the same as the encrypted data. + * @key randomness */ public class TestNonexpanding { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestSameBuffer.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestSameBuffer.java index bbba223a7c4..f4cc9276bbc 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestSameBuffer.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestSameBuffer.java @@ -42,6 +42,7 @@ import javax.crypto.spec.IvParameterSpec; * @summary Test AES ciphers with different modes and padding schemes (ECB mode * doesn't use IV). The test tries 3 different read methods of * CipherInputStream. + * @key randomness */ public class TestSameBuffer { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/DES/FlushBug.java b/jdk/test/com/sun/crypto/provider/Cipher/DES/FlushBug.java index ab2dde8b434..bb03a885825 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/DES/FlushBug.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/DES/FlushBug.java @@ -26,6 +26,7 @@ * @bug 0000000 * @summary FlushBug * @author Jan Luehe + * @key randomness */ import java.io.*; import java.security.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBESealedObject.java b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBESealedObject.java index 2420b9bc4a3..f97acd547a8 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBESealedObject.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBESealedObject.java @@ -45,6 +45,7 @@ import javax.crypto.spec.PBEParameterSpec; * @author Bill Situ * @author Alexander Fomin * @run main PBESealedObject + * @key randomness */ public class PBESealedObject { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBKDF2Translate.java b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBKDF2Translate.java index 36681591e46..d9ccf5cf7c1 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBKDF2Translate.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBKDF2Translate.java @@ -37,6 +37,7 @@ import javax.crypto.spec.PBEKeySpec; * @summary Verify if the SecretKeyFactory.translateKey() method works * @author Alexander Fomin * @run main PBKDF2Translate + * @key randomness */ public class PBKDF2Translate { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java index 4995a9a8b8e..00ff89ade69 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java @@ -27,6 +27,7 @@ * @summary basic test for PBEWithSHA1AndDESede, PBEWithSHA1AndRC2_40/128 * and PBEWithSHA1AndRC4_40/128 * @author Valerie Peng + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java index cc237d0549d..dd767ba1fed 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java @@ -45,6 +45,7 @@ import javax.crypto.spec.PBEParameterSpec; * @author Bill Situ * @author Yun Ke * @run main TestCipherKeyWrapperPBEKey + * @key randomness */ public class TestCipherKeyWrapperPBEKey { diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java index 55b501ebf36..b35b8a2ef32 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java @@ -26,6 +26,7 @@ * @bug 4894151 * @summary encryption/decryption test for OAEP * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestRSA.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestRSA.java index b88a5dc524b..1e4c6ed10b1 100644 --- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestRSA.java +++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestRSA.java @@ -26,6 +26,7 @@ * @bug 4853306 * @summary Test RSA Cipher implementation * @author Andreas Sterbenz + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/sun/crypto/provider/Mac/HmacSaltLengths.java b/jdk/test/com/sun/crypto/provider/Mac/HmacSaltLengths.java index 17447398403..38d4da44a4a 100644 --- a/jdk/test/com/sun/crypto/provider/Mac/HmacSaltLengths.java +++ b/jdk/test/com/sun/crypto/provider/Mac/HmacSaltLengths.java @@ -27,6 +27,7 @@ * @summary ensures various salt lengths can be used for * HmacPBESHA1. * @author Valerie Peng + * @key randomness */ import java.io.*; diff --git a/jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java b/jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java index 8d97f1a6a88..598ea6a910c 100644 --- a/jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java +++ b/jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java @@ -35,6 +35,7 @@ import javax.crypto.spec.SecretKeySpec; * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin * @build Utils * @run main MacSameTest + * @key randomness */ public class MacSameTest implements MacTest { diff --git a/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java b/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java index 67dea226bd1..b364312f0bd 100644 --- a/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java +++ b/jdk/test/com/sun/management/ThreadMXBean/ThreadCpuTimeArray.java @@ -27,6 +27,7 @@ * @summary Basic test of ThreadMXBean.getThreadCpuTime(long[]) and * getThreadUserTime(long[]). * @author Paul Hohensee + * @key randomness */ import java.lang.management.*; diff --git a/jdk/test/java/io/DataInputStream/ReadUTF.java b/jdk/test/java/io/DataInputStream/ReadUTF.java index 16f346499e1..02c0f75efd4 100644 --- a/jdk/test/java/io/DataInputStream/ReadUTF.java +++ b/jdk/test/java/io/DataInputStream/ReadUTF.java @@ -24,6 +24,7 @@ /* @test * @bug 4806007 * @summary Checks for vague exceptions from writeUTF/readUTF + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/io/File/GetXSpace.java b/jdk/test/java/io/File/GetXSpace.java index e9aed50bbed..726a205d295 100644 --- a/jdk/test/java/io/File/GetXSpace.java +++ b/jdk/test/java/io/File/GetXSpace.java @@ -28,6 +28,7 @@ * @run build GetXSpace * @run shell GetXSpace.sh * @summary Basic functionality of File.get-X-Space methods. + * @key randomness */ import java.io.BufferedReader; diff --git a/jdk/test/java/io/InputStream/TransferTo.java b/jdk/test/java/io/InputStream/TransferTo.java index a32df7a62a3..50d8569caf9 100644 --- a/jdk/test/java/io/InputStream/TransferTo.java +++ b/jdk/test/java/io/InputStream/TransferTo.java @@ -37,6 +37,7 @@ import static java.lang.String.format; * @bug 8066867 * @summary tests whether java.io.InputStream.transferTo conforms to its * contract defined in the javadoc + * @key randomness */ public class TransferTo { diff --git a/jdk/test/java/io/PrintStream/OversynchronizedTest.java b/jdk/test/java/io/PrintStream/OversynchronizedTest.java index 1f687f8cab6..c5ac2bb2b80 100644 --- a/jdk/test/java/io/PrintStream/OversynchronizedTest.java +++ b/jdk/test/java/io/PrintStream/OversynchronizedTest.java @@ -24,6 +24,7 @@ /* @test @bug 4905777 @summary PrintStream.println(Object) oversynchronized, can deadlock + @key randomness */ import java.io.PrintStream; diff --git a/jdk/test/java/io/Serializable/corruptedUTFConsumption/CorruptedUTFConsumption.java b/jdk/test/java/io/Serializable/corruptedUTFConsumption/CorruptedUTFConsumption.java index 0071b8d3acf..3cae0268be3 100644 --- a/jdk/test/java/io/Serializable/corruptedUTFConsumption/CorruptedUTFConsumption.java +++ b/jdk/test/java/io/Serializable/corruptedUTFConsumption/CorruptedUTFConsumption.java @@ -28,6 +28,7 @@ * ObjectInputStream consumes at most the expected number of utf * bytes, even if the last byte(s) of the utf string indicate that the * string overflows its expected length. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/io/Serializable/longString/LongString.java b/jdk/test/java/io/Serializable/longString/LongString.java index 3e1b4c3129f..6fbf3e340c8 100644 --- a/jdk/test/java/io/Serializable/longString/LongString.java +++ b/jdk/test/java/io/Serializable/longString/LongString.java @@ -25,6 +25,7 @@ * @bug 4217676 * @summary Ensure that object streams support serialization of long strings * (strings whose UTF representation > 64k in length) + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/io/Serializable/proxy/Basic.java b/jdk/test/java/io/Serializable/proxy/Basic.java index 402f797b139..3519334710b 100644 --- a/jdk/test/java/io/Serializable/proxy/Basic.java +++ b/jdk/test/java/io/Serializable/proxy/Basic.java @@ -23,6 +23,7 @@ /* @test * @summary Verifies basic correct functioning of proxy serialization. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/io/Serializable/sanityCheck/SanityCheck.java b/jdk/test/java/io/Serializable/sanityCheck/SanityCheck.java index 486f55b547b..e2659868fe8 100644 --- a/jdk/test/java/io/Serializable/sanityCheck/SanityCheck.java +++ b/jdk/test/java/io/Serializable/sanityCheck/SanityCheck.java @@ -24,6 +24,7 @@ /* @test * @summary Basic sanity check to test if default (de)serialization is * transmitting values properly. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/lang/Boolean/MakeBooleanComparable.java b/jdk/test/java/lang/Boolean/MakeBooleanComparable.java index 900900a2c5d..81478209c85 100644 --- a/jdk/test/java/lang/Boolean/MakeBooleanComparable.java +++ b/jdk/test/java/lang/Boolean/MakeBooleanComparable.java @@ -26,6 +26,7 @@ * @bug 4329937 * @summary Basic test for making Boolean implement Comparable * @author Josh Bloch + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/lang/ClassLoader/Assert.java b/jdk/test/java/lang/ClassLoader/Assert.java index 2abe45ac156..fb2376d45d4 100644 --- a/jdk/test/java/lang/ClassLoader/Assert.java +++ b/jdk/test/java/lang/ClassLoader/Assert.java @@ -28,6 +28,7 @@ * @run main/othervm Assert * @summary Test the assertion facility * @author Mike McCloskey + * @key randomness */ import package1.*; diff --git a/jdk/test/java/lang/Compare.java b/jdk/test/java/lang/Compare.java index c037f76fd3c..eba0ae93c1e 100644 --- a/jdk/test/java/lang/Compare.java +++ b/jdk/test/java/lang/Compare.java @@ -25,6 +25,7 @@ * @test * @bug 6582946 * @summary Test the primitive wrappers compare and compareTo methods + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java index b99ae5de1c1..14ac2f0f567 100644 --- a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java +++ b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java @@ -26,6 +26,7 @@ * @bug 4826774 * @summary Numerical tests for hexadecimal inputs to parseDouble, parseFloat * @author Joseph D. Darcy + * @key randomness */ diff --git a/jdk/test/java/lang/Enum/ValueOf.java b/jdk/test/java/lang/Enum/ValueOf.java index d01b9083ae5..711819653df 100644 --- a/jdk/test/java/lang/Enum/ValueOf.java +++ b/jdk/test/java/lang/Enum/ValueOf.java @@ -29,6 +29,7 @@ * * @compile ValueOf.java * @run main ValueOf + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/lang/HashCode.java b/jdk/test/java/lang/HashCode.java index d113cb0d0fd..5f1d03f491a 100644 --- a/jdk/test/java/lang/HashCode.java +++ b/jdk/test/java/lang/HashCode.java @@ -25,6 +25,7 @@ * @test * @bug 4245470 7088913 * @summary Test the primitive wrappers hashCode() + * @key randomness */ import java.util.Objects; diff --git a/jdk/test/java/lang/Integer/BitTwiddle.java b/jdk/test/java/lang/Integer/BitTwiddle.java index 6926facb5a4..8796c0769ea 100644 --- a/jdk/test/java/lang/Integer/BitTwiddle.java +++ b/jdk/test/java/lang/Integer/BitTwiddle.java @@ -26,6 +26,7 @@ * @bug 4495754 * @summary Basic test for int bit twiddling * @author Josh Bloch + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/Long/BitTwiddle.java b/jdk/test/java/lang/Long/BitTwiddle.java index 5a34ccec3ec..0132ea463dc 100644 --- a/jdk/test/java/lang/Long/BitTwiddle.java +++ b/jdk/test/java/lang/Long/BitTwiddle.java @@ -26,6 +26,7 @@ * @bug 4495754 * @summary Basic test for long bit twiddling * @author Josh Bloch + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/Math/CubeRootTests.java b/jdk/test/java/lang/Math/CubeRootTests.java index 116a7f4d4a7..8ce79d33d3a 100644 --- a/jdk/test/java/lang/Math/CubeRootTests.java +++ b/jdk/test/java/lang/Math/CubeRootTests.java @@ -26,6 +26,7 @@ * @bug 4347132 4939441 * @summary Tests for {Math, StrictMath}.cbrt * @author Joseph D. Darcy + * @key randomness */ public class CubeRootTests { diff --git a/jdk/test/java/lang/Math/HypotTests.java b/jdk/test/java/lang/Math/HypotTests.java index 1c1ff8c4d5d..afcec4d8642 100644 --- a/jdk/test/java/lang/Math/HypotTests.java +++ b/jdk/test/java/lang/Math/HypotTests.java @@ -26,6 +26,7 @@ * @bug 4851638 4939441 * @summary Tests for {Math, StrictMath}.hypot * @author Joseph D. Darcy + * @key randomness */ public class HypotTests { diff --git a/jdk/test/java/lang/Math/IeeeRecommendedTests.java b/jdk/test/java/lang/Math/IeeeRecommendedTests.java index d1d28245850..710bfa339a8 100644 --- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java +++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java @@ -26,6 +26,7 @@ * @bug 4860891 4826732 4780454 4939441 4826652 * @summary Tests for IEEE 754[R] recommended functions and similar methods * @author Joseph D. Darcy + * @key randomness */ public class IeeeRecommendedTests { diff --git a/jdk/test/java/lang/Math/Log1pTests.java b/jdk/test/java/lang/Math/Log1pTests.java index eb4e8800224..191f5433bd6 100644 --- a/jdk/test/java/lang/Math/Log1pTests.java +++ b/jdk/test/java/lang/Math/Log1pTests.java @@ -26,6 +26,7 @@ * @bug 4851638 4939441 * @summary Tests for {Math, StrictMath}.log1p * @author Joseph D. Darcy + * @key randomness */ public class Log1pTests { diff --git a/jdk/test/java/lang/Runtime/exec/WinCommand.java b/jdk/test/java/lang/Runtime/exec/WinCommand.java index 1504c891eab..0d4c256393a 100644 --- a/jdk/test/java/lang/Runtime/exec/WinCommand.java +++ b/jdk/test/java/lang/Runtime/exec/WinCommand.java @@ -25,6 +25,7 @@ * @bug 5006520 * @summary Check many different ways to run Windows programs * @author Martin Buchholz + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/lang/String/ContentEquals.java b/jdk/test/java/lang/String/ContentEquals.java index 2231b71d0c7..eb46f58abab 100644 --- a/jdk/test/java/lang/String/ContentEquals.java +++ b/jdk/test/java/lang/String/ContentEquals.java @@ -25,6 +25,7 @@ * @test * @bug 4242309 4982981 * @summary Test equals and contentEquals in String + * @key randomness */ import java.util.Random; import java.nio.CharBuffer; diff --git a/jdk/test/java/lang/String/ICCBasher.java b/jdk/test/java/lang/String/ICCBasher.java index ed9a780629c..33cb1a2d7ee 100644 --- a/jdk/test/java/lang/String/ICCBasher.java +++ b/jdk/test/java/lang/String/ICCBasher.java @@ -25,6 +25,7 @@ * @test * @bug 4152868 * @summary test Case Insensitive Comparator in String + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/lang/String/SBConstructor.java b/jdk/test/java/lang/String/SBConstructor.java index 7566fea4379..0b38ed0c54e 100644 --- a/jdk/test/java/lang/String/SBConstructor.java +++ b/jdk/test/java/lang/String/SBConstructor.java @@ -25,7 +25,7 @@ * @test * @bug 4915187 * @summary Test java.lang.String constructor that takes StringBuilder - * + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/lang/String/Split.java b/jdk/test/java/lang/String/Split.java index a70213a61ca..d95a26a56bc 100644 --- a/jdk/test/java/lang/String/Split.java +++ b/jdk/test/java/lang/String/Split.java @@ -25,6 +25,7 @@ * @test * @bug 6840246 6559590 * @summary test String.split() + * @key randomness */ import java.util.Arrays; import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/AppendCharSequence.java b/jdk/test/java/lang/StringBuffer/AppendCharSequence.java index b7738ac68d1..e6012ca2718 100644 --- a/jdk/test/java/lang/StringBuffer/AppendCharSequence.java +++ b/jdk/test/java/lang/StringBuffer/AppendCharSequence.java @@ -24,6 +24,7 @@ /* @test * @bug 4812591 4705328 5019111 * @summary Test append and insert methods with CharSequence params + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/AppendSB.java b/jdk/test/java/lang/StringBuffer/AppendSB.java index f1bcc475074..2ecc37903a1 100644 --- a/jdk/test/java/lang/StringBuffer/AppendSB.java +++ b/jdk/test/java/lang/StringBuffer/AppendSB.java @@ -24,6 +24,7 @@ /* @test * @bug 4144267 * @summary Test StringBuffer.append(StringBuffer); + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/AppendStringBuilder.java b/jdk/test/java/lang/StringBuffer/AppendStringBuilder.java index a27f6a12a28..fed81ac253b 100644 --- a/jdk/test/java/lang/StringBuffer/AppendStringBuilder.java +++ b/jdk/test/java/lang/StringBuffer/AppendStringBuilder.java @@ -23,6 +23,7 @@ /* @test * @bug 6206780 * @summary Test StringBuffer.append(StringBuilder); + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/Capacity.java b/jdk/test/java/lang/StringBuffer/Capacity.java index 4d2bc83445a..937ad8f9a76 100644 --- a/jdk/test/java/lang/StringBuffer/Capacity.java +++ b/jdk/test/java/lang/StringBuffer/Capacity.java @@ -25,6 +25,7 @@ * @test * @bug 6952330 * @summary Test StringBuffer/StringBuilder capacity handling. + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/IndexOf.java b/jdk/test/java/lang/StringBuffer/IndexOf.java index f5741d80ed8..aceb25265b7 100644 --- a/jdk/test/java/lang/StringBuffer/IndexOf.java +++ b/jdk/test/java/lang/StringBuffer/IndexOf.java @@ -24,6 +24,7 @@ /* @test * @bug 4162796 4162796 * @summary Test indexOf and lastIndexOf + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuffer/SBBasher.java b/jdk/test/java/lang/StringBuffer/SBBasher.java index 9155f3b99c0..4cc6be46fb0 100644 --- a/jdk/test/java/lang/StringBuffer/SBBasher.java +++ b/jdk/test/java/lang/StringBuffer/SBBasher.java @@ -25,7 +25,7 @@ * @test * @bug 4120694 * @summary Test new methods in StringBuffer - * + * @key randomness */ import java.lang.*; diff --git a/jdk/test/java/lang/StringBuffer/Trim.java b/jdk/test/java/lang/StringBuffer/Trim.java index 3d1cc6acd91..d44720d9d45 100644 --- a/jdk/test/java/lang/StringBuffer/Trim.java +++ b/jdk/test/java/lang/StringBuffer/Trim.java @@ -24,6 +24,7 @@ /* @test * @bug 4546734 5007612 * @summary Test StringBuffer.trimToSize + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/StringBuilder/AppendStringBuffer.java b/jdk/test/java/lang/StringBuilder/AppendStringBuffer.java index a54cf0a0d29..3cb1de55a84 100644 --- a/jdk/test/java/lang/StringBuilder/AppendStringBuffer.java +++ b/jdk/test/java/lang/StringBuilder/AppendStringBuffer.java @@ -24,6 +24,7 @@ /* @test * @bug 6206780 * @summary Test StringBuilder.append(StringBuffer); + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/ToString.java b/jdk/test/java/lang/ToString.java index 3d90dd0c69c..181a4ec44d6 100644 --- a/jdk/test/java/lang/ToString.java +++ b/jdk/test/java/lang/ToString.java @@ -25,6 +25,7 @@ * @test * @bug 4031762 * @summary Test the primitive wrappers static toString() + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/lang/instrument/SingleTransformerTest.java b/jdk/test/java/lang/instrument/SingleTransformerTest.java index bcbf04d8a97..d04adf1b266 100644 --- a/jdk/test/java/lang/instrument/SingleTransformerTest.java +++ b/jdk/test/java/lang/instrument/SingleTransformerTest.java @@ -30,6 +30,7 @@ * @run build SingleTransformerTest * @run shell MakeJAR.sh redefineAgent * @run main/othervm -javaagent:redefineAgent.jar SingleTransformerTest SingleTransformerTest + * @key randomness */ public class SingleTransformerTest diff --git a/jdk/test/java/lang/instrument/TransformMethodTest.java b/jdk/test/java/lang/instrument/TransformMethodTest.java index 38e48d5288f..610729f1185 100644 --- a/jdk/test/java/lang/instrument/TransformMethodTest.java +++ b/jdk/test/java/lang/instrument/TransformMethodTest.java @@ -30,6 +30,7 @@ * @run build TransformMethodTest * @run shell MakeJAR.sh redefineAgent * @run main/othervm -javaagent:redefineAgent.jar TransformMethodTest TransformMethodTest + * @key randomness */ import java.lang.instrument.*; diff --git a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java index 44e11e0985d..1d3cbeb64d1 100644 --- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java +++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java @@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit; * @library /lib/testlibrary/jsr292 /lib/testlibrary/ * @compile CatchExceptionTest.java * @run main/othervm -esa test.java.lang.invoke.MethodHandles.CatchExceptionTest - * @key intermittent + * @key intermittent randomness */ public class CatchExceptionTest { private static final List> ARGS_CLASSES; diff --git a/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java b/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java index 6bdd96a2fa8..180551fdd26 100644 --- a/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java +++ b/jdk/test/java/lang/management/BufferPoolMXBean/Basic.java @@ -25,6 +25,7 @@ * @bug 6606598 7024172 * @summary Unit test for java.lang.management.BufferPoolMXBean * @run main/othervm Basic + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/math/BigDecimal/StringConstructor.java b/jdk/test/java/math/BigDecimal/StringConstructor.java index c8051eb98a5..08c88a2672c 100644 --- a/jdk/test/java/math/BigDecimal/StringConstructor.java +++ b/jdk/test/java/math/BigDecimal/StringConstructor.java @@ -26,6 +26,7 @@ * @library .. * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460 * @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed). + * @key randomness */ import java.math.*; diff --git a/jdk/test/java/math/BigInteger/BigIntegerTest.java b/jdk/test/java/math/BigInteger/BigIntegerTest.java index e1b36c0812b..8bab07e63c0 100644 --- a/jdk/test/java/math/BigInteger/BigIntegerTest.java +++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java @@ -28,6 +28,7 @@ * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed) * @run main/timeout=400 BigIntegerTest * @author madbot + * @key randomness */ import java.io.File; diff --git a/jdk/test/java/math/BigInteger/ModPow65537.java b/jdk/test/java/math/BigInteger/ModPow65537.java index f8e4a5422d1..e7d2b17c6bf 100644 --- a/jdk/test/java/math/BigInteger/ModPow65537.java +++ b/jdk/test/java/math/BigInteger/ModPow65537.java @@ -27,6 +27,7 @@ * @bug 4891312 8074460 * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed) * @author Andreas Sterbenz + * @key randomness */ import java.math.BigInteger; diff --git a/jdk/test/java/math/BigInteger/PrimeTest.java b/jdk/test/java/math/BigInteger/PrimeTest.java index fae4fd7979b..62adf777cdf 100644 --- a/jdk/test/java/math/BigInteger/PrimeTest.java +++ b/jdk/test/java/math/BigInteger/PrimeTest.java @@ -29,6 +29,7 @@ * @bug 8026236 8074460 * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed) * @author bpb + * @key randomness */ import java.math.BigInteger; import java.util.BitSet; diff --git a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java index d3cb73cbef2..25e39e49636 100644 --- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java +++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java @@ -29,6 +29,7 @@ * @bug 6910473 8021204 8021203 9005933 8074460 * @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed) * @author Dmitry Nadezhin + * @key randomness */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/jdk/test/java/net/InetAddress/HashSpread.java b/jdk/test/java/net/InetAddress/HashSpread.java index 17f59438470..990eb531bd7 100644 --- a/jdk/test/java/net/InetAddress/HashSpread.java +++ b/jdk/test/java/net/InetAddress/HashSpread.java @@ -26,6 +26,7 @@ * @bug 4687909 * @summary Check Inet6Address.hashCode returns a reasonable spread of hash * codes. + * @key randomness */ import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/jdk/test/java/nio/Buffer/Chars.java b/jdk/test/java/nio/Buffer/Chars.java index ef2df66ac14..01b53ea2405 100644 --- a/jdk/test/java/nio/Buffer/Chars.java +++ b/jdk/test/java/nio/Buffer/Chars.java @@ -26,6 +26,7 @@ * @bug 8014854 * @summary Exercises CharBuffer#chars on each of the CharBuffer types * @run testng Chars + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/MappedByteBuffer/Force.java b/jdk/test/java/nio/MappedByteBuffer/Force.java index 52717642c94..f9ae0810bce 100644 --- a/jdk/test/java/nio/MappedByteBuffer/Force.java +++ b/jdk/test/java/nio/MappedByteBuffer/Force.java @@ -25,6 +25,7 @@ * @bug 4625907 * @summary Testing force() * @run main/othervm Force + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/MappedByteBuffer/ZeroMap.java b/jdk/test/java/nio/MappedByteBuffer/ZeroMap.java index 7c00bf72750..f28e1eb8963 100644 --- a/jdk/test/java/nio/MappedByteBuffer/ZeroMap.java +++ b/jdk/test/java/nio/MappedByteBuffer/ZeroMap.java @@ -25,6 +25,7 @@ * @bug 4802340 * @summary Testing force(), load() isLoaded() of zero len MBB * @run main/othervm ZeroMap + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java index 1c5da1309b3..0a62be8fc57 100644 --- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java +++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Basic.java @@ -24,6 +24,7 @@ /* @test * @bug 4607272 * @summary Unit test for AsynchronousChannelGroup + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java index 366449bfc32..654d5f92183 100644 --- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java +++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java @@ -24,6 +24,7 @@ /* @test * @bug 4607272 6842687 * @summary Unit test for AsynchronousChannelGroup + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java index 456f66a2eee..4d364017f0e 100644 --- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java +++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java @@ -24,6 +24,7 @@ /* @test * @bug 4607272 6842687 * @summary Unit test for AsynchronousChannelGroup + * @key randomness */ import java.nio.channels.*; diff --git a/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java b/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java index 10f51c978ca..55de744c0db 100644 --- a/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java +++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java @@ -24,6 +24,7 @@ /* @test * @bug 4607272 6822643 6830721 6842687 * @summary Unit test for AsynchronousFileChannel + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/channels/AsynchronousFileChannel/Lock.java b/jdk/test/java/nio/channels/AsynchronousFileChannel/Lock.java index a7f2c7bb0cb..13a094e7d25 100644 --- a/jdk/test/java/nio/channels/AsynchronousFileChannel/Lock.java +++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/Lock.java @@ -25,6 +25,7 @@ /* @test * @bug 4607272 6814948 6842687 * @summary Unit test for AsynchronousFileChannel#lock method + * @key randomness */ import java.net.*; diff --git a/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java b/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java index 02453e57f26..9c2d5ec3f6b 100644 --- a/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java +++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/LotsOfWrites.java @@ -24,6 +24,7 @@ /* @test * @bug 6913877 * @summary Stress AsynchronousFileChannel.write + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java index 9442f9b5408..23d9eb36e4e 100644 --- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java +++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java @@ -25,6 +25,7 @@ * @bug 4607272 6842687 6878369 6944810 7023403 * @summary Unit test for AsynchronousSocketChannel * @run main Basic -skipSlowConnectTest + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java b/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java index 4627aaa2a5a..8f8f816cad6 100644 --- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java +++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java @@ -26,6 +26,7 @@ * @summary Stress test connections through the loopback interface * @run main StressLoopback * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/Channels/Basic2.java b/jdk/test/java/nio/channels/Channels/Basic2.java index 27a56c56bca..73acdf7b3c2 100644 --- a/jdk/test/java/nio/channels/Channels/Basic2.java +++ b/jdk/test/java/nio/channels/Channels/Basic2.java @@ -25,6 +25,7 @@ * @bug 4607272 * @summary Test Channels methods for interoperability between streams and * asynchronous byte channels + * @key randomness */ import java.net.*; diff --git a/jdk/test/java/nio/channels/Channels/ShortWrite.java b/jdk/test/java/nio/channels/Channels/ShortWrite.java index 82c8f7265d8..d39f69e4842 100644 --- a/jdk/test/java/nio/channels/Channels/ShortWrite.java +++ b/jdk/test/java/nio/channels/Channels/ShortWrite.java @@ -25,6 +25,7 @@ * @bug 6448457 * @summary Test Channels.newOutputStream returns OutputStream that handles * short writes from the underlying channel + * @key randomness */ import java.io.OutputStream; diff --git a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java index 7937b56c59f..b8ec1c1060b 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java +++ b/jdk/test/java/nio/channels/DatagramChannel/AdaptDatagramSocket.java @@ -25,6 +25,7 @@ * @bug 4313882 4981129 * @summary Unit test for datagram-socket-channel adaptors * @library .. + * @key randomness */ import java.net.*; diff --git a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java index 848f2820954..db061a833fc 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java +++ b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java @@ -27,6 +27,7 @@ * @build MulticastSendReceiveTests NetworkConfiguration * @run main MulticastSendReceiveTests * @run main/othervm -Djava.net.preferIPv4Stack=true MulticastSendReceiveTests + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java index 027b4b79eea..884baaf581a 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java +++ b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java @@ -28,6 +28,7 @@ * @build Promiscuous NetworkConfiguration * @run main Promiscuous * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/channels/FileChannel/AtomicAppend.java b/jdk/test/java/nio/channels/FileChannel/AtomicAppend.java index 25f6b64924c..8e00c60bfd4 100644 --- a/jdk/test/java/nio/channels/FileChannel/AtomicAppend.java +++ b/jdk/test/java/nio/channels/FileChannel/AtomicAppend.java @@ -24,6 +24,7 @@ /* * @test * @summary Check that appends are atomic + * @key randomness */ import java.io.File; diff --git a/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java b/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java index 153a2ad451f..a14d111b6f0 100644 --- a/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java +++ b/jdk/test/java/nio/channels/FileChannel/ClosedByInterrupt.java @@ -25,6 +25,7 @@ * @bug 6979009 * @summary Ensure ClosedByInterruptException is thrown when I/O operation * interrupted by Thread.interrupt + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/MapTest.java b/jdk/test/java/nio/channels/FileChannel/MapTest.java index 066d6097389..f2bbb08680e 100644 --- a/jdk/test/java/nio/channels/FileChannel/MapTest.java +++ b/jdk/test/java/nio/channels/FileChannel/MapTest.java @@ -25,6 +25,7 @@ * @bug 4429043 8002180 * @summary Test file mapping with FileChannel * @run main/othervm MapTest + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Position.java b/jdk/test/java/nio/channels/FileChannel/Position.java index cbb7dd9de6e..825ba628248 100644 --- a/jdk/test/java/nio/channels/FileChannel/Position.java +++ b/jdk/test/java/nio/channels/FileChannel/Position.java @@ -24,6 +24,7 @@ /* @test * @bug 4429043 6526860 * @summary Test position method of FileChannel + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Pread.java b/jdk/test/java/nio/channels/FileChannel/Pread.java index fca93f97f3f..8e3dd026c94 100644 --- a/jdk/test/java/nio/channels/FileChannel/Pread.java +++ b/jdk/test/java/nio/channels/FileChannel/Pread.java @@ -24,6 +24,7 @@ /* @test * @bug 4862382 4862408 * @summary Test positional read method of FileChannel + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Pwrite.java b/jdk/test/java/nio/channels/FileChannel/Pwrite.java index 21f1c298b63..94f7780328e 100644 --- a/jdk/test/java/nio/channels/FileChannel/Pwrite.java +++ b/jdk/test/java/nio/channels/FileChannel/Pwrite.java @@ -24,6 +24,7 @@ /* @test * @bug 4862411 * @summary Test positional write method of FileChannel + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Size.java b/jdk/test/java/nio/channels/FileChannel/Size.java index 8a658e07b05..d06ba81fa51 100644 --- a/jdk/test/java/nio/channels/FileChannel/Size.java +++ b/jdk/test/java/nio/channels/FileChannel/Size.java @@ -25,6 +25,7 @@ * @bug 4563125 * @summary Test size method of FileChannel * @run main/othervm Size + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Transfer.java b/jdk/test/java/nio/channels/FileChannel/Transfer.java index e9524be7b5f..04a0f3251b2 100644 --- a/jdk/test/java/nio/channels/FileChannel/Transfer.java +++ b/jdk/test/java/nio/channels/FileChannel/Transfer.java @@ -26,6 +26,7 @@ * 6984545 * @summary Test FileChannel.transferFrom and transferTo * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/FileChannel/Truncate.java b/jdk/test/java/nio/channels/FileChannel/Truncate.java index ff62d724a98..38a020d7de8 100644 --- a/jdk/test/java/nio/channels/FileChannel/Truncate.java +++ b/jdk/test/java/nio/channels/FileChannel/Truncate.java @@ -24,6 +24,7 @@ /* @test * @bug 6191269 6709457 8000330 * @summary Test truncate method of FileChannel + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/Pipe/PipeChannel.java b/jdk/test/java/nio/channels/Pipe/PipeChannel.java index 0ec9aaed735..2aaa4f84f08 100644 --- a/jdk/test/java/nio/channels/Pipe/PipeChannel.java +++ b/jdk/test/java/nio/channels/Pipe/PipeChannel.java @@ -23,6 +23,7 @@ /* @test * @summary Test reading and writing from Pipes + * @key randomness */ import java.io.*; @@ -37,7 +38,7 @@ import java.util.Random; */ public class PipeChannel { - private static Random generator = new Random(); + private static Random generator = new Random(); public static void main(String[] args) throws Exception { for (int x=0; x<100; x++) { diff --git a/jdk/test/java/nio/channels/Pipe/ScatteringRead.java b/jdk/test/java/nio/channels/Pipe/ScatteringRead.java index 83b520ceda5..a2685eea55f 100644 --- a/jdk/test/java/nio/channels/Pipe/ScatteringRead.java +++ b/jdk/test/java/nio/channels/Pipe/ScatteringRead.java @@ -22,8 +22,9 @@ */ /* @test - @bug 4526754 + * @bug 4526754 * @summary Test Pipe scattering reads + * @key randomness */ import java.nio.channels.*; diff --git a/jdk/test/java/nio/channels/Pipe/SelectPipe.java b/jdk/test/java/nio/channels/Pipe/SelectPipe.java index 85938eb1789..f782ee3ae1f 100644 --- a/jdk/test/java/nio/channels/Pipe/SelectPipe.java +++ b/jdk/test/java/nio/channels/Pipe/SelectPipe.java @@ -23,6 +23,7 @@ /* @test * @summary Test selection of ready pipe + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/Selector/SelectorTest.java b/jdk/test/java/nio/channels/Selector/SelectorTest.java index 8e835d88e2b..bd17d001816 100644 --- a/jdk/test/java/nio/channels/Selector/SelectorTest.java +++ b/jdk/test/java/nio/channels/Selector/SelectorTest.java @@ -24,6 +24,7 @@ /* @test * @summary Test selectors and socketchannels * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java b/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java index 7a425ad88ed..1b985e8c68a 100644 --- a/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java +++ b/jdk/test/java/nio/channels/ServerSocketChannel/NonBlockingAccept.java @@ -27,6 +27,7 @@ * @library .. * @build TestUtil * @run main NonBlockingAccept + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/SocketChannel/CloseDuringWrite.java b/jdk/test/java/nio/channels/SocketChannel/CloseDuringWrite.java index 83d05bfd96e..50b7dbb3747 100644 --- a/jdk/test/java/nio/channels/SocketChannel/CloseDuringWrite.java +++ b/jdk/test/java/nio/channels/SocketChannel/CloseDuringWrite.java @@ -23,6 +23,7 @@ /* @test * @summary Test asynchronous close during a blocking write + * @key randomness */ import java.io.Closeable; diff --git a/jdk/test/java/nio/channels/SocketChannel/OutOfBand.java b/jdk/test/java/nio/channels/SocketChannel/OutOfBand.java index 68b973dca89..cd46f9ee6a2 100644 --- a/jdk/test/java/nio/channels/SocketChannel/OutOfBand.java +++ b/jdk/test/java/nio/channels/SocketChannel/OutOfBand.java @@ -24,6 +24,7 @@ /* @test * @summary Test socket adapter sendUrgentData method * @bug 6963907 + * @key randomness */ import java.net.*; diff --git a/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java b/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java index 0988006800a..c1d7c33fc5d 100644 --- a/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java +++ b/jdk/test/java/nio/channels/SocketChannel/ShortWrite.java @@ -24,6 +24,7 @@ /* @test * @bug 7176630 7074436 * @summary Check for short writes on SocketChannels configured in blocking mode + * @key randomness */ import java.net.*; diff --git a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java index 84c5a7f59e8..d7975dbfa44 100644 --- a/jdk/test/java/nio/channels/SocketChannel/VectorIO.java +++ b/jdk/test/java/nio/channels/SocketChannel/VectorIO.java @@ -24,6 +24,7 @@ /* @test * @summary Test socketchannel vector IO * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java b/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java index 8d99fde7a41..292851873ca 100644 --- a/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java +++ b/jdk/test/java/nio/channels/etc/AdaptorCloseAndInterrupt.java @@ -24,6 +24,7 @@ /* @test * @bug 7184932 * @summary Test asynchronous close and interrupt of timed socket adapter methods + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/charset/coders/BashCache.java b/jdk/test/java/nio/charset/coders/BashCache.java index 2019af82393..2ded5c0ce07 100644 --- a/jdk/test/java/nio/charset/coders/BashCache.java +++ b/jdk/test/java/nio/charset/coders/BashCache.java @@ -24,6 +24,7 @@ /* @test * @bug 4517279 * @summary Stochastic test of thread-local coder caches + * @key randomness */ import java.nio.*; diff --git a/jdk/test/java/nio/charset/coders/BashStreams.java b/jdk/test/java/nio/charset/coders/BashStreams.java index 5781464aeee..15ea14c3ddf 100644 --- a/jdk/test/java/nio/charset/coders/BashStreams.java +++ b/jdk/test/java/nio/charset/coders/BashStreams.java @@ -23,6 +23,7 @@ /* @test * @summary Stochastic test of charset-based streams + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/nio/file/Files/BytesAndLines.java b/jdk/test/java/nio/file/Files/BytesAndLines.java index c3a1db74ce1..ca486ab87fc 100644 --- a/jdk/test/java/nio/file/Files/BytesAndLines.java +++ b/jdk/test/java/nio/file/Files/BytesAndLines.java @@ -27,6 +27,7 @@ * @run testng BytesAndLines * @summary Unit test for methods for Files readAllBytes, readAllLines and * and write methods. + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/file/Files/CopyAndMove.java b/jdk/test/java/nio/file/Files/CopyAndMove.java index 4853b0dcdf4..38470cc810b 100644 --- a/jdk/test/java/nio/file/Files/CopyAndMove.java +++ b/jdk/test/java/nio/file/Files/CopyAndMove.java @@ -27,6 +27,7 @@ * @library .. * @build CopyAndMove PassThroughFileSystem * @run main/othervm CopyAndMove + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java b/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java index bcdc4e1256c..d7bbdd974bc 100644 --- a/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java +++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSiblings.java @@ -27,6 +27,7 @@ * @library ../.. * @compile SkipSiblings.java CreateFileTree.java * @run main SkipSiblings + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java b/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java index c5522839b5b..8a2eeb7d1ff 100644 --- a/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java +++ b/jdk/test/java/nio/file/Files/walkFileTree/SkipSubtree.java @@ -27,6 +27,7 @@ * @library ../.. * @compile SkipSubtree.java CreateFileTree.java * @run main SkipSubtree + * @key randomness */ import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; diff --git a/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java b/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java index a4b3cf724d5..445b7bfe33c 100644 --- a/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java +++ b/jdk/test/java/nio/file/Files/walkFileTree/TerminateWalk.java @@ -27,6 +27,7 @@ * @library ../.. * @compile TerminateWalk.java CreateFileTree.java * @run main TerminateWalk + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/WatchService/LotsOfEvents.java b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java index 64ab7aca65d..042dfd94146 100644 --- a/jdk/test/java/nio/file/WatchService/LotsOfEvents.java +++ b/jdk/test/java/nio/file/WatchService/LotsOfEvents.java @@ -26,6 +26,7 @@ * @summary Tests WatchService behavior when lots of events are pending * @library .. * @run main/timeout=180 LotsOfEvents + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/WatchService/MayFlies.java b/jdk/test/java/nio/file/WatchService/MayFlies.java index ad0ed4c4131..3052ff6e695 100644 --- a/jdk/test/java/nio/file/WatchService/MayFlies.java +++ b/jdk/test/java/nio/file/WatchService/MayFlies.java @@ -27,6 +27,7 @@ * short lived files * @library .. * @run main MayFlies + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java index 4b7629db204..823539d1a23 100644 --- a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java +++ b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java @@ -26,6 +26,7 @@ * @summary Sanity test for Sun-specific sensitivity level watch event modifier * @library .. * @run main/timeout=240 SensitivityModifier + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/attribute/AclFileAttributeView/Basic.java b/jdk/test/java/nio/file/attribute/AclFileAttributeView/Basic.java index aa613e22b78..00afd2cd1bf 100644 --- a/jdk/test/java/nio/file/attribute/AclFileAttributeView/Basic.java +++ b/jdk/test/java/nio/file/attribute/AclFileAttributeView/Basic.java @@ -25,6 +25,7 @@ * @bug 4313887 6838333 6891404 * @summary Unit test for java.nio.file.attribute.AclFileAttribueView * @library ../.. + * @key randomness */ import java.nio.file.*; diff --git a/jdk/test/java/nio/file/attribute/FileTime/Basic.java b/jdk/test/java/nio/file/attribute/FileTime/Basic.java index 8731ce77147..9e18d81d3db 100644 --- a/jdk/test/java/nio/file/attribute/FileTime/Basic.java +++ b/jdk/test/java/nio/file/attribute/FileTime/Basic.java @@ -24,6 +24,7 @@ /* @test * @bug 6844313 8011647 * @summary Unit test for java.nio.file.FileTime + * @key randomness */ diff --git a/jdk/test/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java b/jdk/test/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java index 69393a30a61..5f40d193cf0 100644 --- a/jdk/test/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java +++ b/jdk/test/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java @@ -25,6 +25,7 @@ * @bug 4313887 6838333 * @summary Unit test for java.nio.file.attribute.UserDefinedFileAttributeView * @library ../.. + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/java/security/MessageDigest/ByteBuffers.java b/jdk/test/java/security/MessageDigest/ByteBuffers.java index 4ce30846368..dd3467d0e67 100644 --- a/jdk/test/java/security/MessageDigest/ByteBuffers.java +++ b/jdk/test/java/security/MessageDigest/ByteBuffers.java @@ -26,6 +26,7 @@ * @bug 4844847 * @summary Test the MessageDigest.update(ByteBuffer) method * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/security/MessageDigest/TestDigestIOStream.java b/jdk/test/java/security/MessageDigest/TestDigestIOStream.java index 46028e85af8..868da86ef62 100644 --- a/jdk/test/java/security/MessageDigest/TestDigestIOStream.java +++ b/jdk/test/java/security/MessageDigest/TestDigestIOStream.java @@ -36,6 +36,7 @@ import static java.lang.System.out; * @bug 8050370 * @summary MessageDigest tests with DigestIOStream * @author Kevin Liu + * @key randomness */ enum ReadModel { diff --git a/jdk/test/java/security/MessageDigest/TestSameLength.java b/jdk/test/java/security/MessageDigest/TestSameLength.java index eb59815c9bd..666baf3e69e 100644 --- a/jdk/test/java/security/MessageDigest/TestSameLength.java +++ b/jdk/test/java/security/MessageDigest/TestSameLength.java @@ -33,6 +33,7 @@ import java.util.Random; * @summary Check md.getDigestLength() equal digest output length with various * algorithm/dataLen/(update,digest methods). * @author Kevin Liu + * @key randomness */ public class TestSameLength { diff --git a/jdk/test/java/security/MessageDigest/TestSameValue.java b/jdk/test/java/security/MessageDigest/TestSameValue.java index aef4ceae402..56b8652264a 100644 --- a/jdk/test/java/security/MessageDigest/TestSameValue.java +++ b/jdk/test/java/security/MessageDigest/TestSameValue.java @@ -34,6 +34,7 @@ import java.util.Random; * @summary Check md.digest(data) value whether same with digest output value * with various update/digest methods. * @author Kevin Liu + * @key randomness */ public class TestSameValue { diff --git a/jdk/test/java/security/Signature/ByteBuffers.java b/jdk/test/java/security/Signature/ByteBuffers.java index e3063511d90..937c9842c3b 100644 --- a/jdk/test/java/security/Signature/ByteBuffers.java +++ b/jdk/test/java/security/Signature/ByteBuffers.java @@ -26,6 +26,7 @@ * @bug 4844847 * @summary Test the Signature.update(ByteBuffer) method * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/security/Signature/NONEwithRSA.java b/jdk/test/java/security/Signature/NONEwithRSA.java index 16f7b53f087..6d18c7ac96f 100644 --- a/jdk/test/java/security/Signature/NONEwithRSA.java +++ b/jdk/test/java/security/Signature/NONEwithRSA.java @@ -26,6 +26,7 @@ * @bug 4955844 * @summary ensure that the NONEwithRSA adapter works correctly * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/security/spec/EllipticCurveMatch.java b/jdk/test/java/security/spec/EllipticCurveMatch.java index 797f6d2e0f3..85af7df9a34 100644 --- a/jdk/test/java/security/spec/EllipticCurveMatch.java +++ b/jdk/test/java/security/spec/EllipticCurveMatch.java @@ -26,6 +26,7 @@ * @bug 6738532 * @summary Check EllipticCurve.equals() does not compare seed value of curve. * @author Mike StJohns + * @key randomness */ import java.security.spec.*; diff --git a/jdk/test/java/sql/JavatimeTest.java b/jdk/test/java/sql/JavatimeTest.java index 3ff70d007d1..89344d7cdc6 100644 --- a/jdk/test/java/sql/JavatimeTest.java +++ b/jdk/test/java/sql/JavatimeTest.java @@ -25,6 +25,7 @@ *@test *@bug 8007520 *@summary Test those bridge methods to/from java.time date/time classes + * @key randomness */ import java.util.Random; diff --git a/jdk/test/java/text/Format/MessageFormat/Bug7003643.java b/jdk/test/java/text/Format/MessageFormat/Bug7003643.java index aeb722cac17..35af811d221 100644 --- a/jdk/test/java/text/Format/MessageFormat/Bug7003643.java +++ b/jdk/test/java/text/Format/MessageFormat/Bug7003643.java @@ -25,6 +25,7 @@ * @test * @bug 7003643 * @summary Make sure MessageFormat.toPattern produces correct quoting. (SPI part is tested in PluggableLocale tests.) + * @key randomness */ import java.text.*; diff --git a/jdk/test/java/util/Arrays/ArrayObjectMethods.java b/jdk/test/java/util/Arrays/ArrayObjectMethods.java index 8010f1b1d80..3d3e928b08c 100644 --- a/jdk/test/java/util/Arrays/ArrayObjectMethods.java +++ b/jdk/test/java/util/Arrays/ArrayObjectMethods.java @@ -26,6 +26,7 @@ * @bug 4906359 6239296 * @summary Basic test for content-based array object methods * @author Josh Bloch, Martin Buchholz + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Arrays/CopyMethods.java b/jdk/test/java/util/Arrays/CopyMethods.java index e19b8073a59..4e38e8adf21 100644 --- a/jdk/test/java/util/Arrays/CopyMethods.java +++ b/jdk/test/java/util/Arrays/CopyMethods.java @@ -26,6 +26,7 @@ * @bug 4655503 * @summary Test for array cloning and slicing methods. * @author John Rose + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Arrays/Correct.java b/jdk/test/java/util/Arrays/Correct.java index 93301619928..e9ddc7edef5 100644 --- a/jdk/test/java/util/Arrays/Correct.java +++ b/jdk/test/java/util/Arrays/Correct.java @@ -26,6 +26,7 @@ * @bug 4726380 8037097 * @summary Check that different sorts give equivalent results. * @run testng Correct + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Base64/TestBase64.java b/jdk/test/java/util/Base64/TestBase64.java index 5466cf33355..bb2330721ec 100644 --- a/jdk/test/java/util/Base64/TestBase64.java +++ b/jdk/test/java/util/Base64/TestBase64.java @@ -25,6 +25,7 @@ * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925 * 8014217 8025003 8026330 8028397 * @summary tests java.util.Base64 + * @key randomness */ import java.io.ByteArrayInputStream; diff --git a/jdk/test/java/util/BitSet/BSMethods.java b/jdk/test/java/util/BitSet/BSMethods.java index 86d7499a428..b8ed8b31999 100644 --- a/jdk/test/java/util/BitSet/BSMethods.java +++ b/jdk/test/java/util/BitSet/BSMethods.java @@ -27,6 +27,7 @@ * @summary Test the operation of the methods of BitSet class * @author Mike McCloskey, Martin Buchholz * @run main/othervm BSMethods + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/BitSet/ImportExport.java b/jdk/test/java/util/BitSet/ImportExport.java index 9554b2e4ba4..6d01ab4b7c5 100644 --- a/jdk/test/java/util/BitSet/ImportExport.java +++ b/jdk/test/java/util/BitSet/ImportExport.java @@ -26,6 +26,7 @@ * @bug 5037068 * @summary Test import/export constructors and methods * @author Martin Buchholz + * @key randomness */ import java.nio.*; diff --git a/jdk/test/java/util/BitSet/PreviousBits.java b/jdk/test/java/util/BitSet/PreviousBits.java index bba55318fdd..e83a6df27a8 100644 --- a/jdk/test/java/util/BitSet/PreviousBits.java +++ b/jdk/test/java/util/BitSet/PreviousBits.java @@ -25,6 +25,7 @@ * @test * @bug 6410729 6586631 * @summary Test previousClearBit, previousSetBit + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Calendar/JavatimeTest.java b/jdk/test/java/util/Calendar/JavatimeTest.java index 6a0a4ff9a66..7af6e9d4c03 100644 --- a/jdk/test/java/util/Calendar/JavatimeTest.java +++ b/jdk/test/java/util/Calendar/JavatimeTest.java @@ -25,6 +25,7 @@ *@test *@bug 8007520 8008254 *@summary Test those bridge methods to/from java.time date/time classes + * @key randomness */ import java.util.Calendar; diff --git a/jdk/test/java/util/Collection/MOAT.java b/jdk/test/java/util/Collection/MOAT.java index f55a1e87745..e04659c4dda 100644 --- a/jdk/test/java/util/Collection/MOAT.java +++ b/jdk/test/java/util/Collection/MOAT.java @@ -30,6 +30,7 @@ * @summary Run many tests on many Collection and Map implementations * @author Martin Buchholz * @run main MOAT + * @key randomness */ /* Mother Of All (Collection) Tests diff --git a/jdk/test/java/util/Collections/AddAll.java b/jdk/test/java/util/Collections/AddAll.java index dc768206085..0f8e6d9d527 100644 --- a/jdk/test/java/util/Collections/AddAll.java +++ b/jdk/test/java/util/Collections/AddAll.java @@ -26,6 +26,7 @@ * @bug 4822887 * @summary Basic test for Collections.addAll * @author Josh Bloch + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Collections/CheckedListBash.java b/jdk/test/java/util/Collections/CheckedListBash.java index dfaa8773d03..80d7e3fd475 100644 --- a/jdk/test/java/util/Collections/CheckedListBash.java +++ b/jdk/test/java/util/Collections/CheckedListBash.java @@ -26,6 +26,7 @@ * @bug 4904067 * @summary Unit test for Collections.checkedList * @author Josh Bloch + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Collections/CheckedMapBash.java b/jdk/test/java/util/Collections/CheckedMapBash.java index 9a6aab1cafc..7f622aa8e23 100644 --- a/jdk/test/java/util/Collections/CheckedMapBash.java +++ b/jdk/test/java/util/Collections/CheckedMapBash.java @@ -27,6 +27,7 @@ * @summary Unit test for Collections.checkedMap * @author Josh Bloch * @run testng CheckedMapBash + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Collections/CheckedSetBash.java b/jdk/test/java/util/Collections/CheckedSetBash.java index 462792cf1d8..c24878a81af 100644 --- a/jdk/test/java/util/Collections/CheckedSetBash.java +++ b/jdk/test/java/util/Collections/CheckedSetBash.java @@ -27,6 +27,7 @@ * @summary Unit test for Collections.checkedSet * @author Josh Bloch * @run testng CheckedSetBash + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Collections/Disjoint.java b/jdk/test/java/util/Collections/Disjoint.java index 762f5164a67..e13241efbb7 100644 --- a/jdk/test/java/util/Collections/Disjoint.java +++ b/jdk/test/java/util/Collections/Disjoint.java @@ -26,6 +26,7 @@ * @bug 4339792 * @summary Basic test for Collections.disjoint * @author Josh Bloch + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/Collections/Rotate.java b/jdk/test/java/util/Collections/Rotate.java index aae1deb7bc0..a759e90e1d3 100644 --- a/jdk/test/java/util/Collections/Rotate.java +++ b/jdk/test/java/util/Collections/Rotate.java @@ -25,6 +25,7 @@ * @test * @bug 4323074 * @summary Basic test for new rotate algorithm + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/EnumSet/EnumSetBash.java b/jdk/test/java/util/EnumSet/EnumSetBash.java index a7ab57019cf..873c781bfe0 100644 --- a/jdk/test/java/util/EnumSet/EnumSetBash.java +++ b/jdk/test/java/util/EnumSet/EnumSetBash.java @@ -28,6 +28,7 @@ * @author Josh Bloch * @author Neal Gafter * @author Yo Ma Ma + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/HashSet/Serialization.java b/jdk/test/java/util/HashSet/Serialization.java index 7597ae1a564..b6f9e55373e 100644 --- a/jdk/test/java/util/HashSet/Serialization.java +++ b/jdk/test/java/util/HashSet/Serialization.java @@ -34,6 +34,7 @@ import java.util.concurrent.ThreadLocalRandom; * @test * @bug 8016252 * @summary Verify that a serialized HashSet may successfully be deserialized. + * @key randomness */ public class Serialization { diff --git a/jdk/test/java/util/IdentityHashMap/Capacity.java b/jdk/test/java/util/IdentityHashMap/Capacity.java index 3114e6c16de..1be172efc49 100644 --- a/jdk/test/java/util/IdentityHashMap/Capacity.java +++ b/jdk/test/java/util/IdentityHashMap/Capacity.java @@ -39,6 +39,7 @@ import static org.testng.Assert.*; * @summary IdentityHashMap reallocates storage when inserting expected * number of elements * @run testng Capacity + * @key randomness */ @Test diff --git a/jdk/test/java/util/List/LockStep.java b/jdk/test/java/util/List/LockStep.java index 70538fcb2bb..100b63f9fe8 100644 --- a/jdk/test/java/util/List/LockStep.java +++ b/jdk/test/java/util/List/LockStep.java @@ -26,6 +26,7 @@ * @bug 6359979 * @summary Compare List implementations for identical behavior * @author Martin Buchholz + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/Map/LockStep.java b/jdk/test/java/util/Map/LockStep.java index 35cf98b9d52..45754a2f644 100644 --- a/jdk/test/java/util/Map/LockStep.java +++ b/jdk/test/java/util/Map/LockStep.java @@ -25,6 +25,7 @@ * @test * @bug 6612102 * @summary Test Map implementations for mutual compatibility + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/NavigableMap/LockStep.java b/jdk/test/java/util/NavigableMap/LockStep.java index 62ffc72877d..94f2cb1c93e 100644 --- a/jdk/test/java/util/NavigableMap/LockStep.java +++ b/jdk/test/java/util/NavigableMap/LockStep.java @@ -29,6 +29,7 @@ * @run main/othervm -XX:+AggressiveOpts LockStep * @run main/othervm -XX:+AggressiveOpts -Dthorough=true LockStep * @author Martin Buchholz + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java index 7bb187c228c..ed573a46a67 100644 --- a/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java +++ b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java @@ -25,6 +25,7 @@ * @bug 8005281 * @summary Test that the Properties storeToXML and loadFromXML methods are * thread safe + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/Random/DistinctSeeds.java b/jdk/test/java/util/Random/DistinctSeeds.java index fd2bcfcb658..ddd541b3c60 100644 --- a/jdk/test/java/util/Random/DistinctSeeds.java +++ b/jdk/test/java/util/Random/DistinctSeeds.java @@ -35,6 +35,7 @@ * @test * @bug 4949279 6937857 * @summary Independent instantiations of Random() have distinct seeds. + * @key randomness */ import java.util.ArrayList; diff --git a/jdk/test/java/util/Random/RandomStreamTest.java b/jdk/test/java/util/Random/RandomStreamTest.java index e96d57e2639..269fec8045e 100644 --- a/jdk/test/java/util/Random/RandomStreamTest.java +++ b/jdk/test/java/util/Random/RandomStreamTest.java @@ -47,6 +47,7 @@ import static org.testng.Assert.*; * @run testng RandomStreamTest * @summary test stream methods on Random * @author Brian Goetz + * @key randomness */ public class RandomStreamTest { diff --git a/jdk/test/java/util/Random/RandomTest.java b/jdk/test/java/util/Random/RandomTest.java index e56ffde1961..3055f5cbbcb 100644 --- a/jdk/test/java/util/Random/RandomTest.java +++ b/jdk/test/java/util/Random/RandomTest.java @@ -35,6 +35,7 @@ import static org.testng.Assert.*; * @test * @run testng RandomTest * @summary test methods on Random + * @key randomness */ @Test public class RandomTest { diff --git a/jdk/test/java/util/ResourceBundle/Control/StressTest.java b/jdk/test/java/util/ResourceBundle/Control/StressTest.java index abead81d2e5..9766606fba9 100644 --- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java +++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java @@ -25,6 +25,7 @@ * @bug 5102289 * @summary Stress test for ResourceBundle.getBundle with ResourceBundle.Control. * @run main/othervm -esa StressTest 2 15 + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/SplittableRandom/SplittableRandomTest.java b/jdk/test/java/util/SplittableRandom/SplittableRandomTest.java index 57e1a3434a3..c2e97c1612c 100644 --- a/jdk/test/java/util/SplittableRandom/SplittableRandomTest.java +++ b/jdk/test/java/util/SplittableRandom/SplittableRandomTest.java @@ -39,6 +39,7 @@ import static org.testng.AssertJUnit.assertTrue; * @run testng SplittableRandomTest * @run testng/othervm -Djava.util.secureRandomSeed=true SplittableRandomTest * @summary test methods on SplittableRandom + * @key randomness */ @Test public class SplittableRandomTest { diff --git a/jdk/test/java/util/Timer/DelayOverflow.java b/jdk/test/java/util/Timer/DelayOverflow.java index b72a155e1b5..bf36bcc5705 100644 --- a/jdk/test/java/util/Timer/DelayOverflow.java +++ b/jdk/test/java/util/Timer/DelayOverflow.java @@ -27,6 +27,7 @@ * @summary java.util.Timer schedule delay Long.MAX_VALUE causes task to execute multiple times * @author Chris Hegarty * @author Martin Buchholz + * @key randomness */ import java.util.Date; diff --git a/jdk/test/java/util/Timer/Purge.java b/jdk/test/java/util/Timer/Purge.java index 69c92881776..b753ec81bcd 100644 --- a/jdk/test/java/util/Timer/Purge.java +++ b/jdk/test/java/util/Timer/Purge.java @@ -25,6 +25,7 @@ * @test * @bug 4481072 * @summary Basic test for purge method + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/UUID/Serial.java b/jdk/test/java/util/UUID/Serial.java index 4a6d2714135..97badcc34ac 100644 --- a/jdk/test/java/util/UUID/Serial.java +++ b/jdk/test/java/util/UUID/Serial.java @@ -25,6 +25,7 @@ * @test * @bug 5014447 * @summary Test deserialization of UUID + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/UUID/UUIDTest.java b/jdk/test/java/util/UUID/UUIDTest.java index 93ad7ad3490..06b240fa9fa 100644 --- a/jdk/test/java/util/UUID/UUIDTest.java +++ b/jdk/test/java/util/UUID/UUIDTest.java @@ -24,6 +24,7 @@ /* @test * @bug 4173528 5068772 * @summary Unit tests for java.util.UUID + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java index 4744ecce181..a66ad9580d7 100644 --- a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java +++ b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java @@ -27,6 +27,7 @@ * @ignore until 6842353 is resolved * @summary Check that iterators work properly in the presence of * concurrent finalization and removal of elements. + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/logging/CheckZombieLockTest.java b/jdk/test/java/util/logging/CheckZombieLockTest.java index ab65a814f0b..16909532ceb 100644 --- a/jdk/test/java/util/logging/CheckZombieLockTest.java +++ b/jdk/test/java/util/logging/CheckZombieLockTest.java @@ -37,6 +37,7 @@ * @run main/othervm CheckZombieLockTest CLEANUP * @run main/othervm CheckZombieLockTest REUSE * @run main/othervm CheckZombieLockTest CLEANUP + * @key randomness */ import java.io.File; import java.io.IOException; diff --git a/jdk/test/java/util/logging/DrainFindDeadlockTest.java b/jdk/test/java/util/logging/DrainFindDeadlockTest.java index 13a959c07ff..6d0bd084346 100644 --- a/jdk/test/java/util/logging/DrainFindDeadlockTest.java +++ b/jdk/test/java/util/logging/DrainFindDeadlockTest.java @@ -36,6 +36,7 @@ import java.util.Map; * @author jim.gish@oracle.com * @build DrainFindDeadlockTest * @run main/othervm/timeout=10 DrainFindDeadlockTest + * @key randomness */ /** diff --git a/jdk/test/java/util/logging/FileHandlerLongLimit.java b/jdk/test/java/util/logging/FileHandlerLongLimit.java index 67e4001fb81..0aa2fc04641 100644 --- a/jdk/test/java/util/logging/FileHandlerLongLimit.java +++ b/jdk/test/java/util/logging/FileHandlerLongLimit.java @@ -55,6 +55,7 @@ import java.util.logging.LoggingPermission; * @run main/othervm FileHandlerLongLimit UNSECURE * @run main/othervm FileHandlerLongLimit SECURE * @author danielfuchs + * @key randomness */ public class FileHandlerLongLimit { diff --git a/jdk/test/java/util/logging/FileHandlerPath.java b/jdk/test/java/util/logging/FileHandlerPath.java index 93859091c9b..602d4cf9c7d 100644 --- a/jdk/test/java/util/logging/FileHandlerPath.java +++ b/jdk/test/java/util/logging/FileHandlerPath.java @@ -56,6 +56,7 @@ import java.util.logging.LoggingPermission; * @run main/othervm FileHandlerPath UNSECURE * @run main/othervm FileHandlerPath SECURE * @author danielfuchs + * @key randomness */ public class FileHandlerPath { diff --git a/jdk/test/java/util/logging/FileHandlerPatternExceptions.java b/jdk/test/java/util/logging/FileHandlerPatternExceptions.java index a4026d9bde9..fdcafa04c57 100644 --- a/jdk/test/java/util/logging/FileHandlerPatternExceptions.java +++ b/jdk/test/java/util/logging/FileHandlerPatternExceptions.java @@ -49,6 +49,7 @@ import java.util.logging.LogManager; * @run main/othervm FileHandlerPatternExceptions UNSECURE * @run main/othervm FileHandlerPatternExceptions SECURE * @author danielfuchs + * @key randomness */ public class FileHandlerPatternExceptions { diff --git a/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java index 491d7583243..38a6c56cbd5 100644 --- a/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java +++ b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java @@ -59,6 +59,7 @@ import java.util.logging.LoggingPermission; * @run main/othervm ParentLoggerWithHandlerGC UNSECURE * @run main/othervm ParentLoggerWithHandlerGC SECURE * @author danielfuchs + * @key randomness */ public class ParentLoggerWithHandlerGC { diff --git a/jdk/test/java/util/logging/LoggingDeadlock.java b/jdk/test/java/util/logging/LoggingDeadlock.java index 41c9e8b3d05..131c92942f7 100644 --- a/jdk/test/java/util/logging/LoggingDeadlock.java +++ b/jdk/test/java/util/logging/LoggingDeadlock.java @@ -30,6 +30,10 @@ * * @build LoggingDeadlock * @run main/timeout=15 LoggingDeadlock + * @key randomness + */ + +/* * * There can be a deadlock between two class initializations. * It happens if the LogManager. and the Logger. diff --git a/jdk/test/java/util/logging/LoggingDeadlock2.java b/jdk/test/java/util/logging/LoggingDeadlock2.java index c5b4e893738..b33a25191fc 100644 --- a/jdk/test/java/util/logging/LoggingDeadlock2.java +++ b/jdk/test/java/util/logging/LoggingDeadlock2.java @@ -29,6 +29,10 @@ * * @build LoggingDeadlock2 * @run main LoggingDeadlock2 + * @key randomness + */ + +/* * * There is a clear deadlock between LogManager. and * Cleaner.run() methods. diff --git a/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java b/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java index 9bde8d516fc..af8651d38b3 100644 --- a/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java +++ b/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java @@ -46,6 +46,7 @@ import java.util.logging.Logger; * caused by synchronization issues in Logger and LogManager. * @run main/othervm TestLogConfigurationDeadLockWithConf * @author danielfuchs + * @key randomness */ // This test is a best effort to try & detect issues. The test itself will run // for 8secs. This is usually sufficient to detect issues. diff --git a/jdk/test/java/util/regex/RegExTest.java b/jdk/test/java/util/regex/RegExTest.java index f04f6f1e8c7..488b431b257 100644 --- a/jdk/test/java/util/regex/RegExTest.java +++ b/jdk/test/java/util/regex/RegExTest.java @@ -33,6 +33,7 @@ * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066 * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590 * 8027645 8035076 8039124 8035975 8074678 + * @key randomness */ import java.util.function.Function; diff --git a/jdk/test/java/util/zip/3GBZipFiles.sh b/jdk/test/java/util/zip/3GBZipFiles.sh index 7661b8445d2..a03290f9cae 100644 --- a/jdk/test/java/util/zip/3GBZipFiles.sh +++ b/jdk/test/java/util/zip/3GBZipFiles.sh @@ -29,6 +29,7 @@ # @run shell 3GBZipFiles.sh 9986 # @ignore runs for hours and eats up 7 Gigabytes of disk space # @run shell/timeout=604800 3GBZipFiles.sh 3141592653 +# @key randomness # Command-line usage: # javac FileBuilder.java && sh 3GBZipFiles.sh /path/to/jdk filesize diff --git a/jdk/test/java/util/zip/DeInflate.java b/jdk/test/java/util/zip/DeInflate.java index c3ca7acf71f..886c9d4bc47 100644 --- a/jdk/test/java/util/zip/DeInflate.java +++ b/jdk/test/java/util/zip/DeInflate.java @@ -25,6 +25,7 @@ * @test * @bug 7110149 * @summary Test basic deflater & inflater functionality + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/DeflateIn_InflateOut.java b/jdk/test/java/util/zip/DeflateIn_InflateOut.java index 29edda840ef..dd69a7773eb 100644 --- a/jdk/test/java/util/zip/DeflateIn_InflateOut.java +++ b/jdk/test/java/util/zip/DeflateIn_InflateOut.java @@ -25,6 +25,7 @@ * @test * @bug 4679743 * @summary Test basic functionality of DeflaterInputStream and InflaterOutputStream + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/FlaterTest.java b/jdk/test/java/util/zip/FlaterTest.java index 2179a1303ea..ff11ab0bd1c 100644 --- a/jdk/test/java/util/zip/FlaterTest.java +++ b/jdk/test/java/util/zip/FlaterTest.java @@ -26,6 +26,7 @@ * @bug 6348045 * @summary GZipOutputStream/InputStream goes critical(calls JNI_Get*Critical) * and causes slowness. This test uses Deflater and Inflater directly. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/GZIP/Accordion.java b/jdk/test/java/util/zip/GZIP/Accordion.java index fa5399e6221..a0d7494a26f 100644 --- a/jdk/test/java/util/zip/GZIP/Accordion.java +++ b/jdk/test/java/util/zip/GZIP/Accordion.java @@ -25,6 +25,7 @@ * @bug 5092263 * @summary GZIPInputStream o GZIPOutputStream === the identity stream * @author Martin Buchholz + * @key randomness */ // To manually test for uncompressed streams larger than 2GB, do diff --git a/jdk/test/java/util/zip/GZIP/GZIPInputStreamRead.java b/jdk/test/java/util/zip/GZIP/GZIPInputStreamRead.java index ba87f78373a..56bd58e1aaf 100644 --- a/jdk/test/java/util/zip/GZIP/GZIPInputStreamRead.java +++ b/jdk/test/java/util/zip/GZIP/GZIPInputStreamRead.java @@ -25,6 +25,7 @@ * @bug 4691425 * @summary Test the read and write of GZIPInput/OutputStream, including * concatenated .gz inputstream + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/InflateIn_DeflateOut.java b/jdk/test/java/util/zip/InflateIn_DeflateOut.java index 1e4ef2bd073..0747d22b0a2 100644 --- a/jdk/test/java/util/zip/InflateIn_DeflateOut.java +++ b/jdk/test/java/util/zip/InflateIn_DeflateOut.java @@ -25,6 +25,7 @@ * @test * @bug 4206909 4813885 * @summary Test basic functionality of DeflaterOutputStream/InflaterInputStream and GZIPOutputStream/GZIPInputStream, including flush + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/InflaterBufferSize.java b/jdk/test/java/util/zip/InflaterBufferSize.java index cf5363fca3e..1c512ec2c3d 100644 --- a/jdk/test/java/util/zip/InflaterBufferSize.java +++ b/jdk/test/java/util/zip/InflaterBufferSize.java @@ -26,6 +26,7 @@ * @bug 6571338 * @summary Inflater should not require a buffer to the inflate() methods * larger than 1 byte. + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/TimeChecksum.java b/jdk/test/java/util/zip/TimeChecksum.java index cc81f1e7592..d6eb44f77f1 100644 --- a/jdk/test/java/util/zip/TimeChecksum.java +++ b/jdk/test/java/util/zip/TimeChecksum.java @@ -25,6 +25,7 @@ /* @test * @bug 7109837 * @summary Test Adler32/CRC32.update(ByteBuffer) + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/zip/TotalInOut.java b/jdk/test/java/util/zip/TotalInOut.java index 1ea12b3b82c..c7f22a63b31 100644 --- a/jdk/test/java/util/zip/TotalInOut.java +++ b/jdk/test/java/util/zip/TotalInOut.java @@ -24,6 +24,7 @@ /* @test * @bug 7188852 * @summary Test De/Inflater.getBytesRead/Written() + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/ZipFile/Assortment.java b/jdk/test/java/util/zip/ZipFile/Assortment.java index b890b31ff1a..61cf415d51a 100644 --- a/jdk/test/java/util/zip/ZipFile/Assortment.java +++ b/jdk/test/java/util/zip/ZipFile/Assortment.java @@ -25,6 +25,7 @@ * @bug 4770745 6234507 6303183 8048990 * @summary test a variety of zip file entries * @author Martin Buchholz + * @key randomness */ import java.util.*; diff --git a/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java b/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java index d1be7dc9cc6..2ba02300012 100644 --- a/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java +++ b/jdk/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java @@ -30,6 +30,7 @@ * @bug 7031076 * @summary Allow stale InputStreams from ZipFiles to be GC'd * @author Neil Richards , + * @key randomness */ import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; diff --git a/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java index 74866cac808..06dd4bc3bd6 100644 --- a/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java +++ b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java @@ -24,6 +24,7 @@ /* @test * @bug 7007609 7009618 * @summary Check that ZipFile objects are always collected + * @key randomness */ import java.io.*; diff --git a/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java b/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java index c1f69a90587..a97e1f35285 100644 --- a/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java +++ b/jdk/test/java/util/zip/ZipFile/MultiThreadedReadTest.java @@ -27,6 +27,7 @@ * @library /lib/testlibrary * @build jdk.testlibrary.FileUtils * @run main MultiThreadedReadTest + * @key randomness */ import java.io.File; diff --git a/jdk/test/java/util/zip/ZipFile/ReadZip.java b/jdk/test/java/util/zip/ZipFile/ReadZip.java index 44f1d9ed97f..1052642eda7 100644 --- a/jdk/test/java/util/zip/ZipFile/ReadZip.java +++ b/jdk/test/java/util/zip/ZipFile/ReadZip.java @@ -24,6 +24,7 @@ /* @test @bug 4241361 4842702 4985614 6646605 5032358 6923692 @summary Make sure we can read a zip file. + @key randomness */ import java.io.*; diff --git a/jdk/test/javax/crypto/Cipher/ByteBuffers.java b/jdk/test/javax/crypto/Cipher/ByteBuffers.java index 99c807229f1..233e62fb83a 100644 --- a/jdk/test/javax/crypto/Cipher/ByteBuffers.java +++ b/jdk/test/javax/crypto/Cipher/ByteBuffers.java @@ -26,6 +26,7 @@ * @bug 4844847 * @summary Test the Cipher.update/doFinal(ByteBuffer, ByteBuffer) methods * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java b/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java index 9cc840664c0..9e03c908660 100644 --- a/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java +++ b/jdk/test/javax/crypto/CipherSpi/DirectBBRemaining.java @@ -26,6 +26,7 @@ * @bug 7142509 * @summary Cipher.doFinal(ByteBuffer,ByteBuffer) fails to * process when in.remaining() == 0 + * @key randomness */ import java.nio.ByteBuffer; diff --git a/jdk/test/javax/crypto/CryptoPermission/AllPermCheck.java b/jdk/test/javax/crypto/CryptoPermission/AllPermCheck.java index 3359fcd88e2..d7a1ad40e39 100644 --- a/jdk/test/javax/crypto/CryptoPermission/AllPermCheck.java +++ b/jdk/test/javax/crypto/CryptoPermission/AllPermCheck.java @@ -28,6 +28,7 @@ * InvalidKeyException is thrown instead of SecurityException when * crypto permssion checks failed. * @author Valerie Peng + * @key randomness */ import java.io.*; diff --git a/jdk/test/javax/crypto/CryptoPermission/RC2PermCheck.java b/jdk/test/javax/crypto/CryptoPermission/RC2PermCheck.java index a4270802fe5..fc49baec11e 100644 --- a/jdk/test/javax/crypto/CryptoPermission/RC2PermCheck.java +++ b/jdk/test/javax/crypto/CryptoPermission/RC2PermCheck.java @@ -27,6 +27,7 @@ * @summary Ensure the crypto permission check on cipher algorithms * with restricted parameter values are correctly enforced. * @author Valerie Peng + * @key randomness */ import java.io.*; diff --git a/jdk/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java b/jdk/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java index c2991bbcc07..50a1c188d0f 100644 --- a/jdk/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java +++ b/jdk/test/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java @@ -28,6 +28,7 @@ * @summary SunJCE depends on sun.security.provider.SignatureImpl * behaviour, BC can't load into 1st slot. * @author Brad R. Wetmore + * @key randomness */ import java.security.*; diff --git a/jdk/test/javax/crypto/KeyGenerator/TestKGParity.java b/jdk/test/javax/crypto/KeyGenerator/TestKGParity.java index 40752152c56..cb512274bf8 100644 --- a/jdk/test/javax/crypto/KeyGenerator/TestKGParity.java +++ b/jdk/test/javax/crypto/KeyGenerator/TestKGParity.java @@ -35,6 +35,7 @@ import static java.lang.System.out; * @bug 8048607 * @compile ../../../com/sun/crypto/provider/Cipher/DES/TestUtility.java * @summary Test key generation of DES and DESEDE + * @key randomness */ public class TestKGParity { diff --git a/jdk/test/javax/crypto/Mac/ByteBuffers.java b/jdk/test/javax/crypto/Mac/ByteBuffers.java index 96070881715..a00e5a43cd6 100644 --- a/jdk/test/javax/crypto/Mac/ByteBuffers.java +++ b/jdk/test/javax/crypto/Mac/ByteBuffers.java @@ -26,6 +26,7 @@ * @bug 4844847 * @summary Test the Mac.update(ByteBuffer) method * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/javax/crypto/NullCipher/TestNPE.java b/jdk/test/javax/crypto/NullCipher/TestNPE.java index 45aa81ac78e..0e216d0226d 100644 --- a/jdk/test/javax/crypto/NullCipher/TestNPE.java +++ b/jdk/test/javax/crypto/NullCipher/TestNPE.java @@ -26,6 +26,7 @@ * @bug 4937853 * @summary Make sure normal calls of NullCipher does not throw NPE. * @author Valerie Peng + * @key randomness */ import java.util.Arrays; import java.security.AlgorithmParameters; diff --git a/jdk/test/javax/management/monitor/MultiMonitorTest.java b/jdk/test/javax/management/monitor/MultiMonitorTest.java index 93bba22553f..fe40f63d8ff 100644 --- a/jdk/test/javax/management/monitor/MultiMonitorTest.java +++ b/jdk/test/javax/management/monitor/MultiMonitorTest.java @@ -29,6 +29,7 @@ * @run clean MultiMonitorTest * @run build MultiMonitorTest * @run main MultiMonitorTest + * @key randomness */ import java.util.*; diff --git a/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java b/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java index f533f340b50..d2ca6a90102 100644 --- a/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java +++ b/jdk/test/javax/management/mxbean/ThreadMXBeanTest.java @@ -29,6 +29,7 @@ * @run clean ThreadMXBeanTest * @run build ThreadMXBeanTest * @run main ThreadMXBeanTest + * @key randomness */ import java.lang.management.*; diff --git a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java index 341bbfc5249..c6e212cf924 100644 --- a/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java +++ b/jdk/test/javax/management/remote/mandatory/loading/MissingClassTest.java @@ -29,6 +29,7 @@ * @run clean MissingClassTest SingleClassLoader * @run build MissingClassTest SingleClassLoader * @run main MissingClassTest + * @key randomness */ /* diff --git a/jdk/test/javax/management/timer/MissingNotificationTest.java b/jdk/test/javax/management/timer/MissingNotificationTest.java index 39da6cb1098..9fedc74024b 100644 --- a/jdk/test/javax/management/timer/MissingNotificationTest.java +++ b/jdk/test/javax/management/timer/MissingNotificationTest.java @@ -29,6 +29,7 @@ * @run clean MissingNotificationTest * @run build MissingNotificationTest * @run main MissingNotificationTest + * @key randomness */ import java.util.Date; diff --git a/jdk/test/javax/net/ssl/SSLEngine/LargeBufs.java b/jdk/test/javax/net/ssl/SSLEngine/LargeBufs.java index 2eb940ed818..f63db4c98c9 100644 --- a/jdk/test/javax/net/ssl/SSLEngine/LargeBufs.java +++ b/jdk/test/javax/net/ssl/SSLEngine/LargeBufs.java @@ -33,6 +33,7 @@ * @run main/othervm -Djsse.enableCBCProtection=false LargeBufs * * @author Brad R. Wetmore + * @key randomness */ import javax.net.ssl.*; diff --git a/jdk/test/javax/smartcardio/TestCommandAPDU.java b/jdk/test/javax/smartcardio/TestCommandAPDU.java index 93517ea79de..543fcea2487 100644 --- a/jdk/test/javax/smartcardio/TestCommandAPDU.java +++ b/jdk/test/javax/smartcardio/TestCommandAPDU.java @@ -26,6 +26,7 @@ * @bug 6293767 * @summary Test for the CommandAPDU class * @author Andreas Sterbenz + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index 59f947b756c..de5e9b6bbcd 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -60,6 +60,7 @@ import sun.management.AgentConfigurationError; * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest * @summary Makes sure that enabling/disabling the management agent through JCMD * achieves the desired results + * @key randomness */ public class JMXStartStopTest { diff --git a/jdk/test/sun/misc/CopyMemory.java b/jdk/test/sun/misc/CopyMemory.java index 6ddcbc81d71..89266ed052d 100644 --- a/jdk/test/sun/misc/CopyMemory.java +++ b/jdk/test/sun/misc/CopyMemory.java @@ -24,6 +24,7 @@ /* @test * @bug 6565543 * @summary Minimal test for unsafe.copyMemory() and unsafe.setMemory() + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java b/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java index b04545a65f3..23e97d7421c 100644 --- a/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java +++ b/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java @@ -62,6 +62,7 @@ public class sun.misc.FloatingDecimal { * @build DoubleConsts FloatConsts * @run main TestFloatingDecimal * @author Brian Burkhalter + * @key randomness */ public class TestFloatingDecimal { private static enum ResultType { diff --git a/jdk/test/sun/net/www/ParseUtil_4922813.java b/jdk/test/sun/net/www/ParseUtil_4922813.java index 5646039b651..3dd5503af08 100644 --- a/jdk/test/sun/net/www/ParseUtil_4922813.java +++ b/jdk/test/sun/net/www/ParseUtil_4922813.java @@ -24,6 +24,7 @@ /* @test @bug 4922813 @summary Check the new impl of encodePath will not cause regression + @key randomness */ import java.util.BitSet; diff --git a/jdk/test/sun/nio/cs/FindDecoderBugs.java b/jdk/test/sun/nio/cs/FindDecoderBugs.java index 8c1fd910f5b..df8afd18960 100644 --- a/jdk/test/sun/nio/cs/FindDecoderBugs.java +++ b/jdk/test/sun/nio/cs/FindDecoderBugs.java @@ -27,6 +27,7 @@ * @summary Decode many byte sequences in many ways * @run main/timeout=1800 FindDecoderBugs * @author Martin Buchholz + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/nio/cs/FindEncoderBugs.java b/jdk/test/sun/nio/cs/FindEncoderBugs.java index ecd63065980..bfef4037ec4 100644 --- a/jdk/test/sun/nio/cs/FindEncoderBugs.java +++ b/jdk/test/sun/nio/cs/FindEncoderBugs.java @@ -27,6 +27,7 @@ * @summary Encode many char sequences in many ways * @run main/timeout=1200 FindEncoderBugs * @author Martin Buchholz + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/nio/cs/TestStringCoding.java b/jdk/test/sun/nio/cs/TestStringCoding.java index aaee1bcd2e3..7c18a3596c6 100644 --- a/jdk/test/sun/nio/cs/TestStringCoding.java +++ b/jdk/test/sun/nio/cs/TestStringCoding.java @@ -25,6 +25,7 @@ @bug 6636323 6636319 7040220 7096080 7183053 @summary Test if StringCoding and NIO result have the same de/encoding result * @run main/othervm/timeout=2000 TestStringCoding + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/nio/cs/TestStringCodingUTF8.java b/jdk/test/sun/nio/cs/TestStringCodingUTF8.java index d1f69950684..b936838ea13 100644 --- a/jdk/test/sun/nio/cs/TestStringCodingUTF8.java +++ b/jdk/test/sun/nio/cs/TestStringCodingUTF8.java @@ -25,6 +25,7 @@ @bug 7040220 @summary Test if StringCoding and NIO result have the same de/encoding result for UTF-8 * @run main/othervm/timeout=2000 TestStringCodingUTF8 + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/mscapi/PrngSlow.java b/jdk/test/sun/security/mscapi/PrngSlow.java index f9001eea80d..3420cc6b2a1 100644 --- a/jdk/test/sun/security/mscapi/PrngSlow.java +++ b/jdk/test/sun/security/mscapi/PrngSlow.java @@ -25,6 +25,7 @@ * @test * @bug 6449335 * @summary MSCAPI's PRNG is too slow + * @key randomness */ import java.security.SecureRandom; diff --git a/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java b/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java index 9c87ce2b503..2cd68b44a9b 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/ReinitCipher.java @@ -27,6 +27,7 @@ * @summary * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java index 4f27ff5de0c..876048f46cf 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestRSACipher.java @@ -27,6 +27,7 @@ * @summary basic test for RSA cipher * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java index d1dd0206031..17ffe9553c2 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestRawRSACipher.java @@ -27,6 +27,7 @@ * @summary basic test for RSA/ECB/NoPadding cipher * @author Valerie Peng * @library .. + * @key randomness */ import javax.crypto.*; diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java index 14e41cdddd2..e6b7f7d8a34 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphers.java @@ -22,11 +22,12 @@ */ /** - * @test %I% %E% + * @test * @bug 4898461 6604496 * @summary basic test for symmetric ciphers with padding * @author Valerie Peng * @library .. + * @key randomness */ import java.io.*; import java.nio.*; diff --git a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java index a8b71a30a4d..07d48649be5 100644 --- a/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java +++ b/jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java @@ -27,6 +27,7 @@ * @summary basic test for symmetric ciphers with no padding * @author Valerie Peng * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java b/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java index 33ef9eb1749..2d7f77bc9c5 100644 --- a/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java +++ b/jdk/test/sun/security/pkcs11/KeyGenerator/DESParity.java @@ -27,6 +27,7 @@ * @summary Verify that the parity bits are set correctly * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java b/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java index f5e2787e609..21eae39b0c6 100644 --- a/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java +++ b/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java @@ -37,6 +37,7 @@ import javax.crypto.spec.SecretKeySpec; * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin * @library .. * @run main MacSameTest + * @key randomness */ public class MacSameTest extends PKCS11Test { diff --git a/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java b/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java index 0466330572a..68bef343889 100644 --- a/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java +++ b/jdk/test/sun/security/pkcs11/Mac/ReinitMac.java @@ -27,6 +27,7 @@ * @summary * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java b/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java index 49b3c9c8337..1b502a95bcf 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/ByteBuffers.java @@ -27,6 +27,7 @@ * @summary Test the MessageDigest.update(ByteBuffer) method * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java b/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java index 417b4c28d77..2f8290a2a7a 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/ReinitDigest.java @@ -27,6 +27,7 @@ * @summary * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java b/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java index c998e8092e0..5ea2264109f 100644 --- a/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java +++ b/jdk/test/sun/security/pkcs11/MessageDigest/TestCloning.java @@ -27,6 +27,7 @@ * @summary Ensure the cloning functionality works. * @author Valerie Peng * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java index c99c498946d..a42ca861396 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java +++ b/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java @@ -28,6 +28,7 @@ * @author Andreas Sterbenz * @library .. * @run main/othervm AddPrivateKey + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java index c44ab87835f..39465f794d1 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java +++ b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java @@ -28,6 +28,7 @@ * @author Andreas Sterbenz * @library .. * @run main/othervm Crypto + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java index a41bef9c77e..2dd1ce69056 100644 --- a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java +++ b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java @@ -28,6 +28,7 @@ * @author Andreas Sterbenz * @library .. * @run main/othervm GetPrivateKey + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java b/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java index 63ebcb4750b..f9bfb1759ef 100644 --- a/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java +++ b/jdk/test/sun/security/pkcs11/SecureRandom/Basic.java @@ -27,6 +27,7 @@ * @summary basic test for PKCS#11 SecureRandom * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java b/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java index 31ae86c9a5e..8a76866f73f 100644 --- a/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java +++ b/jdk/test/sun/security/pkcs11/Signature/ByteBuffers.java @@ -27,6 +27,7 @@ * @summary Test the Signature.update(ByteBuffer) method * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java b/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java index 36f80f3436e..d5ace8b9602 100644 --- a/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java +++ b/jdk/test/sun/security/pkcs11/Signature/ReinitSignature.java @@ -27,6 +27,7 @@ * @summary test that reinitializing Signatures works correctly * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/Signature/TestDSA.java b/jdk/test/sun/security/pkcs11/Signature/TestDSA.java index c7845ae4831..9f8c099f4c2 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestDSA.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestDSA.java @@ -27,6 +27,7 @@ * @summary basic test of SHA1withDSA and RawDSA signing/verifying * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java index 89b2b7a1c18..0287e7d028f 100644 --- a/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/jdk/test/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -26,6 +26,7 @@ * @summary verify that P11Signature impl will error out when initialized * with unsupported key sizes * @library .. + * @key randomness */ diff --git a/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java b/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java index 930e0625b43..112470509fe 100644 --- a/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/jdk/test/sun/security/pkcs11/ec/ReadPKCS12.java @@ -28,6 +28,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/ec/TestCurves.java b/jdk/test/sun/security/pkcs11/ec/TestCurves.java index de53e2147fc..fb9cd836ad6 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java +++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java @@ -29,6 +29,7 @@ * @library .. * @compile -XDignore.symbol.file TestCurves.java * @run main TestCurves + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java index 98dd939eaec..b811b44c6ef 100644 --- a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java +++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java @@ -28,6 +28,7 @@ * @author Andreas Sterbenz * @library .. * @library ../../../../java/security/testlibrary + * @key randomness */ import java.util.*; diff --git a/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java b/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java index ed31aa203fc..7f08481d6f7 100644 --- a/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java +++ b/jdk/test/sun/security/pkcs11/rsa/KeyWrap.java @@ -27,6 +27,7 @@ * @summary Verify key wrapping (of extractable keys) works for RSA/PKCS1 * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java index 89ca783dc50..b5aa442cce7 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java @@ -28,7 +28,7 @@ * @author Andreas Sterbenz * @library .. * @run main/othervm TestKeyPairGenerator - * @key intermittent + * @key intermittent randomness */ import java.io.*; diff --git a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java index fd11d0cb67b..b27de0a9b77 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestSignatures.java @@ -27,6 +27,7 @@ * @summary Test signing/verifying using all the signature algorithms * @author Andreas Sterbenz * @library .. + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/provider/DSA/TestDSA.java b/jdk/test/sun/security/provider/DSA/TestDSA.java index 197841bb0e1..d730b69f6cb 100644 --- a/jdk/test/sun/security/provider/DSA/TestDSA.java +++ b/jdk/test/sun/security/provider/DSA/TestDSA.java @@ -26,6 +26,7 @@ * @bug 4815057 4839277 * @summary basic test of SHA1withDSA and RawDSA signing/verifying * @author Andreas Sterbenz + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/provider/DSA/TestDSA2.java b/jdk/test/sun/security/provider/DSA/TestDSA2.java index 600161d00f7..00691535ac1 100644 --- a/jdk/test/sun/security/provider/DSA/TestDSA2.java +++ b/jdk/test/sun/security/provider/DSA/TestDSA2.java @@ -26,6 +26,7 @@ * @run main/othervm/timeout=250 TestDSA2 * @summary verify that DSA signature works using SHA and SHA-224 and * SHA-256 digests. + * @key randomness */ diff --git a/jdk/test/sun/security/provider/SeedGenerator/Priority_Inversion.java b/jdk/test/sun/security/provider/SeedGenerator/Priority_Inversion.java index e41e2816142..857e55ceab9 100644 --- a/jdk/test/sun/security/provider/SeedGenerator/Priority_Inversion.java +++ b/jdk/test/sun/security/provider/SeedGenerator/Priority_Inversion.java @@ -29,6 +29,7 @@ * * if the test returns, then it passed. * if the test never returns (hangs forever), then it failed. + * @key randomness */ import java.security.SecureRandom; diff --git a/jdk/test/sun/security/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/rsa/TestKeyPairGenerator.java index 5e661b08ef1..1d7d1b82e2d 100644 --- a/jdk/test/sun/security/rsa/TestKeyPairGenerator.java +++ b/jdk/test/sun/security/rsa/TestKeyPairGenerator.java @@ -26,6 +26,7 @@ * @bug 4853305 4865198 4888410 4963723 * @summary Verify that the RSA KeyPairGenerator works * @author Andreas Sterbenz + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/rsa/TestSignatures.java b/jdk/test/sun/security/rsa/TestSignatures.java index 1933f264295..f3b613f88ba 100644 --- a/jdk/test/sun/security/rsa/TestSignatures.java +++ b/jdk/test/sun/security/rsa/TestSignatures.java @@ -26,6 +26,7 @@ * @bug 4853305 4963723 * @summary Test signing/verifying using all the signature algorithms * @author Andreas Sterbenz + * @key randomness */ import java.io.*; diff --git a/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java b/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java index 2d4940ac378..aaaaddff950 100644 --- a/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java +++ b/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java @@ -27,6 +27,7 @@ * @summary Vectors and fixed length fields should be verified * for allowed sizes. * @run main/othervm LengthCheckTest + * @key randomness */ /** diff --git a/jdk/test/sun/security/ssl/GenSSLConfigs/main.java b/jdk/test/sun/security/ssl/GenSSLConfigs/main.java index 13460595a81..0bfd59d8823 100644 --- a/jdk/test/sun/security/ssl/GenSSLConfigs/main.java +++ b/jdk/test/sun/security/ssl/GenSSLConfigs/main.java @@ -3,6 +3,7 @@ * @build TestThread Traffic Handler ServerHandler ServerThread ClientThread * @run main/othervm/timeout=140 -Djsse.enableCBCProtection=false main * @summary Make sure that different configurations of SSL sockets work + * @key randomness */ /* From ae93bb2873e9f0fdcc76fd166ff3dac52abb1c26 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Wed, 29 Apr 2015 11:03:56 -0700 Subject: [PATCH 40/63] 8075545: Add permission check for locale service provider implementations Reviewed-by: mchung, alanb --- .../java/util/spi/LocaleServiceProvider.java | 19 +++- .../provider/AuxLocaleProviderAdapter.java | 6 +- .../provider/JRELocaleProviderAdapter.java | 102 +++++++++++++----- .../java/util/PluggableLocale/ExecTest.sh | 12 ++- .../util/PluggableLocale/PermissionTest.java | 46 ++++++++ .../util/PluggableLocale/PermissionTest.sh | 31 ++++++ .../localeServiceProvider.policy | 3 + 7 files changed, 185 insertions(+), 34 deletions(-) create mode 100644 jdk/test/java/util/PluggableLocale/PermissionTest.java create mode 100644 jdk/test/java/util/PluggableLocale/PermissionTest.sh create mode 100644 jdk/test/java/util/PluggableLocale/localeServiceProvider.policy diff --git a/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java b/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java index 3b2cb534bad..1147bf5f63b 100644 --- a/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java +++ b/jdk/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -140,11 +140,24 @@ import java.util.Locale; */ public abstract class LocaleServiceProvider { + private static Void checkPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission("localeServiceProvider")); + } + return null; + } + private LocaleServiceProvider(Void ignore) { } + /** - * Sole constructor. (For invocation by subclass constructors, typically - * implicit.) + * Initializes a new locale service provider. + * + * @throws SecurityException + * If a security manager has been installed and it denies + * {@link RuntimePermission RuntimePermission("localeServiceProvider")} */ protected LocaleServiceProvider() { + this(checkPermission()); } /** diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java b/jdk/src/java.base/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java index 7ddcd0e3c61..6b374b998ca 100644 --- a/jdk/src/java.base/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java +++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/AuxLocaleProviderAdapter.java @@ -25,6 +25,8 @@ package sun.util.locale.provider; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.text.spi.BreakIteratorProvider; import java.text.spi.CollatorProvider; import java.text.spi.DateFormatProvider; @@ -177,7 +179,9 @@ public abstract class AuxLocaleProviderAdapter extends LocaleProviderAdapter { * A dummy locale service provider that indicates there is no * provider available */ - private static final NullProvider NULL_PROVIDER = new NullProvider(); + private static final NullProvider NULL_PROVIDER = AccessController.doPrivileged( + (PrivilegedAction) () -> new NullProvider()); + private static class NullProvider extends LocaleServiceProvider { @Override public Locale[] getAvailableLocales() { diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java b/jdk/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java index efde2013320..3d8e4f6d27c 100644 --- a/jdk/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java +++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java @@ -26,7 +26,7 @@ package sun.util.locale.provider; import java.security.AccessController; -import java.security.PrivilegedActionException; +import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.text.spi.BreakIteratorProvider; import java.text.spi.CollatorProvider; @@ -133,8 +133,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public BreakIteratorProvider getBreakIteratorProvider() { if (breakIteratorProvider == null) { - BreakIteratorProvider provider = new BreakIteratorProviderImpl(getAdapterType(), - getLanguageTagSet("FormatData")); + BreakIteratorProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new BreakIteratorProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (breakIteratorProvider == null) { breakIteratorProvider = provider; @@ -147,8 +151,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public CollatorProvider getCollatorProvider() { if (collatorProvider == null) { - CollatorProvider provider = new CollatorProviderImpl(getAdapterType(), - getLanguageTagSet("CollationData")); + CollatorProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new CollatorProviderImpl( + getAdapterType(), + getLanguageTagSet("CollationData"))); + synchronized (this) { if (collatorProvider == null) { collatorProvider = provider; @@ -161,8 +169,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public DateFormatProvider getDateFormatProvider() { if (dateFormatProvider == null) { - DateFormatProvider provider = new DateFormatProviderImpl(getAdapterType(), - getLanguageTagSet("FormatData")); + DateFormatProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new DateFormatProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (dateFormatProvider == null) { dateFormatProvider = provider; @@ -175,8 +187,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public DateFormatSymbolsProvider getDateFormatSymbolsProvider() { if (dateFormatSymbolsProvider == null) { - DateFormatSymbolsProvider provider = new DateFormatSymbolsProviderImpl(getAdapterType(), - getLanguageTagSet("FormatData")); + DateFormatSymbolsProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new DateFormatSymbolsProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (dateFormatSymbolsProvider == null) { dateFormatSymbolsProvider = provider; @@ -189,7 +205,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() { if (decimalFormatSymbolsProvider == null) { - DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData")); + DecimalFormatSymbolsProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new DecimalFormatSymbolsProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (decimalFormatSymbolsProvider == null) { decimalFormatSymbolsProvider = provider; @@ -202,8 +223,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public NumberFormatProvider getNumberFormatProvider() { if (numberFormatProvider == null) { - NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(), - getLanguageTagSet("FormatData")); + NumberFormatProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new NumberFormatProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (numberFormatProvider == null) { numberFormatProvider = provider; @@ -219,8 +244,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { - CurrencyNameProvider provider = new CurrencyNameProviderImpl(getAdapterType(), - getLanguageTagSet("CurrencyNames")); + CurrencyNameProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new CurrencyNameProviderImpl( + getAdapterType(), + getLanguageTagSet("CurrencyNames"))); + synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; @@ -233,8 +262,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public LocaleNameProvider getLocaleNameProvider() { if (localeNameProvider == null) { - LocaleNameProvider provider = new LocaleNameProviderImpl(getAdapterType(), - getLanguageTagSet("LocaleNames")); + LocaleNameProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new LocaleNameProviderImpl( + getAdapterType(), + getLanguageTagSet("LocaleNames"))); + synchronized (this) { if (localeNameProvider == null) { localeNameProvider = provider; @@ -247,8 +280,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public TimeZoneNameProvider getTimeZoneNameProvider() { if (timeZoneNameProvider == null) { - TimeZoneNameProvider provider = new TimeZoneNameProviderImpl(getAdapterType(), - getLanguageTagSet("TimeZoneNames")); + TimeZoneNameProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new TimeZoneNameProviderImpl( + getAdapterType(), + getLanguageTagSet("TimeZoneNames"))); + synchronized (this) { if (timeZoneNameProvider == null) { timeZoneNameProvider = provider; @@ -261,9 +298,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public CalendarDataProvider getCalendarDataProvider() { if (calendarDataProvider == null) { - CalendarDataProvider provider; - provider = new CalendarDataProviderImpl(getAdapterType(), - getLanguageTagSet("CalendarData")); + CalendarDataProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new CalendarDataProviderImpl( + getAdapterType(), + getLanguageTagSet("CalendarData"))); + synchronized (this) { if (calendarDataProvider == null) { calendarDataProvider = provider; @@ -276,9 +316,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public CalendarNameProvider getCalendarNameProvider() { if (calendarNameProvider == null) { - CalendarNameProvider provider; - provider = new CalendarNameProviderImpl(getAdapterType(), - getLanguageTagSet("FormatData")); + CalendarNameProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new CalendarNameProviderImpl( + getAdapterType(), + getLanguageTagSet("FormatData"))); + synchronized (this) { if (calendarNameProvider == null) { calendarNameProvider = provider; @@ -294,8 +337,12 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R @Override public CalendarProvider getCalendarProvider() { if (calendarProvider == null) { - CalendarProvider provider = new CalendarProviderImpl(getAdapterType(), - getLanguageTagSet("CalendarData")); + CalendarProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> + new CalendarProviderImpl( + getAdapterType(), + getLanguageTagSet("CalendarData"))); + synchronized (this) { if (calendarProvider == null) { calendarProvider = provider; @@ -319,6 +366,7 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R } // ResourceBundleBasedAdapter method implementation + @Override public LocaleData getLocaleData() { if (localeData == null) { @@ -449,4 +497,4 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R } return locales; } - } +} diff --git a/jdk/test/java/util/PluggableLocale/ExecTest.sh b/jdk/test/java/util/PluggableLocale/ExecTest.sh index 7e8a5365f45..888f9348e51 100644 --- a/jdk/test/java/util/PluggableLocale/ExecTest.sh +++ b/jdk/test/java/util/PluggableLocale/ExecTest.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2015, 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 @@ -33,7 +33,7 @@ # Parameters: # providersToTest: [foo|bar|foobar] # java class name: -# providersInExtDir: [true|false] +# java security policy file: (Optional. Installs security manager if exists) if [ "${TESTSRC}" = "" ] then @@ -113,8 +113,14 @@ else exit $result fi +# security options +if [ "$3" != "" ] +then + SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3" +fi + # run -RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 " +RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} $2 " echo ${RUNCMD} ${RUNCMD} diff --git a/jdk/test/java/util/PluggableLocale/PermissionTest.java b/jdk/test/java/util/PluggableLocale/PermissionTest.java new file mode 100644 index 00000000000..c70c5d195cb --- /dev/null +++ b/jdk/test/java/util/PluggableLocale/PermissionTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2015, 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. + */ +/* + * + */ +public class PermissionTest{ + + // Make sure provider impls can be instantiated under a security manager.ZZ + com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl(); + com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl(); + com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl(); + com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl(); + com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl(); + com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl(); + com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl(); + com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2(); + com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl(); + com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl(); + com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl(); + com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl(); + com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl(); + + public static void main(String[] s) { + new PermissionTest(); + } +} diff --git a/jdk/test/java/util/PluggableLocale/PermissionTest.sh b/jdk/test/java/util/PluggableLocale/PermissionTest.sh new file mode 100644 index 00000000000..50a42f1ff3e --- /dev/null +++ b/jdk/test/java/util/PluggableLocale/PermissionTest.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (c) 2015, 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 8075545 +# @summary Check whether RuntimePermission("localeServiceProvider") is +# handled correctly +# @run shell ExecTest.sh foobar PermissionTest +# @run shell/fail ExecTest.sh foobar PermissionTest dummy +# @run shell ExecTest.sh foobar PermissionTest localeServiceProvider.policy diff --git a/jdk/test/java/util/PluggableLocale/localeServiceProvider.policy b/jdk/test/java/util/PluggableLocale/localeServiceProvider.policy new file mode 100644 index 00000000000..4a5d969c0b0 --- /dev/null +++ b/jdk/test/java/util/PluggableLocale/localeServiceProvider.policy @@ -0,0 +1,3 @@ +grant { + permission java.lang.RuntimePermission "localeServiceProvider"; +}; From 20afeb990784e9910bf7ffcda18f83f118c4f7b7 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 29 Apr 2015 22:33:42 +0200 Subject: [PATCH 41/63] 8078437: Enable use of devkits for Windows Reviewed-by: ihse --- common/autoconf/basics.m4 | 46 +- common/autoconf/basics_windows.m4 | 2 +- common/autoconf/generated-configure.sh | 2208 +++++++++++++++++++++--- common/autoconf/toolchain.m4 | 9 +- common/autoconf/toolchain_windows.m4 | 191 +- 5 files changed, 2129 insertions(+), 327 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 5eb945ef53b..f78c2d88279 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -478,6 +478,15 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], AUTOCONF_DIR=$TOPDIR/common/autoconf ]) +# Evaluates platform specific overrides for devkit variables. +# $1: Name of variable +AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE], +[ + if test "x[$]$1" = x; then + eval $1="\${$1_${OPENJDK_TARGET_CPU}}" + fi +]) + AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], [ AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], @@ -487,12 +496,27 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], DEVKIT_ROOT="$with_devkit" # Check for a meta data info file in the root of the devkit if test -f "$DEVKIT_ROOT/devkit.info"; then - # This potentially sets the following: - # DEVKIT_NAME: A descriptive name of the devkit - # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path - # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path - # DEVKIT_SYSROOT: Corresponds to --with-sysroot . $DEVKIT_ROOT/devkit.info + # This potentially sets the following: + # A descriptive name of the devkit + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME]) + # Corresponds to --with-extra-path + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH]) + # Corresponds to --with-toolchain-path + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH]) + # Corresponds to --with-sysroot + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT]) + + # Identifies the Visual Studio version in the devkit + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION]) + # The Visual Studio include environment variable + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE]) + # The Visual Studio lib environment variable + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB]) + # Corresponds to --with-msvcr-dll + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL]) + # Corresponds to --with-msvcp-dll + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL]) fi AC_MSG_CHECKING([for devkit]) @@ -502,9 +526,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], AC_MSG_RESULT([$DEVKIT_ROOT]) fi - if test "x$DEVKIT_EXTRA_PATH" != x; then - BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) - fi + BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) # Fallback default of just /bin if DEVKIT_PATH is not defined if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then @@ -681,8 +703,12 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], files_present=`$LS $OUTPUT_ROOT` # Configure has already touched config.log and confdefs.h in the current dir when this check # is performed. - filtered_files=`$ECHO "$files_present" | $SED -e 's/config.log//g' -e 's/confdefs.h//g' -e 's/ //g' \ - | $TR -d '\n'` + filtered_files=`$ECHO "$files_present" \ + | $SED -e 's/config.log//g' \ + -e 's/confdefs.h//g' \ + -e 's/fixpath.exe//g' \ + -e 's/ //g' \ + | $TR -d '\n'` if test "x$filtered_files" != x; then AC_MSG_NOTICE([Current directory is $CURDIR.]) AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here]) diff --git a/common/autoconf/basics_windows.m4 b/common/autoconf/basics_windows.m4 index 7ce14a82d8b..210cc455047 100644 --- a/common/autoconf/basics_windows.m4 +++ b/common/autoconf/basics_windows.m4 @@ -66,7 +66,7 @@ AC_DEFUN([BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN], # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 5d5e9fbee85..bc5063b9662 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -3464,6 +3464,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Setup basic configuration paths, and platform-specific stuff related to PATHs. +# Evaluates platform specific overrides for devkit variables. +# $1: Name of variable + + @@ -4363,7 +4367,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1429271657 +DATE_WHEN_GENERATED=1430331133 ############################################################################### # @@ -14182,7 +14186,7 @@ $as_echo "$as_me: The path of CURDIR, which resolves as \"$path\", is invalid." # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -14308,7 +14312,7 @@ $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -14878,7 +14882,7 @@ $as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is inval # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -14965,12 +14969,63 @@ $as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is inval DEVKIT_ROOT="$with_devkit" # Check for a meta data info file in the root of the devkit if test -f "$DEVKIT_ROOT/devkit.info"; then - # This potentially sets the following: - # DEVKIT_NAME: A descriptive name of the devkit - # DEVKIT_TOOLCHAIN_PATH: Corresponds to --with-toolchain-path - # DEVKIT_EXTRA_PATH: Corresponds to --with-extra-path - # DEVKIT_SYSROOT: Corresponds to --with-sysroot . $DEVKIT_ROOT/devkit.info + # This potentially sets the following: + # A descriptive name of the devkit + + if test "x$DEVKIT_NAME" = x; then + eval DEVKIT_NAME="\${DEVKIT_NAME_${OPENJDK_TARGET_CPU}}" + fi + + # Corresponds to --with-extra-path + + if test "x$DEVKIT_EXTRA_PATH" = x; then + eval DEVKIT_EXTRA_PATH="\${DEVKIT_EXTRA_PATH_${OPENJDK_TARGET_CPU}}" + fi + + # Corresponds to --with-toolchain-path + + if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then + eval DEVKIT_TOOLCHAIN_PATH="\${DEVKIT_TOOLCHAIN_PATH_${OPENJDK_TARGET_CPU}}" + fi + + # Corresponds to --with-sysroot + + if test "x$DEVKIT_SYSROOT" = x; then + eval DEVKIT_SYSROOT="\${DEVKIT_SYSROOT_${OPENJDK_TARGET_CPU}}" + fi + + + # Identifies the Visual Studio version in the devkit + + if test "x$DEVKIT_VS_VERSION" = x; then + eval DEVKIT_VS_VERSION="\${DEVKIT_VS_VERSION_${OPENJDK_TARGET_CPU}}" + fi + + # The Visual Studio include environment variable + + if test "x$DEVKIT_VS_INCLUDE" = x; then + eval DEVKIT_VS_INCLUDE="\${DEVKIT_VS_INCLUDE_${OPENJDK_TARGET_CPU}}" + fi + + # The Visual Studio lib environment variable + + if test "x$DEVKIT_VS_LIB" = x; then + eval DEVKIT_VS_LIB="\${DEVKIT_VS_LIB_${OPENJDK_TARGET_CPU}}" + fi + + # Corresponds to --with-msvcr-dll + + if test "x$DEVKIT_MSVCR_DLL" = x; then + eval DEVKIT_MSVCR_DLL="\${DEVKIT_MSVCR_DLL_${OPENJDK_TARGET_CPU}}" + fi + + # Corresponds to --with-msvcp-dll + + if test "x$DEVKIT_MSVCP_DLL" = x; then + eval DEVKIT_MSVCP_DLL="\${DEVKIT_MSVCP_DLL_${OPENJDK_TARGET_CPU}}" + fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5 @@ -14983,7 +15038,6 @@ $as_echo "$DEVKIT_NAME in $DEVKIT_ROOT" >&6; } $as_echo "$DEVKIT_ROOT" >&6; } fi - if test "x$DEVKIT_EXTRA_PATH" != x; then if test "x$DEVKIT_EXTRA_PATH" != x; then if test "x$EXTRA_PATH" = x; then @@ -14993,7 +15047,6 @@ $as_echo "$DEVKIT_ROOT" >&6; } fi fi - fi # Fallback default of just /bin if DEVKIT_PATH is not defined if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then @@ -15288,8 +15341,12 @@ $as_echo "in current directory" >&6; } files_present=`$LS $OUTPUT_ROOT` # Configure has already touched config.log and confdefs.h in the current dir when this check # is performed. - filtered_files=`$ECHO "$files_present" | $SED -e 's/config.log//g' -e 's/confdefs.h//g' -e 's/ //g' \ - | $TR -d '\n'` + filtered_files=`$ECHO "$files_present" \ + | $SED -e 's/config.log//g' \ + -e 's/confdefs.h//g' \ + -e 's/fixpath.exe//g' \ + -e 's/ //g' \ + | $TR -d '\n'` if test "x$filtered_files" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Current directory is $CURDIR." >&5 $as_echo "$as_me: Current directory is $CURDIR." >&6;} @@ -15356,7 +15413,7 @@ $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is inval # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -15671,7 +15728,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -16058,7 +16115,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -16442,7 +16499,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -16831,7 +16888,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -17214,7 +17271,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -20279,7 +20336,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -20608,7 +20665,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -20799,7 +20856,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -20983,7 +21040,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -21166,7 +21223,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -21349,7 +21406,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -21523,7 +21580,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -21672,7 +21729,7 @@ $as_echo "$as_me: The path of JAVA_HOME_PROCESSED, which resolves as \"$path\", # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -21842,7 +21899,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -22167,7 +22224,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -22379,7 +22436,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -22556,7 +22613,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -22761,7 +22818,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -22938,7 +22995,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -23143,7 +23200,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -23320,7 +23377,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -23525,7 +23582,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -23702,7 +23759,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -23894,7 +23951,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24069,7 +24126,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24262,7 +24319,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24437,7 +24494,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24629,7 +24686,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24804,7 +24861,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -24997,7 +25054,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -25172,7 +25229,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -25346,7 +25403,7 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid. # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -26726,11 +26783,15 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" + # autoconf magic only relies on PATH, so update it if tools dir is specified + OLD_PATH="$PATH" + # On Windows, we need to detect the visual studio installation first. # This will change the PATH, but we need to keep that new PATH even # after toolchain detection is done, since the compiler (on x86) uses # it for DLL resolution in runtime. - if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then + if test "x$OPENJDK_BUILD_OS" = "xwindows" \ + && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then # Store path to cygwin link.exe to help excluding it when searching for # VS linker. This must be done before changing the PATH when looking for VS. @@ -26808,6 +26869,56 @@ $as_echo "$as_me: The following toolchain versions are valid on this platform:" done exit 0 + elif test "x$DEVKIT_VS_VERSION" != x; then + VS_VERSION=$DEVKIT_VS_VERSION + TOOLCHAIN_VERSION=$VS_VERSION + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" + eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" + eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" + eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" + VS_PATH="$TOOLCHAIN_PATH:$PATH" + + # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it + # can still be exported as INCLUDE for compiler invocations without + # SYSROOT_CFLAGS + OLDIFS="$IFS" + IFS=";" + for i in $DEVKIT_VS_INCLUDE; do + ipath=$i + + unix_path="$ipath" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + ipath="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + ipath="$windows_path" + fi + + VS_INCLUDE="$VS_INCLUDE;$ipath" + done + # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported + # as LIB for compiler invocations without SYSROOT_LDFLAGS + for i in $DEVKIT_VS_LIB; do + libpath=$i + + unix_path="$libpath" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + libpath="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + libpath="$windows_path" + fi + + VS_LIB="$VS_LIB;$libpath" + done + IFS="$OLDIFS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: Found devkit $VS_DESCRIPTION" >&5 +$as_echo "$as_me: Found devkit $VS_DESCRIPTION" >&6;} + elif test "x$with_toolchain_version" != x; then # User override; check that it is valid if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then @@ -27380,8 +27491,10 @@ $as_echo "$as_me: Found $VS_DESCRIPTION" >&6;} done - if test "x$VS_ENV_CMD" != x; then - # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. + # If we have a devkit, skip all of the below. + if test "x$DEVKIT_VS_VERSION" = x; then + if test "x$VS_ENV_CMD" != x; then + # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. # Only process if variable expands to non-empty @@ -27481,7 +27594,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -27669,17 +27782,17 @@ $as_echo "$as_me: Rewriting VS_ENV_CMD to \"$new_complete\"" >&6;} fi - # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat - { $as_echo "$as_me:${as_lineno-$LINENO}: Trying to extract Visual Studio environment variables" >&5 + # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat + { $as_echo "$as_me:${as_lineno-$LINENO}: Trying to extract Visual Studio environment variables" >&5 $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;} - # We need to create a couple of temporary files. - VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" - $MKDIR -p $VS_ENV_TMP_DIR + # We need to create a couple of temporary files. + VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" + $MKDIR -p $VS_ENV_TMP_DIR - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). - # Instead create a shell script which will set the relevant variables when run. - WINPATH_VS_ENV_CMD="$VS_ENV_CMD" + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). + # Instead create a shell script which will set the relevant variables when run. + WINPATH_VS_ENV_CMD="$VS_ENV_CMD" unix_path="$WINPATH_VS_ENV_CMD" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -27690,7 +27803,7 @@ $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;} WINPATH_VS_ENV_CMD="$windows_path" fi - WINPATH_BASH="$BASH" + WINPATH_BASH="$BASH" unix_path="$WINPATH_BASH" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -27702,59 +27815,67 @@ $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;} fi - # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell - # script (executable by bash) that will setup the important variables. - EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" - $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE - # This will end up something like: - # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat - $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE - # These will end up something like: - # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh - # The trailing space for everyone except PATH is no typo, but is needed due - # to trailing \ in the Windows paths. These will be stripped later. - $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell + # script (executable by bash) that will setup the important variables. + EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" + $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE + # This will end up something like: + # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat + $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # These will end up something like: + # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh + # The trailing space for everyone except PATH is no typo, but is needed due + # to trailing \ in the Windows paths. These will be stripped later. + $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE - # Now execute the newly created bat file. - # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. - # Change directory so we don't need to mess with Windows paths in redirects. - cd $VS_ENV_TMP_DIR - cmd /c extract-vs-env.bat | $CAT - cd $CURDIR + # Now execute the newly created bat file. + # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. + # Change directory so we don't need to mess with Windows paths in redirects. + cd $VS_ENV_TMP_DIR + cmd /c extract-vs-env.bat | $CAT + cd $CURDIR - if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Could not succesfully extract the envionment variables needed for the VS setup." >&5 + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Could not succesfully extract the envionment variables needed for the VS setup." >&5 $as_echo "$as_me: Could not succesfully extract the envionment variables needed for the VS setup." >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Try setting --with-tools-dir to the VC/bin directory within the VS installation" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Try setting --with-tools-dir to the VC/bin directory within the VS installation" >&5 $as_echo "$as_me: Try setting --with-tools-dir to the VC/bin directory within the VS installation" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: or run \"bash.exe -l\" from a VS command prompt and then run configure from there." >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: or run \"bash.exe -l\" from a VS command prompt and then run configure from there." >&5 $as_echo "$as_me: or run \"bash.exe -l\" from a VS command prompt and then run configure from there." >&6;} - as_fn_error $? "Cannot continue" "$LINENO" 5 - fi + as_fn_error $? "Cannot continue" "$LINENO" 5 + fi - # Now set all paths and other env variables. This will allow the rest of - # the configure script to find and run the compiler in the proper way. - { $as_echo "$as_me:${as_lineno-$LINENO}: Setting extracted environment variables" >&5 + # Now set all paths and other env variables. This will allow the rest of + # the configure script to find and run the compiler in the proper way. + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting extracted environment variables" >&5 $as_echo "$as_me: Setting extracted environment variables" >&6;} - . $VS_ENV_TMP_DIR/set-vs-env.sh - # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we - # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. - else - # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. - { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot locate a valid Visual Studio installation, checking current environment" >&5 + . $VS_ENV_TMP_DIR/set-vs-env.sh + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we + # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. + else + # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. + { $as_echo "$as_me:${as_lineno-$LINENO}: Cannot locate a valid Visual Studio installation, checking current environment" >&5 $as_echo "$as_me: Cannot locate a valid Visual Studio installation, checking current environment" >&6;} + fi fi # At this point, we should have correct variables in the environment, or we can't continue. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Visual Studio variables" >&5 $as_echo_n "checking for Visual Studio variables... " >&6; } - if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then + if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \ + || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: present but broken" >&5 $as_echo "present but broken" >&6; } @@ -27839,7 +27960,7 @@ $as_echo "$as_me: The path of ipath, which resolves as \"$path\", is invalid." > # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -27989,7 +28110,7 @@ $as_echo "$as_me: The path of libpath, which resolves as \"$path\", is invalid." # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -28108,9 +28229,6 @@ $as_echo "$as_me: or run \"bash.exe -l\" from a VS command prompt and then run c export LIB="$VS_LIB" fi - # autoconf magic only relies on PATH, so update it if tools dir is specified - OLD_PATH="$PATH" - # For solaris we really need solaris tools, and not the GNU equivalent. # The build tools on Solaris reside in /usr/ccs (C Compilation System), # so add that to path before starting to probe. @@ -28449,7 +28567,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -28910,7 +29028,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -30197,7 +30315,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -30658,7 +30776,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -31524,7 +31642,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -31943,7 +32061,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -32291,7 +32409,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -32790,7 +32908,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -33422,7 +33540,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -33897,7 +34015,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -34240,7 +34358,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -34581,7 +34699,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -34904,7 +35022,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -35423,7 +35541,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -35895,7 +36013,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -36367,7 +36485,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -36840,7 +36958,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -37424,7 +37542,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -38006,7 +38124,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -38597,7 +38715,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -39185,7 +39303,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -39681,7 +39799,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -40153,7 +40271,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -40625,7 +40743,7 @@ $as_echo "$as_me: Neither \"$new_path\" nor \"$new_path.exe/cmd\" can be found" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -41176,7 +41294,7 @@ $as_echo "$as_me: The path of JT_HOME, which resolves as \"$path\", is invalid." # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -44730,7 +44848,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -44856,7 +44974,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -45091,7 +45209,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -45217,7 +45335,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -45713,7 +45831,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -45839,7 +45957,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46049,7 +46167,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46175,7 +46293,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46376,7 +46494,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46502,7 +46620,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46703,7 +46821,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -46829,7 +46947,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47031,7 +47149,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47157,7 +47275,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47360,7 +47478,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47486,7 +47604,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47685,7 +47803,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -47811,7 +47929,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -48010,7 +48128,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -48136,7 +48254,7 @@ $as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$ # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -48318,7 +48436,7 @@ $as_echo "$as_me: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\" # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -48452,7 +48570,7 @@ $as_echo "$as_me: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -49967,7 +50085,7 @@ fi if test "x$with_msvcr_dll" != x; then # If given explicitely by user, do not probe. If not present, fail directly. - DLL_NAME="$DLL_NAME" + DLL_NAME="$MSVCR_NAME" POSSIBLE_MSVC_DLL="$with_msvcr_dll" METHOD="--with-msvcr-dll" if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then @@ -49997,6 +50115,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50012,9 +50256,183 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" if test "x$MSVC_DLL" = x; then as_fn_error $? "Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll" "$LINENO" 5 fi + MSVCR_DLL="$MSVC_DLL" + elif test "x$DEVKIT_MSVCR_DLL" != x; then + + DLL_NAME="$MSVCR_NAME" + POSSIBLE_MSVC_DLL="$DEVKIT_MSVCR_DLL" + METHOD="devkit" + if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;} + + # Need to check if the found msvcr is correct architecture + { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; } + MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" + # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems. + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + CORRECT_MSVCR_ARCH="PE32 executable" + else + CORRECT_MSVCR_ARCH="PE32+ executable" + fi + else + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + CORRECT_MSVCR_ARCH=386 + else + CORRECT_MSVCR_ARCH=x86-64 + fi + fi + if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 +$as_echo "$MSVC_DLL" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 +$as_echo "incorrect, ignoring" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} + fi + fi + + if test "x$MSVC_DLL" = x; then + as_fn_error $? "Could not find a proper $MSVCR_NAME as specified by devkit" "$LINENO" 5 + fi + MSVCR_DLL="$MSVC_DLL" else - VAR_NAME="MSVCR_DLL" DLL_NAME="${MSVCR_NAME}" MSVC_DLL= @@ -50069,6 +50487,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50118,6 +50662,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50177,6 +50847,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50243,6 +51039,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50306,39 +51228,15 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 -$as_echo_n "checking for $DLL_NAME... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 -$as_echo "$MSVC_DLL" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 -$as_echo "incorrect, ignoring" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 -$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} - fi - fi - - fi - fi - - if test "x$MSVC_DLL" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 -$as_echo_n "checking for $DLL_NAME... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5 - fi - - MSVCR_DLL=$MSVC_DLL # Only process if variable expands to non-empty - if test "x$MSVCR_DLL" != x; then + if test "x$MSVC_DLL" != x; then if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. - path="$MSVCR_DLL" + path="$MSVC_DLL" new_path=`$CYGPATH -u "$path"` # Cygwin tries to hide some aspects of the Windows file system, such that binaries are @@ -50350,9 +51248,9 @@ $as_echo "no" >&6; } # It is also a way to make sure we got the proper file name for the real test later on. test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` if test "x$test_shortpath" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of MSVCR_DLL" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 fi # Call helper function which possibly converts this using DOS-style short mode. @@ -50372,7 +51270,7 @@ $as_echo "$as_me: The path of MSVCR_DLL, which resolves as \"$path\", is invalid # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -50390,14 +51288,14 @@ $as_echo "$as_me: The path of MSVCR_DLL, which resolves as \"$path\", is invalid if test "x$path" != "x$new_path"; then - MSVCR_DLL="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCR_DLL to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} fi elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - path="$MSVCR_DLL" + path="$MSVC_DLL" has_colon=`$ECHO $path | $GREP ^.:` new_path="$path" if test "x$has_colon" = x; then @@ -50428,9 +51326,9 @@ $as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} fi if test "x$path" != "x$new_path"; then - MSVCR_DLL="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCR_DLL to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} fi # Save the first 10 bytes of this path to the storage, so fixpath can work. @@ -50438,29 +51336,51 @@ $as_echo "$as_me: Rewriting MSVCR_DLL to \"$new_path\"" >&6;} else # We're on a unix platform. Hooray! :) - path="$MSVCR_DLL" + path="$MSVC_DLL" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of MSVCR_DLL, which resolves as \"$path\", is invalid." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 fi # Use eval to expand a potential ~ eval path="$path" if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of MSVCR_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 fi - MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`" + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" fi fi - MSVCR_DLL=$MSVCR_DLL - - + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 +$as_echo "$MSVC_DLL" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 +$as_echo "incorrect, ignoring" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} + fi fi + fi + fi + + if test "x$MSVC_DLL" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5 + fi + + MSVCR_DLL="$MSVC_DLL" + fi + + # Check whether --with-msvcp-dll was given. if test "${with_msvcp_dll+set}" = set; then : @@ -50472,7 +51392,7 @@ fi if test "x$with_msvcp_dll" != x; then # If given explicitely by user, do not probe. If not present, fail directly. - DLL_NAME="$DLL_NAME" + DLL_NAME="$MSVCP_NAME" POSSIBLE_MSVC_DLL="$with_msvcp_dll" METHOD="--with-msvcp-dll" if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then @@ -50502,6 +51422,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50517,9 +51563,183 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" if test "x$MSVC_DLL" = x; then as_fn_error $? "Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll" "$LINENO" 5 fi + MSVCP_DLL="$MSVC_DLL" + elif test "x$DEVKIT_MSVCP_DLL" != x; then + + DLL_NAME="$MSVCP_NAME" + POSSIBLE_MSVC_DLL="$DEVKIT_MSVCP_DLL" + METHOD="devkit" + if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;} + + # Need to check if the found msvcr is correct architecture + { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; } + MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" + # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems. + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + CORRECT_MSVCR_ARCH="PE32 executable" + else + CORRECT_MSVCR_ARCH="PE32+ executable" + fi + else + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + CORRECT_MSVCR_ARCH=386 + else + CORRECT_MSVCR_ARCH=x86-64 + fi + fi + if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 +$as_echo "$MSVC_DLL" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 +$as_echo "incorrect, ignoring" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} + fi + fi + + if test "x$MSVC_DLL" = x; then + as_fn_error $? "Could not find a proper $MSVCP_NAME as specified by devkit" "$LINENO" 5 + fi + MSVCP_DLL="$MSVC_DLL" else - VAR_NAME="MSVCP_DLL" DLL_NAME="${MSVCP_NAME}" MSVC_DLL= @@ -50574,6 +51794,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50623,6 +51969,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50682,6 +52154,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50748,6 +52346,132 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" + + # Only process if variable expands to non-empty + + if test "x$MSVC_DLL" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$MSVC_DLL" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$MSVC_DLL" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$MSVC_DLL" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 $as_echo_n "checking for $DLL_NAME... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 @@ -50811,39 +52535,15 @@ $as_echo_n "checking found $DLL_NAME architecture... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } MSVC_DLL="$POSSIBLE_MSVC_DLL" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 -$as_echo_n "checking for $DLL_NAME... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 -$as_echo "$MSVC_DLL" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 -$as_echo "incorrect, ignoring" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 -$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} - fi - fi - - fi - fi - - if test "x$MSVC_DLL" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 -$as_echo_n "checking for $DLL_NAME... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5 - fi - - MSVCP_DLL=$MSVC_DLL # Only process if variable expands to non-empty - if test "x$MSVCP_DLL" != x; then + if test "x$MSVC_DLL" != x; then if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Input might be given as Windows format, start by converting to # unix format. - path="$MSVCP_DLL" + path="$MSVC_DLL" new_path=`$CYGPATH -u "$path"` # Cygwin tries to hide some aspects of the Windows file system, such that binaries are @@ -50855,9 +52555,9 @@ $as_echo "no" >&6; } # It is also a way to make sure we got the proper file name for the real test later on. test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` if test "x$test_shortpath" = x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;} - as_fn_error $? "Cannot locate the the path of MSVCP_DLL" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of MSVC_DLL" "$LINENO" 5 fi # Call helper function which possibly converts this using DOS-style short mode. @@ -50877,7 +52577,7 @@ $as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid # Going to short mode and back again did indeed matter. Since short mode is # case insensitive, let's make it lowercase to improve readability. shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-stile (cygpath) + # Now convert it back to Unix-style (cygpath) input_path=`$CYGPATH -u "$shortmode_path"` new_path="$input_path" fi @@ -50895,14 +52595,14 @@ $as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid if test "x$path" != "x$new_path"; then - MSVCP_DLL="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;} + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} fi elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - path="$MSVCP_DLL" + path="$MSVC_DLL" has_colon=`$ECHO $path | $GREP ^.:` new_path="$path" if test "x$has_colon" = x; then @@ -50933,9 +52633,9 @@ $as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;} fi if test "x$path" != "x$new_path"; then - MSVCP_DLL="$new_path" - { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5 -$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;} + MSVC_DLL="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVC_DLL to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting MSVC_DLL to \"$new_path\"" >&6;} fi # Save the first 10 bytes of this path to the storage, so fixpath can work. @@ -50943,30 +52643,52 @@ $as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;} else # We're on a unix platform. Hooray! :) - path="$MSVCP_DLL" + path="$MSVC_DLL" has_space=`$ECHO "$path" | $GREP " "` if test "x$has_space" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5 -$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of MSVC_DLL, which resolves as \"$path\", is invalid." >&6;} as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 fi # Use eval to expand a potential ~ eval path="$path" if test ! -f "$path" && test ! -d "$path"; then - as_fn_error $? "The path of MSVCP_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 + as_fn_error $? "The path of MSVC_DLL, which resolves as \"$path\", is not found." "$LINENO" 5 fi - MSVCP_DLL="`cd "$path"; $THEPWDCMD -L`" + MSVC_DLL="`cd "$path"; $THEPWDCMD -L`" fi fi - MSVCP_DLL=$MSVCP_DLL - + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5 +$as_echo "$MSVC_DLL" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5 +$as_echo "incorrect, ignoring" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;} + fi + fi fi fi + if test "x$MSVC_DLL" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5 +$as_echo_n "checking for $DLL_NAME... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5 + fi + + MSVCP_DLL="$MSVC_DLL" + fi + + fi + # Check whether --with-dxsdk was given. diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index ed978d6a8fb..4a3c6426273 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -189,11 +189,15 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" + # autoconf magic only relies on PATH, so update it if tools dir is specified + OLD_PATH="$PATH" + # On Windows, we need to detect the visual studio installation first. # This will change the PATH, but we need to keep that new PATH even # after toolchain detection is done, since the compiler (on x86) uses # it for DLL resolution in runtime. - if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then + if test "x$OPENJDK_BUILD_OS" = "xwindows" \ + && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV # Reset path to VS_PATH. It will include everything that was on PATH at the time we # ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV. @@ -203,9 +207,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], export LIB="$VS_LIB" fi - # autoconf magic only relies on PATH, so update it if tools dir is specified - OLD_PATH="$PATH" - # For solaris we really need solaris tools, and not the GNU equivalent. # The build tools on Solaris reside in /usr/ccs (C Compilation System), # so add that to path before starting to probe. diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4 index 87850a25b2f..4a40fa63a91 100644 --- a/common/autoconf/toolchain_windows.m4 +++ b/common/autoconf/toolchain_windows.m4 @@ -210,6 +210,37 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO], done exit 0 + elif test "x$DEVKIT_VS_VERSION" != x; then + VS_VERSION=$DEVKIT_VS_VERSION + TOOLCHAIN_VERSION=$VS_VERSION + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" + eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" + eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" + eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" + VS_PATH="$TOOLCHAIN_PATH:$PATH" + + # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it + # can still be exported as INCLUDE for compiler invocations without + # SYSROOT_CFLAGS + OLDIFS="$IFS" + IFS=";" + for i in $DEVKIT_VS_INCLUDE; do + ipath=$i + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath]) + VS_INCLUDE="$VS_INCLUDE;$ipath" + done + # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported + # as LIB for compiler invocations without SYSROOT_LDFLAGS + for i in $DEVKIT_VS_LIB; do + libpath=$i + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath]) + VS_LIB="$VS_LIB;$libpath" + done + IFS="$OLDIFS" + + AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION]) + elif test "x$with_toolchain_version" != x; then # User override; check that it is valid if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then @@ -262,71 +293,81 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], # First-hand choice is to locate and run the vsvars bat file. TOOLCHAIN_FIND_VISUAL_STUDIO - if test "x$VS_ENV_CMD" != x; then - # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. - BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD) + # If we have a devkit, skip all of the below. + if test "x$DEVKIT_VS_VERSION" = x; then + if test "x$VS_ENV_CMD" != x; then + # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. + BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD) - # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat - AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) + # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat + AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) - # We need to create a couple of temporary files. - VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" - $MKDIR -p $VS_ENV_TMP_DIR + # We need to create a couple of temporary files. + VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" + $MKDIR -p $VS_ENV_TMP_DIR - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). - # Instead create a shell script which will set the relevant variables when run. - WINPATH_VS_ENV_CMD="$VS_ENV_CMD" - BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) - WINPATH_BASH="$BASH" - BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). + # Instead create a shell script which will set the relevant variables when run. + WINPATH_VS_ENV_CMD="$VS_ENV_CMD" + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) + WINPATH_BASH="$BASH" + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) - # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell - # script (executable by bash) that will setup the important variables. - EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" - $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE - # This will end up something like: - # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat - $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE - # These will end up something like: - # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh - # The trailing space for everyone except PATH is no typo, but is needed due - # to trailing \ in the Windows paths. These will be stripped later. - $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE + # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell + # script (executable by bash) that will setup the important variables. + EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" + $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE + # This will end up something like: + # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat + $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # These will end up something like: + # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh + # The trailing space for everyone except PATH is no typo, but is needed due + # to trailing \ in the Windows paths. These will be stripped later. + $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE + $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ + >> $EXTRACT_VC_ENV_BAT_FILE - # Now execute the newly created bat file. - # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. - # Change directory so we don't need to mess with Windows paths in redirects. - cd $VS_ENV_TMP_DIR - cmd /c extract-vs-env.bat | $CAT - cd $CURDIR + # Now execute the newly created bat file. + # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. + # Change directory so we don't need to mess with Windows paths in redirects. + cd $VS_ENV_TMP_DIR + cmd /c extract-vs-env.bat | $CAT + cd $CURDIR - if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then - AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.]) - AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) - AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) - AC_MSG_ERROR([Cannot continue]) + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then + AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.]) + AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) + AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) + AC_MSG_ERROR([Cannot continue]) + fi + + # Now set all paths and other env variables. This will allow the rest of + # the configure script to find and run the compiler in the proper way. + AC_MSG_NOTICE([Setting extracted environment variables]) + . $VS_ENV_TMP_DIR/set-vs-env.sh + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we + # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. + else + # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. + AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) fi - - # Now set all paths and other env variables. This will allow the rest of - # the configure script to find and run the compiler in the proper way. - AC_MSG_NOTICE([Setting extracted environment variables]) - . $VS_ENV_TMP_DIR/set-vs-env.sh - # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we - # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. - else - # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. - AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) fi # At this point, we should have correct variables in the environment, or we can't continue. AC_MSG_CHECKING([for Visual Studio variables]) - if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then + if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \ + || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then AC_MSG_RESULT([present but broken]) AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) @@ -403,10 +444,10 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL], POSSIBLE_MSVC_DLL="$2" METHOD="$3" if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then - AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD]) + AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD]) # Need to check if the found msvcr is correct architecture - AC_MSG_CHECKING([found $1 architecture]) + AC_MSG_CHECKING([found $DLL_NAME architecture]) MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" @@ -426,19 +467,19 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL], if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then AC_MSG_RESULT([ok]) MSVC_DLL="$POSSIBLE_MSVC_DLL" - AC_MSG_CHECKING([for $1]) + BASIC_FIXUP_PATH(MSVC_DLL) + AC_MSG_CHECKING([for $DLL_NAME]) AC_MSG_RESULT([$MSVC_DLL]) else AC_MSG_RESULT([incorrect, ignoring]) - AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE]) + AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE]) fi fi ]) AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], [ - VAR_NAME="$1" - DLL_NAME="$2" + DLL_NAME="$1" MSVC_DLL= if test "x$MSVC_DLL" = x; then @@ -517,10 +558,6 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], AC_MSG_RESULT([no]) AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.]) fi - - $1=$MSVC_DLL - BASIC_FIXUP_PATH($1) - AC_SUBST($1, [$]$1) ]) AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], @@ -530,14 +567,22 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], if test "x$with_msvcr_dll" != x; then # If given explicitely by user, do not probe. If not present, fail directly. - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll], - [--with-msvcr-dll]) + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll]) if test "x$MSVC_DLL" = x; then AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll]) fi + MSVCR_DLL="$MSVC_DLL" + elif test "x$DEVKIT_MSVCR_DLL" != x; then + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit]) + if test "x$MSVC_DLL" = x; then + AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit]) + fi + MSVCR_DLL="$MSVC_DLL" else - TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}]) + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}]) + MSVCR_DLL="$MSVC_DLL" fi + AC_SUBST(MSVCR_DLL) AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll], [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])]) @@ -545,13 +590,21 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], if test "x$MSVCP_NAME" != "x"; then if test "x$with_msvcp_dll" != x; then # If given explicitely by user, do not probe. If not present, fail directly. - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll], - [--with-msvcp-dll]) + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll]) if test "x$MSVC_DLL" = x; then AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll]) fi + MSVCP_DLL="$MSVC_DLL" + elif test "x$DEVKIT_MSVCP_DLL" != x; then + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit]) + if test "x$MSVC_DLL" = x; then + AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit]) + fi + MSVCP_DLL="$MSVC_DLL" else - TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}]) + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}]) + MSVCP_DLL="$MSVC_DLL" fi + AC_SUBST(MSVCP_DLL) fi ]) From 8c93ae056049951853571157a1707b21bf486d0b Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 29 Apr 2015 15:05:33 -0700 Subject: [PATCH 42/63] 8078054: [TESTBUG] tools/javac/Paths/wcMineField.sh failed with "operation not permitted" Reviewed-by: darcy --- langtools/test/tools/javac/Paths/wcMineField.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/langtools/test/tools/javac/Paths/wcMineField.sh b/langtools/test/tools/javac/Paths/wcMineField.sh index dbc940b8c10..f2cca15083f 100644 --- a/langtools/test/tools/javac/Paths/wcMineField.sh +++ b/langtools/test/tools/javac/Paths/wcMineField.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2015, 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 @@ -49,9 +49,9 @@ set -u #---------------------------------------------------------------- Cleanup() { Sys rm -rf GooSrc GooJar GooZip GooClass - Sys rm -rf SpeSrc SpeJar SpeZip SpeClass + Sys rm -rf SpeSrc SpeJar SpeZip SpeClass Sys rm -rf BadSrc BadJar BadZip BadClass - Sys rm -rf JarNClass StarJar MixJar StarDir + Sys rm -rf JarNClass StarJar MixJar StarDir Sys rm -rf OneDir *.class Main*.java MANIFEST.MF } @@ -127,11 +127,9 @@ starDir() { printf "Running tests with directory named \"*\"\n" Sys rm -rf ./StarDir Sys mkdir -p StarDir/"*" - Sys cp -p "GooClass/Lib3.class" "GooClass/Lib.class" ./ Sys cp "GooClass/Lib2.class" "StarDir/*/Lib2.class" - Sys "$jar" cf "StarDir/Lib3.jar" "Lib3.class" - Sys "$jar" cf "StarDir/*/Lib.jar" "Lib.class" - Sys rm -f "./Lib.class" "./Lib3.class" + Sys "$jar" cf "StarDir/Lib3.jar" -C GooClass "Lib3.class" + Sys "$jar" cf "StarDir/*/Lib.jar" -C GooClass "Lib.class" CheckFiles "StarDir/*/Lib.jar" "StarDir/*/Lib2.class" "StarDir/Lib3.jar" Sys cp Main6.java ./StarDir/. Sys cp Main.java ./StarDir/"*"/. From 30e8183ee89f9a86be5bc6e4061e3ad4dd9da230 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Wed, 29 Apr 2015 16:34:49 -0700 Subject: [PATCH 43/63] 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests Add ability to initial the random number generator from the system property "seed" and print to STDOUT the seed value actually used. Reviewed-by: darcy --- .../lang/Double/ParseHexFloatingPoint.java | 14 +-- jdk/test/java/lang/Integer/BitTwiddle.java | 11 +- jdk/test/java/lang/Long/BitTwiddle.java | 11 +- jdk/test/java/lang/Math/CubeRootTests.java | 11 +- jdk/test/java/lang/Math/HypotTests.java | 11 +- .../java/lang/Math/IeeeRecommendedTests.java | 11 +- jdk/test/java/lang/Math/Log1pTests.java | 11 +- .../math/BigDecimal/StringConstructor.java | 20 ++-- .../java/math/BigInteger/BigIntegerTest.java | 95 ++++++++-------- .../java/math/BigInteger/ModPow65537.java | 12 ++- jdk/test/java/math/BigInteger/PrimeTest.java | 11 +- .../math/BigInteger/SymmetricRangeTests.java | 13 +-- jdk/test/java/math/RandomSeed.java | 81 -------------- .../jdk/testlibrary/RandomFactory.java | 101 ++++++++++++++++++ 14 files changed, 228 insertions(+), 185 deletions(-) delete mode 100644 jdk/test/java/math/RandomSeed.java create mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java diff --git a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java index 14ac2f0f567..0c70e02eca6 100644 --- a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java +++ b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,15 +23,15 @@ /* * @test - * @bug 4826774 - * @summary Numerical tests for hexadecimal inputs to parseDouble, parseFloat + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main ParseHexFloatingPoint + * @bug 4826774 8078672 + * @summary Numerical tests for hexadecimal inputs to parse{Double, Float} (use -Dseed=X to set PRNG seed) * @author Joseph D. Darcy * @key randomness */ - -import java.util.regex.*; - public class ParseHexFloatingPoint { private ParseHexFloatingPoint(){} @@ -256,7 +256,7 @@ public class ParseHexFloatingPoint { failures += significandAlignmentTests(); { - java.util.Random rand = new java.util.Random(); + java.util.Random rand = RandomFactory.getRandom(); // Consistency check; double => hexadecimal => double // preserves the original value. for(int i = 0; i < 1000; i++) { diff --git a/jdk/test/java/lang/Integer/BitTwiddle.java b/jdk/test/java/lang/Integer/BitTwiddle.java index 8796c0769ea..95104df08ef 100644 --- a/jdk/test/java/lang/Integer/BitTwiddle.java +++ b/jdk/test/java/lang/Integer/BitTwiddle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4495754 - * @summary Basic test for int bit twiddling + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main BitTwiddle + * @bug 4495754 8078672 + * @summary Basic test for int bit twiddling (use -Dseed=X to set PRNG seed) * @author Josh Bloch * @key randomness */ @@ -36,7 +39,7 @@ public class BitTwiddle { private static final int N = 1000; // # of repetitions per test public static void main(String args[]) { - Random rnd = new Random(); + Random rnd = RandomFactory.getRandom(); if (highestOneBit(0) != 0) throw new RuntimeException("a"); diff --git a/jdk/test/java/lang/Long/BitTwiddle.java b/jdk/test/java/lang/Long/BitTwiddle.java index 0132ea463dc..9dacbc7579f 100644 --- a/jdk/test/java/lang/Long/BitTwiddle.java +++ b/jdk/test/java/lang/Long/BitTwiddle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4495754 - * @summary Basic test for long bit twiddling + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main BitTwiddle + * @bug 4495754 8078672 + * @summary Basic test for long bit twiddling (use -Dseed=X to set PRNG seed) * @author Josh Bloch * @key randomness */ @@ -36,7 +39,7 @@ public class BitTwiddle { private static final int N = 1000; // # of repetitions per test public static void main(String args[]) { - Random rnd = new Random(); + Random rnd = RandomFactory.getRandom(); if (highestOneBit(0) != 0) throw new RuntimeException("a"); diff --git a/jdk/test/java/lang/Math/CubeRootTests.java b/jdk/test/java/lang/Math/CubeRootTests.java index 8ce79d33d3a..956949f8ca4 100644 --- a/jdk/test/java/lang/Math/CubeRootTests.java +++ b/jdk/test/java/lang/Math/CubeRootTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4347132 4939441 - * @summary Tests for {Math, StrictMath}.cbrt + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main CubeRootTests + * @bug 4347132 4939441 8078672 + * @summary Tests for {Math, StrictMath}.cbrt (use -Dseed=X to set PRNG seed) * @author Joseph D. Darcy * @key randomness */ @@ -36,7 +39,7 @@ public class CubeRootTests { static final double NaNd = Double.NaN; // Initialize shared random number generator - static java.util.Random rand = new java.util.Random(); + static java.util.Random rand = RandomFactory.getRandom(); static int testCubeRootCase(double input, double expected) { int failures=0; diff --git a/jdk/test/java/lang/Math/HypotTests.java b/jdk/test/java/lang/Math/HypotTests.java index afcec4d8642..21fa0b51736 100644 --- a/jdk/test/java/lang/Math/HypotTests.java +++ b/jdk/test/java/lang/Math/HypotTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4851638 4939441 - * @summary Tests for {Math, StrictMath}.hypot + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main HypotTests + * @bug 4851638 4939441 8078672 + * @summary Tests for {Math, StrictMath}.hypot (use -Dseed=X to set PRNG seed) * @author Joseph D. Darcy * @key randomness */ @@ -120,7 +123,7 @@ public class HypotTests { * exponent). While the exponent of r is less than or equal * to (MAX_EXPONENT - 3), the computation should not overflow. */ - java.util.Random rand = new java.util.Random(); + java.util.Random rand = RandomFactory.getRandom(); for(int i = 0; i < 1000; i++) { double d = rand.nextDouble(); // Scale d to have an exponent equal to MAX_EXPONENT -15 diff --git a/jdk/test/java/lang/Math/IeeeRecommendedTests.java b/jdk/test/java/lang/Math/IeeeRecommendedTests.java index 710bfa339a8..e9e276044f0 100644 --- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java +++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4860891 4826732 4780454 4939441 4826652 - * @summary Tests for IEEE 754[R] recommended functions and similar methods + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main IeeeRecommendedTests + * @bug 4860891 4826732 4780454 4939441 4826652 8078672 + * @summary Tests for IEEE 754[R] recommended functions and similar methods (use -Dseed=X to set PRNG seed) * @author Joseph D. Darcy * @key randomness */ @@ -46,7 +49,7 @@ public class IeeeRecommendedTests { static final double Double_MAX_SUBNORMALmm = 0x0.ffffffffffffeP-1022; // Initialize shared random number generator - static java.util.Random rand = new java.util.Random(); + static java.util.Random rand = RandomFactory.getRandom(); /** * Returns a floating-point power of two in the normal range. diff --git a/jdk/test/java/lang/Math/Log1pTests.java b/jdk/test/java/lang/Math/Log1pTests.java index 191f5433bd6..445b0e3dfdc 100644 --- a/jdk/test/java/lang/Math/Log1pTests.java +++ b/jdk/test/java/lang/Math/Log1pTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -23,8 +23,11 @@ /* * @test - * @bug 4851638 4939441 - * @summary Tests for {Math, StrictMath}.log1p + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main Log1pTests + * @bug 4851638 4939441 8078672 + * @summary Tests for {Math, StrictMath}.log1p (use -Dseed=X to set PRNG seed) * @author Joseph D. Darcy * @key randomness */ @@ -99,7 +102,7 @@ public class Log1pTests { // Construct random values with exponents ranging from -53 to // 52 and compare against HP-15C formula. - java.util.Random rand = new java.util.Random(); + java.util.Random rand = RandomFactory.getRandom(); for(int i = 0; i < 1000; i++) { double d = rand.nextDouble(); diff --git a/jdk/test/java/math/BigDecimal/StringConstructor.java b/jdk/test/java/math/BigDecimal/StringConstructor.java index 08c88a2672c..fde327dd075 100644 --- a/jdk/test/java/math/BigDecimal/StringConstructor.java +++ b/jdk/test/java/math/BigDecimal/StringConstructor.java @@ -23,21 +23,20 @@ /* * @test - * @library .. - * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460 + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main StringConstructor + * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460 8078672 * @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed). * @key randomness */ import java.math.*; +import java.util.Random; public class StringConstructor { - private static RandomSeed rndSeed = new RandomSeed(false); - public static void main(String[] args) throws Exception { - System.out.println("Random number generator seed = " + rndSeed.getSeed()); - constructWithError(""); constructWithError("+"); constructWithError("-"); @@ -72,13 +71,14 @@ public class StringConstructor { nonAsciiZeroTest(); // Roundtrip tests + Random random = RandomFactory.getRandom(); for (int i=0; i<100; i++) { - int size = rndSeed.getRandom().nextInt(100) + 1; - BigInteger bi = new BigInteger(size, rndSeed.getRandom()); - if (rndSeed.getRandom().nextBoolean()) + int size = random.nextInt(100) + 1; + BigInteger bi = new BigInteger(size, random); + if (random.nextBoolean()) bi = bi.negate(); int decimalLength = bi.toString().length(); - int scale = rndSeed.getRandom().nextInt(decimalLength); + int scale = random.nextInt(decimalLength); BigDecimal bd = new BigDecimal(bi, scale); String bdString = bd.toString(); // System.err.println("bi" + bi.toString() + "\tscale " + scale); diff --git a/jdk/test/java/math/BigInteger/BigIntegerTest.java b/jdk/test/java/math/BigInteger/BigIntegerTest.java index 8bab07e63c0..687d06e70e9 100644 --- a/jdk/test/java/math/BigInteger/BigIntegerTest.java +++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java @@ -23,8 +23,10 @@ /* * @test - * @library .. - * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460 + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main BigIntegerTest + * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460 8078672 * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed) * @run main/timeout=400 BigIntegerTest * @author madbot @@ -37,6 +39,7 @@ import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.math.BigInteger; +import java.util.Random; /** * This is a simple test class created to ensure that the results @@ -87,7 +90,7 @@ public class BigIntegerTest { static final int SIZE = 1000; // numbers per batch - private static RandomSeed rndSeed = new RandomSeed(false); + private static Random random = RandomFactory.getRandom(); static boolean failure = false; @@ -99,7 +102,7 @@ public class BigIntegerTest { int arrayLength = 23; int halfLength = arrayLength/2; byte[] array = new byte[arrayLength]; - rndSeed.getRandom().nextBytes(array); + random.nextBytes(array); int[][] offLen = new int[][] { // offset, length, num exceptions {-1, arrayLength, 1}, // negative offset @@ -163,7 +166,7 @@ public class BigIntegerTest { } byte[] magNonZeroLength = new byte[42]; - rndSeed.getRandom().nextBytes(magNonZeroLength); + random.nextBytes(magNonZeroLength); for (int signum = -1; signum <= 1; signum++) { BigInteger bi = new BigInteger(signum, magNonZeroLength, 0, 0); if (bi.compareTo(BigInteger.ZERO) != 0) { @@ -176,13 +179,13 @@ public class BigIntegerTest { for (int i = 0; i < SIZE; i++) { // create reference value via a different code path from those tested - BigInteger reference = new BigInteger(2 + rndSeed.getRandom().nextInt(336), 4, rndSeed.getRandom()); + BigInteger reference = new BigInteger(2 + random.nextInt(336), 4, random); byte[] refArray = reference.toByteArray(); int refLen = refArray.length; - int factor = rndSeed.getRandom().nextInt(5); - int objLen = refArray.length + factor*rndSeed.getRandom().nextInt(refArray.length) + 1; - int offset = rndSeed.getRandom().nextInt(objLen - refLen); + int factor = random.nextInt(5); + int objLen = refArray.length + factor*random.nextInt(refArray.length) + 1; + int offset = random.nextInt(objLen - refLen); byte[] objArray = new byte[objLen]; System.arraycopy(refArray, 0, objArray, offset, refLen); @@ -193,7 +196,7 @@ public class BigIntegerTest { failCount++; } - boolean isNegative = rndSeed.getRandom().nextBoolean(); + boolean isNegative = random.nextBoolean(); BigInteger signMag = new BigInteger(isNegative ? -1 : 1, objArray, offset, refLen); if (signMag.compareTo(isNegative ? reference.negate() : reference) != 0) { System.err.println("Sign-magnitude BigInteger not equal for offset " + @@ -210,7 +213,7 @@ public class BigIntegerTest { for (int i=0; i= lower; bits--) { for (int i = 0; i < 50; i++) { - BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rndSeed.getRandom())); + BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, random)); for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) { String result = x.toString(radix); @@ -766,9 +769,9 @@ public class BigIntegerTest { int failCount = 0; for (int i=0; i<10; i++) { - BigInteger m = new BigInteger(100, 5, rndSeed.getRandom()); + BigInteger m = new BigInteger(100, 5, random); while(m.compareTo(BigInteger.ONE) != 1) - m = new BigInteger(100, 5, rndSeed.getRandom()); + m = new BigInteger(100, 5, random); BigInteger exp = m.subtract(BigInteger.ONE); BigInteger base = fetchNumber(order).abs(); while(base.compareTo(m) != -1) @@ -828,7 +831,7 @@ public class BigIntegerTest { // Test consistency for(int i=0; i<10; i++) { - p1 = BigInteger.probablePrime(100, rndSeed.getRandom()); + p1 = BigInteger.probablePrime(100, random); if (!p1.isProbablePrime(100)) { System.err.println("Consistency "+p1.toString(16)); failCount++; @@ -869,7 +872,7 @@ public class BigIntegerTest { // Numbers of the form (6k+1)(12k+1)(18k+1) are Carmichael numbers if // each of the factors is prime int found = 0; - BigInteger f1 = new BigInteger(40, 100, rndSeed.getRandom()); + BigInteger f1 = new BigInteger(40, 100, random); while (found < NUM_CARMICHAELS_TO_TEST) { BigInteger k = null; BigInteger f2, f3; @@ -896,8 +899,8 @@ public class BigIntegerTest { // Test some composites that are products of 2 primes for (int i=0; i<50; i++) { - p1 = BigInteger.probablePrime(100, rndSeed.getRandom()); - p2 = BigInteger.probablePrime(100, rndSeed.getRandom()); + p1 = BigInteger.probablePrime(100, random); + p2 = BigInteger.probablePrime(100, random); c1 = p1.multiply(p2); if (c1.isProbablePrime(100)) { System.err.println("Composite failed "+c1.toString(16)); @@ -906,8 +909,8 @@ public class BigIntegerTest { } for (int i=0; i<4; i++) { - p1 = BigInteger.probablePrime(600, rndSeed.getRandom()); - p2 = BigInteger.probablePrime(600, rndSeed.getRandom()); + p1 = BigInteger.probablePrime(600, random); + p2 = BigInteger.probablePrime(600, random); c1 = p1.multiply(p2); if (c1.isProbablePrime(100)) { System.err.println("Composite failed "+c1.toString(16)); @@ -962,7 +965,7 @@ public class BigIntegerTest { // Next, pick some large primes, use nextProbablePrime to find the // next one, and make sure there are no primes in between for (int i=0; i<100; i+=10) { - p1 = BigInteger.probablePrime(50 + i, rndSeed.getRandom()); + p1 = BigInteger.probablePrime(50 + i, random); p2 = p1.add(ONE); p3 = p1.nextProbablePrime(); while(p2.compareTo(p3) < 0) { @@ -1027,7 +1030,7 @@ public class BigIntegerTest { } for(int i=0; i<10; i++) { - BigInteger b1 = fetchNumber(rndSeed.getRandom().nextInt(100)); + BigInteger b1 = fetchNumber(random.nextInt(100)); BigInteger b2 = null; File f = new File("serialtest"); try (FileOutputStream fos = new FileOutputStream(f)) { @@ -1061,8 +1064,6 @@ public class BigIntegerTest { * */ public static void main(String[] args) throws Exception { - System.out.println("Random number generator seed = " + rndSeed.getSeed()); - // Some variables for sizing test numbers in bits int order1 = ORDER_MEDIUM; int order2 = ORDER_SMALL; @@ -1134,8 +1135,8 @@ public class BigIntegerTest { * If order is less than 2, order is changed to 2. */ private static BigInteger fetchNumber(int order) { - boolean negative = rndSeed.getRandom().nextBoolean(); - int numType = rndSeed.getRandom().nextInt(7); + boolean negative = random.nextBoolean(); + int numType = random.nextInt(7); BigInteger result = null; if (order < 2) order = 2; @@ -1159,14 +1160,14 @@ public class BigIntegerTest { break; case 3: // One bit in number - result = BigInteger.ONE.shiftLeft(rndSeed.getRandom().nextInt(order)); + result = BigInteger.ONE.shiftLeft(random.nextInt(order)); break; case 4: // Random bit density byte[] val = new byte[(order+7)/8]; - int iterations = rndSeed.getRandom().nextInt(order); + int iterations = random.nextInt(order); for (int i=0; i 0) { - int runLength = Math.min(remaining, rndSeed.getRandom().nextInt(order)); + int runLength = Math.min(remaining, random.nextInt(order)); result = result.shiftLeft(runLength); if (bit > 0) result = result.add(ONE.shiftLeft(runLength).subtract(ONE)); @@ -1186,7 +1187,7 @@ public class BigIntegerTest { break; default: // random bits - result = new BigInteger(order, rndSeed.getRandom()); + result = new BigInteger(order, random); } if (negative) diff --git a/jdk/test/java/math/BigInteger/ModPow65537.java b/jdk/test/java/math/BigInteger/ModPow65537.java index e7d2b17c6bf..7d9607acd3f 100644 --- a/jdk/test/java/math/BigInteger/ModPow65537.java +++ b/jdk/test/java/math/BigInteger/ModPow65537.java @@ -23,8 +23,10 @@ /* * @test - * @library .. - * @bug 4891312 8074460 + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main ModPow65537 + * @bug 4891312 8074460 8078672 * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed) * @author Andreas Sterbenz * @key randomness @@ -34,6 +36,7 @@ import java.math.BigInteger; import java.security.*; import java.security.spec.*; +import java.util.Random; public class ModPow65537 { @@ -79,9 +82,8 @@ public class ModPow65537 { private static void testSigning(KeyPair kp) throws Exception { System.out.println(kp.getPublic()); byte[] data = new byte[1024]; - RandomSeed rndSeed = new RandomSeed(false); - System.out.println("Random number generator seed = " + rndSeed.getSeed()); - rndSeed.getRandom().nextBytes(data); + Random random = RandomFactory.getRandom(); + random.nextBytes(data); Signature sig = Signature.getInstance("SHA1withRSA", "SunRsaSign"); sig.initSign(kp.getPrivate()); diff --git a/jdk/test/java/math/BigInteger/PrimeTest.java b/jdk/test/java/math/BigInteger/PrimeTest.java index 62adf777cdf..bb3d3494a0d 100644 --- a/jdk/test/java/math/BigInteger/PrimeTest.java +++ b/jdk/test/java/math/BigInteger/PrimeTest.java @@ -25,8 +25,10 @@ /* * @test - * @library .. - * @bug 8026236 8074460 + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main PrimeTest + * @bug 8026236 8074460 8078672 * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed) * @author bpb * @key randomness @@ -179,9 +181,8 @@ public class PrimeTest { } // Create a list of non-prime BigIntegers. - RandomSeed rndSeed = new RandomSeed(true); - System.out.println("Random number generator seed = " + rndSeed.getSeed()); - List nonPrimeBigInts = (rndSeed.getSplittableRandom()) + SplittableRandom splitRandom = RandomFactory.getSplittableRandom(); + List nonPrimeBigInts = (splitRandom) .ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf) .filter(b -> !b.isProbablePrime(certainty)).collect(toList()); diff --git a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java index 25e39e49636..6565ff23b67 100644 --- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java +++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 1025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -24,9 +24,10 @@ /* * @test * @ignore This test has huge memory requirements - * @library .. + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* * @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests - * @bug 6910473 8021204 8021203 9005933 8074460 + * @bug 6910473 8021204 8021203 9005933 8074460 8078672 * @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed) * @author Dmitry Nadezhin * @key randomness @@ -38,6 +39,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Arrays; import java.math.BigInteger; +import java.util.Random; public class SymmetricRangeTests { @@ -115,9 +117,8 @@ public class SymmetricRangeTests { System.out.println("Testing overflow in BitSieve.sieveSingle"); int bitLength = (5 << 27) - 1; try { - RandomSeed rndSeed = new RandomSeed(false); - System.out.println("Random number generator seed = " + rndSeed.getSeed()); - BigInteger actual = new BigInteger(bitLength, 0, rndSeed.getRandom()); + Random random = RandomFactory.getRandom(); + BigInteger actual = new BigInteger(bitLength, 0, random); throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength()); } catch (ArithmeticException e) { // expected diff --git a/jdk/test/java/math/RandomSeed.java b/jdk/test/java/math/RandomSeed.java deleted file mode 100644 index 494705c5fd6..00000000000 --- a/jdk/test/java/math/RandomSeed.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -import java.util.Random; -import java.util.SplittableRandom; - -public class RandomSeed { - private long seed = 0L; - private Random rnd = null; - private SplittableRandom srnd = null; - - public RandomSeed(boolean isSplittableRandom) { - init(isSplittableRandom); - } - - private void init(boolean isSplittableRandom) { - // obtain seed from environment if supplied - boolean isSeedProvided = false; - try { - // note that Long.valueOf(null) also throws a NumberFormatException - // so if the property is undefined this will still work correctly - seed = Long.valueOf(System.getProperty("seed")); - isSeedProvided = true; - } catch (NumberFormatException e) { - // do nothing: isSeedProvided is already false - } - - // if no seed from environment, create a fresh one - Random tmpRnd = null; - if (!isSeedProvided) { - tmpRnd = new Random(); - seed = tmpRnd.nextLong(); - } - - // create the PRNG - if (isSplittableRandom) { - srnd = new SplittableRandom(seed); - } else { - rnd = tmpRnd != null ? tmpRnd : new Random(); - rnd.setSeed(seed); - } - } - - public Random getRandom() { - if (rnd == null) { - throw new IllegalStateException("Variable of type Random not initialized"); - } - return rnd; - } - - public SplittableRandom getSplittableRandom() { - if (srnd == null) { - throw new IllegalStateException("Variable of type SplittableRandom not initialized"); - } - return srnd; - } - - public long getSeed() { - return seed; - } -} diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java b/jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java new file mode 100644 index 00000000000..eee84b15573 --- /dev/null +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/RandomFactory.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.util.Random; +import java.util.SplittableRandom; + +/** + * Factory class which generates and prints to STDOUT a long-valued seed + * for use in initializing a PRNG. An instance of {@code Random} or + * {@code SplittableRandom} may likewise be obtained. + */ +public class RandomFactory { + /** + * Attempt to obtain the seed from the value of the "seed" property. + * @return The seed or {@code null} if the "seed" property was not set or + * could not be parsed. + */ + private static Long getSystemSeed() { + Long seed = null; + try { + // note that Long.valueOf(null) also throws a + // NumberFormatException so if the property is undefined this + // will still work correctly + seed = Long.valueOf(System.getProperty("seed")); + } catch (NumberFormatException e) { + // do nothing: seed is still null + } + + return seed; + } + + /** + * Obtain a seed from an independent PRNG. + * + * @return A random seed. + */ + private static long getRandomSeed() { + return new Random().nextLong(); + } + + /** + * Obtain and print to STDOUT a seed appropriate for initializing a PRNG. + * If the system property "seed" is set and has value which may be correctly + * parsed it is used, otherwise a seed is generated using an independent + * PRNG. + * + * @return The seed. + */ + public static long getSeed() { + Long seed = getSystemSeed(); + if (seed == null) { + seed = getRandomSeed(); + } + System.out.println("Seed from RandomFactory = "+seed+"L"); + return seed; + } + + /** + * Obtain and print to STDOUT a seed and use it to initialize a new + * {@code Random} instance which is returned. If the system + * property "seed" is set and has value which may be correctly parsed it + * is used, otherwise a seed is generated using an independent PRNG. + * + * @return The {@code Random} instance. + */ + public static Random getRandom() { + return new Random(getSeed()); + } + + /** + * Obtain and print to STDOUT a seed and use it to initialize a new + * {@code SplittableRandom} instance which is returned. If the system + * property "seed" is set and has value which may be correctly parsed it + * is used, otherwise a seed is generated using an independent PRNG. + * + * @return The {@code SplittableRandom} instance. + */ + public static SplittableRandom getSplittableRandom() { + return new SplittableRandom(getSeed()); + } +} From bd17f06eadc1b78c4e69bbfb225c301a10924ba7 Mon Sep 17 00:00:00 2001 From: Andreas Lundblad Date: Thu, 30 Apr 2015 12:21:50 +0200 Subject: [PATCH 44/63] 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter Additional applicability checks added. Reviewed-by: jlahoda --- .../sun/tools/javac/code/TypeAnnotations.java | 8 ++-- .../com/sun/tools/javac/comp/Annotate.java | 40 +++++++++++------ .../com/sun/tools/javac/comp/Check.java | 2 +- .../tools/javac/resources/compiler.properties | 4 ++ .../InvalidClsTypeParamTarget.java | 21 +++++++++ .../InvalidClsTypeParamTarget.out | 2 + .../InvalidMethodTypeParamTarget.java | 20 +++++++++ .../InvalidMethodTypeParamTarget.out | 2 + .../InvalidMethodTypeUse.java | 24 +++++++++++ .../InvalidMethodTypeUse.out | 2 + .../InvalidRepAnnoOnCast.java | 20 +++++++++ .../InvalidRepAnnoOnCast.out | 2 + .../BrokenTypeAnnoContainer.java | 14 ++++++ .../BrokenTypeAnnoContainer.out | 2 + .../brokenTypeAnnoContainer/T.java | 28 ++++++++++++ .../brokenTypeAnnoContainer/TC.java | 30 +++++++++++++ .../brokenTypeAnnoContainer/TCBroken.java | 30 +++++++++++++ ...nvalidTypeContextRepeatableAnnotation.java | 43 +++++++++++++++++++ 18 files changed, 275 insertions(+), 19 deletions(-) create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.out create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.out create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.out create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.out create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.out create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/T.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TC.java create mode 100644 langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TCBroken.java create mode 100644 langtools/test/tools/javac/diags/examples/InvalidTypeContextRepeatableAnnotation.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index 1bc02106b2e..bfb03f8e45c 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -28,11 +28,11 @@ package com.sun.tools.javac.code; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.type.TypeKind; - import javax.tools.JavaFileObject; import com.sun.tools.javac.code.Attribute.Array; import com.sun.tools.javac.code.Attribute.TypeCompound; +import com.sun.tools.javac.code.Symbol.TypeSymbol; import com.sun.tools.javac.code.Type.ArrayType; import com.sun.tools.javac.code.Type.CapturedType; import com.sun.tools.javac.code.Type.ClassType; @@ -153,8 +153,8 @@ public class TypeAnnotations { public enum AnnotationType { DECLARATION, TYPE, NONE, BOTH } - public List annotationTargets(Attribute.Compound anno) { - Attribute.Compound atTarget = anno.type.tsym.getAnnotationTypeMetadata().getTarget(); + public List annotationTargets(TypeSymbol tsym) { + Attribute.Compound atTarget = tsym.getAnnotationTypeMetadata().getTarget(); if (atTarget == null) { return null; } @@ -177,7 +177,7 @@ public class TypeAnnotations { * a type annotation, or both. */ public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) { - List targets = annotationTargets(a); + List targets = annotationTargets(a.type.tsym); return (targets == null) ? AnnotationType.DECLARATION : targets.stream() diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java index 1e445f30de0..6075657d6b6 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java @@ -243,7 +243,10 @@ public class Annotate { log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s); Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null"); - annotateNow(s, annotations, localEnv, false); + + // false is passed as fifth parameter since annotateLater is + // never called for a type parameter + annotateNow(s, annotations, localEnv, false, false); } finally { if (prevLint != null) chk.setLint(prevLint); @@ -327,7 +330,8 @@ public class Annotate { * then continue on with repeating annotations processing. */ private void annotateNow(Symbol toAnnotate, - List withAnnotations, Env env, boolean typeAnnotations) + List withAnnotations, Env env, boolean typeAnnotations, + boolean isTypeParam) { Map> annotated = new LinkedHashMap<>(); Map pos = new HashMap<>(); @@ -377,7 +381,7 @@ public class Annotate { buf = buf.prepend(lb.first()); } else { AnnotationContext ctx = new AnnotationContext<>(env, annotated, pos, typeAnnotations); - T res = makeContainerAnnotation(lb.toList(), ctx, toAnnotate); + T res = makeContainerAnnotation(lb.toList(), ctx, toAnnotate, isTypeParam); if (res != null) buf = buf.prepend(res); } @@ -698,7 +702,7 @@ public class Annotate { * annotation are invalid. This method reports errors/warnings. */ private T processRepeatedAnnotations(List annotations, - AnnotationContext ctx, Symbol on) + AnnotationContext ctx, Symbol on, boolean isTypeParam) { T firstOccurrence = annotations.head; List repeated = List.nil(); @@ -752,7 +756,8 @@ public class Annotate { if (!repeated.isEmpty()) { repeated = repeated.reverse(); - TreeMaker m = make.at(ctx.pos.get(firstOccurrence)); + DiagnosticPosition pos = ctx.pos.get(firstOccurrence); + TreeMaker m = make.at(pos); Pair p = new Pair(containerValueSymbol, new Attribute.Array(arrayOfOrigAnnoType, repeated)); @@ -768,7 +773,14 @@ public class Annotate { Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p), ((Attribute.TypeCompound)annotations.head).position); - // TODO: annotation applicability checks from below? + JCAnnotation annoTree = m.TypeAnnotation(at); + if (!chk.validateAnnotationDeferErrors(annoTree)) + log.error(annoTree.pos(), Errors.DuplicateAnnotationInvalidRepeated(origAnnoType)); + + if (!chk.isTypeAnnotation(annoTree, isTypeParam)) { + log.error(pos, isTypeParam ? Errors.InvalidRepeatableAnnotationNotApplicable(targetContainerType, on) + : Errors.InvalidRepeatableAnnotationNotApplicableInContext(targetContainerType)); + } at.setSynthesized(true); @@ -925,11 +937,11 @@ public class Annotate { } private T makeContainerAnnotation(List toBeReplaced, - AnnotationContext ctx, Symbol sym) + AnnotationContext ctx, Symbol sym, boolean isTypeParam) { // Process repeated annotations T validRepeated = - processRepeatedAnnotations(toBeReplaced, ctx, sym); + processRepeatedAnnotations(toBeReplaced, ctx, sym, isTypeParam); if (validRepeated != null) { // Check that the container isn't manually @@ -955,7 +967,7 @@ public class Annotate { * Attribute the list of annotations and enter them onto s. */ public void enterTypeAnnotations(List annotations, Env env, - Symbol s, DiagnosticPosition deferPos) + Symbol s, DiagnosticPosition deferPos, boolean isTypeParam) { Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is nul/"); JavaFileObject prev = log.useSource(env.toplevel.sourcefile); @@ -965,7 +977,7 @@ public class Annotate { prevLintPos = deferredLintHandler.setPos(deferPos); } try { - annotateNow(s, annotations, env, true); + annotateNow(s, annotations, env, true, isTypeParam); } finally { if (prevLintPos != null) deferredLintHandler.setPos(prevLintPos); @@ -1048,21 +1060,21 @@ public class Annotate { @Override public void visitAnnotatedType(JCAnnotatedType tree) { - enterTypeAnnotations(tree.annotations, env, sym, deferPos); + enterTypeAnnotations(tree.annotations, env, sym, deferPos, false); scan(tree.underlyingType); } @Override public void visitTypeParameter(JCTypeParameter tree) { - enterTypeAnnotations(tree.annotations, env, sym, deferPos); + enterTypeAnnotations(tree.annotations, env, sym, deferPos, true); scan(tree.bounds); } @Override public void visitNewArray(JCNewArray tree) { - enterTypeAnnotations(tree.annotations, env, sym, deferPos); + enterTypeAnnotations(tree.annotations, env, sym, deferPos, false); for (List dimAnnos : tree.dimAnnotations) - enterTypeAnnotations(dimAnnos, env, sym, deferPos); + enterTypeAnnotations(dimAnnos, env, sym, deferPos, false); scan(tree.elemtype); scan(tree.elems); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index cd24d685bbc..de5f429d25b 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -2999,7 +2999,7 @@ public class Check { /** Is the annotation applicable to types? */ protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) { - List targets = typeAnnotations.annotationTargets(a.attribute); + List targets = typeAnnotations.annotationTargets(a.annotationType.type.tsym); return (targets == null) ? false : targets.stream() diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 023043b30d3..5151729a668 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -414,6 +414,10 @@ compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\ compiler.err.invalid.repeatable.annotation.not.applicable=\ container {0} is not applicable to element {1} +# 0: type +compiler.err.invalid.repeatable.annotation.not.applicable.in.context=\ + container {0} is not applicable in this type context + # 0: name compiler.err.duplicate.class=\ duplicate class: {0} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.java new file mode 100644 index 00000000000..f87e2261ca5 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.java @@ -0,0 +1,21 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8044196 + * @summary Ensure that containers with target FIELD can't be applied to type parameters. + * @compile/fail/ref=InvalidClsTypeParamTarget.out -XDrawDiagnostics InvalidClsTypeParamTarget.java + */ + +import java.lang.annotation.*; + +class InvalidClsTypeParamTarget { + + @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE, ElementType.FIELD}) + @Repeatable(TC.class) + @interface T { int value(); } + + @Target(ElementType.FIELD) + @interface TC { T[] value(); } + + class Test<@T(1) @T(2) N> { + } +} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.out b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.out new file mode 100644 index 00000000000..a453f7ca4d6 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.out @@ -0,0 +1,2 @@ +InvalidClsTypeParamTarget.java:19:16: compiler.err.invalid.repeatable.annotation.not.applicable: InvalidClsTypeParamTarget.TC, InvalidClsTypeParamTarget.Test +1 error diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.java new file mode 100644 index 00000000000..8149c7d79ac --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.java @@ -0,0 +1,20 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8044196 + * @summary Ensure that containers with target METHOD can't be applied to type parameters. + * @compile/fail/ref=InvalidMethodTypeParamTarget.out -XDrawDiagnostics InvalidMethodTypeParamTarget.java + */ + +import java.lang.annotation.*; + +class InvalidMethodTypeParamTarget { + + @Target({ElementType.TYPE_PARAMETER, ElementType.METHOD}) + @Repeatable(TC.class) + @interface T { int value(); } + + @Target(ElementType.METHOD) + @interface TC { T[] value(); } + + public <@T(1) @T(2) N> void method() { } +} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.out b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.out new file mode 100644 index 00000000000..e3435059dd9 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeParamTarget.out @@ -0,0 +1,2 @@ +InvalidMethodTypeParamTarget.java:19:13: compiler.err.invalid.repeatable.annotation.not.applicable: InvalidMethodTypeParamTarget.TC, method() +1 error diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.java new file mode 100644 index 00000000000..aa991ebf2c6 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.java @@ -0,0 +1,24 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8044196 + * @summary Make sure repeatable annotations can't be erroneously applied to type arguments. + * @compile/fail/ref=InvalidMethodTypeUse.out -XDrawDiagnostics InvalidMethodTypeUse.java + */ + +import java.lang.annotation.*; + +class InvalidMethodTypeUse { + + @Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.TYPE_PARAMETER}) + @Repeatable(TC.class) + @interface T { int value(); } + + @Target({ElementType.METHOD, ElementType.TYPE_PARAMETER}) + @interface TC { T[] value(); } + + void method() { + this.<@T(1) @T(2) String>method2(); + } + + <@T(3) S> void method2() { } +} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.out b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.out new file mode 100644 index 00000000000..923e0a1ad11 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidMethodTypeUse.out @@ -0,0 +1,2 @@ +InvalidMethodTypeUse.java:20:15: compiler.err.invalid.repeatable.annotation.not.applicable.in.context: InvalidMethodTypeUse.TC +1 error diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.java new file mode 100644 index 00000000000..8a300cc42a9 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.java @@ -0,0 +1,20 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8044196 + * @summary Make sure repeatable annotations can't be erroneously applied to a cast type + * @compile/fail/ref=InvalidRepAnnoOnCast.out -XDrawDiagnostics InvalidRepAnnoOnCast.java + */ + +import java.lang.annotation.*; + +class InvalidRepAnnoOnCast { + + @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) + @Repeatable(TC.class) + @interface T { int value(); } + + @Target(ElementType.TYPE_PARAMETER) + @interface TC { T[] value(); } + + String s = (@T(1) @T(2) String) new Object(); +} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.out b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.out new file mode 100644 index 00000000000..612fd39fab6 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidRepAnnoOnCast.out @@ -0,0 +1,2 @@ +InvalidRepAnnoOnCast.java:19:17: compiler.err.invalid.repeatable.annotation.not.applicable.in.context: InvalidRepAnnoOnCast.TC +1 error diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.java new file mode 100644 index 00000000000..0b60c04252f --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.java @@ -0,0 +1,14 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8044196 + * @summary Ensure that a broken type annotation container generates a correct error message. + * @compile T.java TC.java + * @compile TCBroken.java + * @compile/fail/ref=BrokenTypeAnnoContainer.out -XDrawDiagnostics BrokenTypeAnnoContainer.java + */ + +class BrokenTypeAnnoContainer { + void method() { + int ll2 = (@T(1) @T(2) int) 0; + } +} diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.out b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.out new file mode 100644 index 00000000000..9068e6a0b67 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/BrokenTypeAnnoContainer.out @@ -0,0 +1,2 @@ +BrokenTypeAnnoContainer.java:12:20: compiler.err.duplicate.annotation.invalid.repeated: T +1 error diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/T.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/T.java new file mode 100644 index 00000000000..3c91b91d52e --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/T.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@Repeatable(TC.class) +@interface T { int value(); } diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TC.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TC.java new file mode 100644 index 00000000000..80904eb2104 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TC.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface TC { + T[] value(); +} + diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TCBroken.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TCBroken.java new file mode 100644 index 00000000000..28b817cfb21 --- /dev/null +++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/brokenTypeAnnoContainer/TCBroken.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015, 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. + */ + +import java.lang.annotation.*; + +@Target(ElementType.TYPE_USE) +@interface TC { + T[] value(); + int foo(); +} diff --git a/langtools/test/tools/javac/diags/examples/InvalidTypeContextRepeatableAnnotation.java b/langtools/test/tools/javac/diags/examples/InvalidTypeContextRepeatableAnnotation.java new file mode 100644 index 00000000000..9b8ae54b23d --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/InvalidTypeContextRepeatableAnnotation.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2015, 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. + */ + +// key: compiler.err.invalid.repeatable.annotation.not.applicable.in.context + + +import java.lang.annotation.*; + +@Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.TYPE_PARAMETER}) +@Repeatable(TC.class) +@interface T { int value(); } + +@Target({ElementType.METHOD, ElementType.TYPE_PARAMETER}) +@interface TC { T[] value(); } + +public class InvalidTypeContextRepeatableAnnotation { + void method() { + this.<@T(1) @T(2) String>method2(); + } + + <@T(3) S> void method2() { + } +} From e792edab0c276bc64c2bc527eb7dd866577c7e4c Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:01 -0700 Subject: [PATCH 45/63] Added tag jdk9-b62 for changeset 4440a52322d5 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index b5bc828524d..ecdc65b6c89 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -304,3 +304,4 @@ f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57 39e8a131289e8386aa4c3e4b184faa812a7c0421 jdk9-b59 9fa2185bee17462d1014538bff60af6e6f0b01e7 jdk9-b60 ea38728b4f4bdd8fd0d7a89b18069f521cf05013 jdk9-b61 +105d045a69174d870b69bfe471b3f2d05a9f8ecc jdk9-b62 From 7064ad9b784dcfdcc49a8437d785670f0cee4c8f Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:02 -0700 Subject: [PATCH 46/63] Added tag jdk9-b62 for changeset 27f6a088fa6a --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 210694a9022..b1d9426e786 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -304,3 +304,4 @@ d8ebf1a5b18ccbc849f5bf0f80aa3d78583eee68 jdk9-b57 cda6ae062f85fac5555f4e1318885b0ecd998bd1 jdk9-b59 caa330b275f39282793466529f6864766b31d9fd jdk9-b60 d690f489ca0bb95a6157d996da2fa72bcbcf02ea jdk9-b61 +d27f7e0a7aca129969de23e9934408a31b4abf4c jdk9-b62 From 33e151add28f3ed0250e9228f8b4f249e2a6096c Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:03 -0700 Subject: [PATCH 47/63] Added tag jdk9-b62 for changeset d9c8742b7f8a --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 07541de82ca..bf3b531730c 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -464,3 +464,4 @@ ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58 96bcaec07cb165782bae1b9a1f28450b37a10e3a jdk9-b59 9c916db4bf3bc164a47b5a9cefe5ffd71e111f6a jdk9-b60 715d2da5801c410746e92f08066d53bde1496286 jdk9-b61 +1eab877142cce6ca06e556e2ad0af688f993f00b jdk9-b62 From 98e86b9fc4bfa5d722e5a07fbfac2dec0d368152 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:05 -0700 Subject: [PATCH 48/63] Added tag jdk9-b62 for changeset db70d6ebfa97 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 08a2cfbe08b..d1bd7fd7519 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -304,3 +304,4 @@ d5b5a010a16688f188f5a9247ed873f5100b530c jdk9-b53 a1a9d943446911a4a0f74f0d082c32094af944ae jdk9-b59 c12db18748dacfccd6581ead29228c2cb6e51b34 jdk9-b60 f4a4a54620370f077c2e830a5561c8cfa811712b jdk9-b61 +3bcf83c1bbc1b7663e930d72c133a9bd86c7618d jdk9-b62 From 035753322ee06669341e620056746b0fcdb7c689 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:05 -0700 Subject: [PATCH 49/63] Added tag jdk9-b62 for changeset 2c8ff5cb2faa --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 6233b33cd39..fe7dbe8df69 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -307,3 +307,4 @@ b4f913b48e699980bd11fe19cce134d0adb4c31c jdk9-b56 8a9ebae410bc388668fc203e559b5407bde757eb jdk9-b59 f31835b59035377a220efc5a248b90f090ee1689 jdk9-b60 77f44848c44c003205490bf5ab88035233b65418 jdk9-b61 +cd0cf72b2cbf4adb778a02505fb065bb2292688c jdk9-b62 From f2b1241b663c1e32b0ee9ffeae664f11d954512f Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:06 -0700 Subject: [PATCH 50/63] Added tag jdk9-b62 for changeset d7b621c7a8d5 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 7a547227410..07c91542bbc 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -304,3 +304,4 @@ c76339e86ea7da5d9ac7856f3fae9ef73eef04a2 jdk9-b57 48ee960f29df93a9b2a895621321358a86909086 jdk9-b59 84c5527f742bc64562e47d3149c16197fe1c4c1a jdk9-b60 da84dcac1b0b12c5b836b05ac75ecbfadee0cd32 jdk9-b61 +49118e68fbd4cc0044e718c47db681946d5efd69 jdk9-b62 From 2c9b2f1c5aafe879591c3419fd1be4636c28c232 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:09 -0700 Subject: [PATCH 51/63] Added tag jdk9-b62 for changeset e36081ad2470 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 562ec0f2fae..ad8c0236c61 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -304,3 +304,4 @@ ec977a00cecbf0007b0fa26c7af2852d57a79cad jdk9-b57 a598534d277e170a0bbf177bd54d9d179245532b jdk9-b59 81bdc4545337c404bb87373838c983584a49afd6 jdk9-b60 0eb91327db5a840779cc5c35b9b858d6ef7959d1 jdk9-b61 +40058141a4ec04a3d4cacdb693ad188a5ddf48ed jdk9-b62 From 5697364521957e22b2e5b9886f36c72e135c3ca8 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 30 Apr 2015 13:02:10 -0700 Subject: [PATCH 52/63] Added tag jdk9-b62 for changeset 2ae39df23f8e --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 8fae27fd134..22199546e67 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -295,3 +295,4 @@ b2b332e64b7b2e06e25bccae9c0c0b585a03b4b5 jdk9-b55 ea4e794c3927df4e03f53202e15a3248375b7902 jdk9-b59 c55ce3738888b6c7596780b7b2ad1aa0f9ebccd7 jdk9-b60 89937bee80bd28826de8cf60aa63a21edab63f79 jdk9-b61 +1b5604bc81a6161b1c3c9dd654cd1399474ae9ee jdk9-b62 From 7dfccc294ed6cb860b6bd727d80f52fba3de3ea0 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 30 Apr 2015 16:51:53 -0700 Subject: [PATCH 53/63] 8079107: Update TestKeyPairGenerator.java to use random number generator library Reviewed-by: mullan --- jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java index b5aa442cce7..dbabc0c3dfa 100644 --- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java +++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java @@ -24,9 +24,11 @@ /** * @test * @bug 4856966 - * @summary Verify that the RSA KeyPairGenerator works + * @summary Verify that the RSA KeyPairGenerator works (use -Dseed=X to set PRNG seed) * @author Andreas Sterbenz * @library .. + * @library /lib/testlibrary + * @build jdk.testlibrary.* * @run main/othervm TestKeyPairGenerator * @key intermittent randomness */ @@ -106,7 +108,7 @@ public class TestKeyPairGenerator extends PKCS11Test { int[] keyLengths = {512, 512, 1024}; BigInteger[] pubExps = {null, BigInteger.valueOf(3), null}; KeyPair[] keyPairs = new KeyPair[3]; - new Random().nextBytes(data); + RandomFactory.getRandom().nextBytes(data); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", provider); for (int i = 0; i < keyLengths.length; i++) { int len = keyLengths[i]; From 6bed31f1c5ee733a87a3e6795a313eb145733174 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 30 Apr 2015 17:35:03 -0700 Subject: [PATCH 54/63] 8079191: remove remaining references to "cp -p" from langtools/test Reviewed-by: vromero --- langtools/test/tools/javac/Paths/Diagnostics.sh | 4 ++-- langtools/test/tools/javac/Paths/MineField.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/langtools/test/tools/javac/Paths/Diagnostics.sh b/langtools/test/tools/javac/Paths/Diagnostics.sh index 572d6f01212..954cd8a0e9b 100644 --- a/langtools/test/tools/javac/Paths/Diagnostics.sh +++ b/langtools/test/tools/javac/Paths/Diagnostics.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2015, 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 @@ -186,7 +186,7 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint -Xbootclasspath/p:classesRefRef.jar # Class-Path attribute followed in extdirs or endorseddirs #---------------------------------------------------------------- Sys mkdir jars -Sys cp -p classesRefRef.jar jars/. +Sys cp classesRefRef.jar jars/. Warning "$javac" ${TESTTOOLVMOPTS} -Xlint -extdirs jars Main.java Warning "$javac" ${TESTTOOLVMOPTS} -Xlint -endorseddirs jars Main.java diff --git a/langtools/test/tools/javac/Paths/MineField.sh b/langtools/test/tools/javac/Paths/MineField.sh index 10fb3210dd6..f9843c44998 100644 --- a/langtools/test/tools/javac/Paths/MineField.sh +++ b/langtools/test/tools/javac/Paths/MineField.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2015, 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 @@ -323,7 +323,7 @@ In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -cp ".." ../Main.java In GooClass Failure "$java" ${TESTVMOPTS} -cp ".." Main # Unspecified classpath defaults to "." -Sys mkdir OneDir; Sys cp -p Main.java GooClass/Lib.class OneDir/. +Sys mkdir OneDir; Sys cp Main.java GooClass/Lib.class OneDir/. In OneDir Success "$javac" ${TESTTOOLVMOPTS} Main.java In OneDir Success "$java" ${TESTVMOPTS} Main From f7fcffccd1e73ad655c84e69ccbb1e1f7383092b Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 20:30:12 +0200 Subject: [PATCH 55/63] Added tag jdk9-b62 for changeset e7dbbef69d12 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 56f428ed291..8f99216cf55 100644 --- a/.hgtags +++ b/.hgtags @@ -304,3 +304,4 @@ f40752db7773ca0c737f2ad88371e35c57fdfed7 jdk9-b58 da950f343762a856d69751570a4c07cfa68a415b jdk9-b59 38f98cb6b33562a926ec3b79c7b34128be37647d jdk9-b60 ac3f5a39d4ff14d70c365e12cf5ec8f2abd52a04 jdk9-b61 +e7dbbef69d12b6a74dfad331b7188e7f893e8d29 jdk9-b62 From c565cf62f82a264ef935fa179929948af09090b2 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Sat, 2 May 2015 22:51:45 +0300 Subject: [PATCH 56/63] 8077685: (tz) Support tzdata2015d Reviewed-by: okutsu --- jdk/make/data/tzdata/VERSION | 2 +- jdk/make/data/tzdata/africa | 67 +++---- jdk/make/data/tzdata/antarctica | 51 +----- jdk/make/data/tzdata/backward | 1 + jdk/make/data/tzdata/europe | 2 +- jdk/make/data/tzdata/northamerica | 167 +++++++++++++----- jdk/make/data/tzdata/southamerica | 156 +++++++++------- .../sun/util/resources/TimeZoneNames.java | 9 +- .../util/resources/de/TimeZoneNames_de.java | 9 +- .../util/resources/es/TimeZoneNames_es.java | 9 +- .../util/resources/fr/TimeZoneNames_fr.java | 9 +- .../util/resources/it/TimeZoneNames_it.java | 9 +- .../util/resources/ja/TimeZoneNames_ja.java | 9 +- .../util/resources/ko/TimeZoneNames_ko.java | 9 +- .../resources/pt/TimeZoneNames_pt_BR.java | 9 +- .../util/resources/sv/TimeZoneNames_sv.java | 9 +- .../resources/zh/TimeZoneNames_zh_CN.java | 9 +- .../resources/zh/TimeZoneNames_zh_TW.java | 9 +- jdk/test/sun/util/calendar/zi/tzdata/VERSION | 2 +- jdk/test/sun/util/calendar/zi/tzdata/africa | 67 +++---- .../sun/util/calendar/zi/tzdata/antarctica | 51 +----- jdk/test/sun/util/calendar/zi/tzdata/backward | 1 + jdk/test/sun/util/calendar/zi/tzdata/europe | 2 +- .../sun/util/calendar/zi/tzdata/northamerica | 167 +++++++++++++----- .../sun/util/calendar/zi/tzdata/southamerica | 156 +++++++++------- 25 files changed, 505 insertions(+), 486 deletions(-) diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION index ebd4db73b0e..19d5533385c 100644 --- a/jdk/make/data/tzdata/VERSION +++ b/jdk/make/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2015b +tzdata2015d diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa index 43103225577..6099a70f5e6 100644 --- a/jdk/make/data/tzdata/africa +++ b/jdk/make/data/tzdata/africa @@ -342,35 +342,29 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # above) says DST had no affect on electricity consumption. There is # no information about when DST will end this fall. See: # http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 + +# From Steffen Thorsen (2015-04-08): +# Egypt will start DST on midnight after Thursday, April 30, 2015. +# This is based on a law (no 35) from May 15, 2014 saying it starts the last +# Thursday of April.... Clocks will still be turned back for Ramadan, but +# dates not yet announced.... +# http://almogaz.com/news/weird-news/2015/04/05/1947105 ... +# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html + +# From Ahmed Nazmy (2015-04-20): +# Egypt's ministers cabinet just announced ... that it will cancel DST at +# least for 2015. # -# For now, guess that later spring and fall transitions will use -# 2010's rules, and guess that Egypt will switch to standard time at -# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the -# first Friday after Ramadan. To implement this, -# transition dates for 2015 through 2037 were determined by running -# the following program under GNU Emacs 24.3, with the results integrated -# by hand into the table below. Ramadan again intrudes on the guessed -# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. -# (let ((islamic-year 1436)) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (friday 5)) -# (while (/= friday (mod a 7)) -# (setq a (1- a))) -# (while (/= friday (mod b 7)) -# (setq b (1+ b))) -# (setq a (1- a)) -# (setq b (1- b)) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n" -# "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Tim Parenti (2015-04-20): +# http://english.ahram.org.eg/WriterArticles/NewsContentP/1/128195/Egypt/No-daylight-saving-this-summer-Egypts-prime-minist.aspx +# "Egypt's cabinet agreed on Monday not to switch clocks for daylight saving +# time this summer, and carry out studies on the possibility of canceling the +# practice altogether in future years." +# +# From Paul Eggert (2015-04-20): +# For now, assume DST will be canceled. Any resumption would likely +# use different rules anyway. + Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - Rule Egypt 2010 only - Aug 10 24:00 0 - @@ -379,22 +373,7 @@ Rule Egypt 2010 only - Sep lastThu 24:00 0 - Rule Egypt 2014 only - May 15 24:00 1:00 S Rule Egypt 2014 only - Jun 26 24:00 0 - Rule Egypt 2014 only - Jul 31 24:00 1:00 S -Rule Egypt 2014 max - Sep lastThu 24:00 0 - -Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S -Rule Egypt 2015 only - Jun 11 24:00 0 - -Rule Egypt 2015 only - Jul 23 24:00 1:00 S -Rule Egypt 2016 only - Jun 2 24:00 0 - -Rule Egypt 2016 only - Jul 7 24:00 1:00 S -Rule Egypt 2017 only - May 25 24:00 0 - -Rule Egypt 2017 only - Jun 29 24:00 1:00 S -Rule Egypt 2018 only - May 10 24:00 0 - -Rule Egypt 2018 only - Jun 14 24:00 1:00 S -Rule Egypt 2019 only - May 2 24:00 0 - -Rule Egypt 2019 only - Jun 6 24:00 1:00 S -Rule Egypt 2020 only - May 28 24:00 1:00 S -Rule Egypt 2021 only - May 13 24:00 1:00 S -Rule Egypt 2022 only - May 5 24:00 1:00 S -Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S +Rule Egypt 2014 only - Sep lastThu 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct diff --git a/jdk/make/data/tzdata/antarctica b/jdk/make/data/tzdata/antarctica index 1f3e4347b21..102b496341d 100644 --- a/jdk/make/data/tzdata/antarctica +++ b/jdk/make/data/tzdata/antarctica @@ -38,41 +38,6 @@ # I made up all time zone abbreviations mentioned here; corrections welcome! # FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited. -# These rules are stolen from the 'southamerica' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ArgAQ 1964 1966 - Mar 1 0:00 0 - -Rule ArgAQ 1964 1966 - Oct 15 0:00 1:00 S -Rule ArgAQ 1967 only - Apr 2 0:00 0 - -Rule ArgAQ 1967 1968 - Oct Sun>=1 0:00 1:00 S -Rule ArgAQ 1968 1969 - Apr Sun>=1 0:00 0 - -Rule ArgAQ 1974 only - Jan 23 0:00 1:00 S -Rule ArgAQ 1974 only - May 1 0:00 0 - -Rule ChileAQ 1972 1986 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1974 1987 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1987 only - Apr 12 3:00u 0 - -Rule ChileAQ 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule ChileAQ 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1990 only - Mar 18 3:00u 0 - -Rule ChileAQ 1990 only - Sep 16 4:00u 1:00 S -Rule ChileAQ 1991 1996 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1991 1997 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1997 only - Mar 30 3:00u 0 - -Rule ChileAQ 1998 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1998 only - Sep 27 4:00u 1:00 S -Rule ChileAQ 1999 only - Apr 4 3:00u 0 - -Rule ChileAQ 1999 2010 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 2000 2007 - Mar Sun>=9 3:00u 0 - -# N.B.: the end of March 29 in Chile is March 30 in Universal time, -# which is used below in specifying the transition. -Rule ChileAQ 2008 only - Mar 30 3:00u 0 - -Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 - -Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 - -Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S -Rule ChileAQ 2012 2015 - Apr Sun>=23 3:00u 0 - -Rule ChileAQ 2012 2014 - Sep Sun>=2 4:00u 1:00 S - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01 @@ -367,21 +332,7 @@ Zone Antarctica/Rothera 0 - zzz 1976 Dec 1 # USA - year-round bases # # Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) -# -# From Ethan Dicks (1996-10-06): -# It keeps the same time as Punta Arenas, Chile, because, just like us -# and the South Pole, that's the other end of their supply line.... -# I verified with someone who was there that since 1980, -# Palmer has followed Chile. Prior to that, before the Falklands War, -# Palmer used to be supplied from Argentina. -# -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Palmer 0 - zzz 1965 - -4:00 ArgAQ AR%sT 1969 Oct 5 - -3:00 ArgAQ AR%sT 1982 May - -4:00 ChileAQ CL%sT 2015 Apr 26 3:00u - -3:00 - CLT -# +# See 'southamerica' for Antarctica/Palmer, since it uses South American DST. # # McMurdo Station, Ross Island, since 1955-12 # Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20 diff --git a/jdk/make/data/tzdata/backward b/jdk/make/data/tzdata/backward index 95266a6f16c..3c845cfc01c 100644 --- a/jdk/make/data/tzdata/backward +++ b/jdk/make/data/tzdata/backward @@ -43,6 +43,7 @@ Link America/Argentina/Jujuy America/Jujuy Link America/Indiana/Knox America/Knox_IN Link America/Kentucky/Louisville America/Louisville Link America/Argentina/Mendoza America/Mendoza +Link America/Toronto America/Montreal Link America/Rio_Branco America/Porto_Acre Link America/Argentina/Cordoba America/Rosario Link America/Denver America/Shiprock diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe index 008268ac763..7cee9a81527 100644 --- a/jdk/make/data/tzdata/europe +++ b/jdk/make/data/tzdata/europe @@ -99,7 +99,7 @@ # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe # 3:00 FET Further-eastern Europe (2011-2014)* -# 3:00 MSK MSD MSM* Moscow +# 3:00 MSK MSD MSM* Minsk, Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica index 442a50eef0f..810cd93ade6 100644 --- a/jdk/make/data/tzdata/northamerica +++ b/jdk/make/data/tzdata/northamerica @@ -250,9 +250,14 @@ Zone PST8PDT -8:00 US P%sT # The law doesn't give abbreviations. # # From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: -# Public law 106-564 (2000-12-23) introduced the abbreviation -# "Chamorro Standard Time" for time in Guam and the Northern Marianas. -# See the file "australasia". +# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" +# for time in Guam and the Northern Marianas. See the file "australasia". +# +# From Paul Eggert (2015-04-17): +# HST and HDT are standardized abbreviations for Hawaii-Aleutian +# standard and daylight times. See section 9.47 (p 234) of the +# U.S. Government Printing Office Style Manual (2008) +# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf # From Arthur David Olson, 2005-08-09 # The following was signed into law on 2005-08-08. @@ -559,7 +564,7 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18 -11:00 - BST 1969 -11:00 US B%sT 1983 Oct 30 2:00 -10:00 US AH%sT 1983 Nov 30 - -10:00 US HA%sT + -10:00 US H%sT # The following switches don't quite make our 1970 cutoff. # # Shanks writes that part of southwest Alaska (e.g. Aniak) @@ -1354,14 +1359,9 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # Quebec -# From Paul Eggert (2013-08-30): -# Since 1970 most of Quebec has been like Toronto. -# However, because earlier versions of the tz database mistakenly relied on data -# from Shanks & Pottenger saying that Quebec differed from Ontario after 1970, -# a separate entry was created for most of Quebec. We're loath to lose -# its pre-1970 info, even though the tz database is normally limited to -# zones that differ after 1970, so keep this otherwise out-of-scope entry. - +# From Paul Eggert (2015-03-24): +# See America/Toronto for most of Quebec, including Montreal. +# # Matthews and Vincent (1998) also write that Quebec east of the -63 # meridian is supposed to observe AST, but residents as far east as # Natashquan use EST/EDT, and residents east of Natashquan use AST. @@ -1375,39 +1375,10 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mont 1917 only - Mar 25 2:00 1:00 D -Rule Mont 1917 only - Apr 24 0:00 0 S -Rule Mont 1919 only - Mar 31 2:30 1:00 D -Rule Mont 1919 only - Oct 25 2:30 0 S -Rule Mont 1920 only - May 2 2:30 1:00 D -Rule Mont 1920 1922 - Oct Sun>=1 2:30 0 S -Rule Mont 1921 only - May 1 2:00 1:00 D -Rule Mont 1922 only - Apr 30 2:00 1:00 D -Rule Mont 1924 only - May 17 2:00 1:00 D -Rule Mont 1924 1926 - Sep lastSun 2:30 0 S -Rule Mont 1925 1926 - May Sun>=1 2:00 1:00 D -Rule Mont 1927 1937 - Apr lastSat 24:00 1:00 D -Rule Mont 1927 1937 - Sep lastSat 24:00 0 S -Rule Mont 1938 1940 - Apr lastSun 0:00 1:00 D -Rule Mont 1938 1939 - Sep lastSun 0:00 0 S -Rule Mont 1946 1973 - Apr lastSun 2:00 1:00 D -Rule Mont 1945 1948 - Sep lastSun 2:00 0 S -Rule Mont 1949 1950 - Oct lastSun 2:00 0 S -Rule Mont 1951 1956 - Sep lastSun 2:00 0 S -Rule Mont 1957 1973 - Oct lastSun 2:00 0 S - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Blanc-Sablon -3:48:28 - LMT 1884 -4:00 Canada A%sT 1970 -4:00 - AST -Zone America/Montreal -4:54:16 - LMT 1884 - -5:00 Mont E%sT 1918 - -5:00 Canada E%sT 1919 - -5:00 Mont E%sT 1942 Feb 9 2:00s - -5:00 Canada E%sT 1946 - -5:00 Mont E%sT 1974 - -5:00 Canada E%sT # Ontario @@ -1898,17 +1869,115 @@ Zone America/Creston -7:46:04 - LMT 1884 # Dawson switched to PST in 1973. Inuvik switched to MST in 1979. # Mathew Englander (1996-10-07) gives the following refs: # * 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68, -# c. 7 defines Yukon standard time as UTC-9. This is still valid; +# c. 7 defines Yukon standard time as UTC-9.... # see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1). +# [http://canlii.ca/t/7vhg] # * C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00. # * O.I.C. 1980/02 established DST. # * O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00. -# Shanks & Pottenger say Yukon's 1973-10-28 switch was at 2:00; go -# with Englander. -# From Chris Walton (2006-06-26): -# Here is a link to the old daylight saving portion of the interpretation -# act which was last updated in 1987: -# http://www.gov.yk.ca/legislation/regs/oic1987_056.pdf + +# From Brian Inglis (2015-04-14): +# +# I tried to trace the history of Yukon time and found the following +# regulations, giving the reference title and URL if found, regulation name, +# and relevant quote if available. Each regulation specifically revokes its +# predecessor. The final reference is to the current Interpretation Act +# authorizing and resulting from these regulatory changes. +# +# Only recent regulations were retrievable via Yukon government site search or +# index, and only some via Canadian legal sources. Other sources used include +# articles titled "Standard Time and Time Zones in Canada" from JRASC via ADS +# Abstracts, cited by ADO for 1932 ..., and updated versions from 1958 and +# 1970 quoted below; each article includes current extracts from provincial +# and territorial ST and DST regulations at the end, summaries and details of +# standard times and daylight saving time at many locations across Canada, +# with time zone maps, tables and calculations for Canadian Sunrise, Sunset, +# and LMST; they also cover many countries and global locations, with a chart +# and table showing current Universal Time offsets, and may be useful as +# another source of information for 1970 and earlier. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; JRASC, Vol. 26, +# pp.49-77; February 1932; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1932JRASC..26...49S from p.75: +# Yukon Interpretation Ordinance +# Yukon standard time is the local mean time at the one hundred and +# thirty-fifth meridian. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; Thomson, Malcolm M.; +# JRASC, Vol. 52, pp.193-223; October 1958; SAO/NASA Astrophysics Data System +# (ADS) http://adsabs.harvard.edu/abs/1958JRASC..52..193S from pp.220-1: +# Yukon Interpretation Ordinance, 1955, Chap. 16. +# +# (1) Subject to this section, standard time shall be reckoned as nine +# hours behind Greenwich Time and called Yukon Standard Time. +# +# (2) Notwithstanding subsection (1), the Commissioner may make regulations +# varying the manner of reckoning standard time. +# +# * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance +# http://? - no online source found +# +# * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC, +# Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1970JRASC..64..129T from p.156: Yukon +# Territory Commissioner's Order 1967-59 Interpretation Ordinance ... +# +# 1. Commissioner's Order 1966-20 dated at Whitehorse in the Yukon +# Territory on 27th January, 1966, is hereby revoked. +# +# 2. Yukon (East) Standard Time as defined by section 36 of the +# Interpretation Ordinance from and after mid-night on the 28th day of May, +# 1967 shall be reckoned in the same manner as Pacific Standard Time, that +# is to say, eight hours behind Greenwich Time in the area of the Yukon +# Territory lying east of the 138th degree longitude west. +# +# 3. In the remainder of the Territory, lying west of the 138th degree +# longitude west, Yukon (West) Standard Time shall be reckoned as nine +# hours behind Greenwich Time. +# +# * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214 +# http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html +# C.O. 1973/214 INTERPRETATION ACT ... +# +# 1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby +# revoked. +# +# 2. Yukon Standard Time as defined by section 36 of the Interpretation +# Act from and after midnight on the twenty-eighth day of October, 1973 +# shall be reckoned in the same manner as Pacific Standard Time, that is +# to say eight hours behind Greenwich Time. +# +# * O.I.C. 1980/02 INTERPRETATION ACT +# http://? - no online source found +# +# * Yukon Daylight Saving Time, YOIC 1987/56 +# http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html +# O.I.C. 1987/056 INTERPRETATION ACT ... +# +# In every year between +# (a) two o'clock in the morning in the first Sunday in April, and +# (b) two o'clock in the morning in the last Sunday in October, +# Standard Time shall be reckoned as seven hours behind Greenwich Time and +# called Yukon Daylight Saving Time. +# ... +# Dated ... 9th day of March, A.D., 1987. +# +# * Yukon Daylight Saving Time 2006, YOIC 2006/127 +# http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html +# O.I.C. 2006/127 INTERPRETATION ACT ... +# +# 1. In Yukon each year the time for general purposes shall be 7 hours +# behind Greenwich mean time during the period commencing at two o'clock +# in the forenoon on the second Sunday of March and ending at two o'clock +# in the forenoon on the first Sunday of November and shall be called +# Yukon Daylight Saving Time. +# +# 2. Order-in-Council 1987/56 is revoked. +# +# 3. This order comes into force January 1, 2007. +# +# * Interpretation Act, RSY 2002, c 125 +# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html # From Rives McDow (1999-09-04): # Nunavut ... moved ... to incorporate the whole territory into one time zone. @@ -2134,7 +2203,7 @@ Zone America/Inuvik 0 - zzz 1953 # Inuvik founded -7:00 NT_YK M%sT 1980 -7:00 Canada M%sT Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20 - -9:00 NT_YK Y%sT 1966 Jul 1 2:00 + -9:00 NT_YK Y%sT 1967 May 28 0:00 -8:00 NT_YK P%sT 1980 -8:00 Canada P%sT Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 diff --git a/jdk/make/data/tzdata/southamerica b/jdk/make/data/tzdata/southamerica index 238ae3dc569..375c2d2fa9d 100644 --- a/jdk/make/data/tzdata/southamerica +++ b/jdk/make/data/tzdata/southamerica @@ -1121,6 +1121,60 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Chile +# From Paul Eggert (2015-04-03): +# Shanks & Pottenger says America/Santiago introduced standard time in +# 1890 and rounds its UTC offset to 70W40; guess that in practice this +# was the same offset as in 1916-1919. It also says Pacific/Easter +# standardized on 109W22 in 1890; assume this didn't change the clocks. +# +# Dates for America/Santiago from 1910 to 2004 are primarily from +# the following source, cited by Oscar van Vlijmen (2006-10-08): +# [1] Chile Law +# http://www.webexhibits.org/daylightsaving/chile.html +# This contains a copy of a this official table: +# Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30) +# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm +# [1] needs several corrections, though. +# +# The first set of corrections is from: +# [2] History of the Official Time of Chile +# http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06). See: +# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html +# This is an English translation of: +# Historia de la hora oficial de Chile (retrieved 2012-10-24). See: +# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm +# A fancier Spanish version (requiring mouse-clicking) is at: +# http://www.horaoficial.cl/historia_hora.html +# Conflicts between [1] and [2] were resolved as follows: +# +# - [1] says the 1910 transition was Jan 1, [2] says Jan 10 and cites +# Boletín Nº 1, Aviso Nº 1 (1910). Go with [2]. +# +# - [1] says SMT was -4:42:45, [2] says Chile's official time from +# 1916 to 1919 was -4:42:46.3, the meridian of Chile's National +# Astronomical Observatory (OAN), then located in what is now +# Quinta Normal in Santiago. Go with [2], rounding it to -4:42:46. +# +# - [1] says the 1918 transition was Sep 1, [2] says Sep 10 and cites +# Boletín Nº 22, Aviso Nº 129/1918 (1918-08-23). Go with [2]. +# +# - [1] does not give times for transitions; assume they occur +# at midnight mainland time, the current common practice. However, +# go with [2]'s specification of 23:00 for the 1947-05-21 transition. +# +# Another correction to [1] is from Jesper Nørgaard Welen, who +# wrote (2006-10-08), "I think that there are some obvious mistakes in +# the suggested link from Oscar van Vlijmen,... for instance entry 66 +# says that GMT-4 ended 1990-09-12 while entry 67 only begins GMT-3 at +# 1990-09-15 (they should have been 1990-09-15 and 1990-09-16 +# respectively), but anyhow it clears up some doubts too." +# +# Data for Pacific/Easter from 1910 through 1967 come from Shanks & +# Pottenger. After that, for lack of better info assume +# Pacific/Easter is always two hours behind America/Santiago; +# this is known to work for DST transitions starting in 2008 and +# may well be true for earlier transitions. + # From Eduardo Krell (1995-10-19): # The law says to switch to DST at midnight [24:00] on the second SATURDAY # of October.... The law is the same for March and October. @@ -1133,78 +1187,35 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Because of the same drought, the government decided to end DST later, # on April 3, (one-time change). -# From Oscar van Vlijmen (2006-10-08): -# http://www.horaoficial.cl/cambio.htm - -# From Jesper Nørgaard Welen (2006-10-08): -# I think that there are some obvious mistakes in the suggested link -# from Oscar van Vlijmen,... for instance entry 66 says that GMT-4 -# ended 1990-09-12 while entry 67 only begins GMT-3 at 1990-09-15 -# (they should have been 1990-09-15 and 1990-09-16 respectively), but -# anyhow it clears up some doubts too. - -# From Paul Eggert (2014-08-12): -# The following data entries for Chile and America/Santiago are from -# (2006-09-20), transcribed by -# Jesper Nørgaard Welen. The data entries for Pacific/Easter are from Shanks -# & Pottenger, except with DST transitions after 1932 cloned from -# America/Santiago. The pre-1980 Pacific/Easter data entries are dubious, -# but we have no other source. - # From Germán Poo-Caamaño (2008-03-03): # Due to drought, Chile extends Daylight Time in three weeks. This # is one-time change (Saturday 3/29 at 24:00 for America/Santiago # and Saturday 3/29 at 22:00 for Pacific/Easter) # The Supreme Decree is located at # http://www.shoa.cl/servicios/supremo316.pdf -# and the instructions for 2008 are located in: -# http://www.horaoficial.cl/cambio.htm - +# # From José Miguel Garrido (2008-03-05): -# ... -# You could see the announces of the change on # http://www.shoa.cl/noticias/2008/04hora/hora.htm # From Angel Chiang (2010-03-04): # Subject: DST in Chile exceptionally extended to 3 April due to earthquake # http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098 -# (in Spanish, last paragraph). # -# This is breaking news. There should be more information available later. - # From Arthur David Olson (2010-03-06): # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch. -# From Glenn Eychaner (2011-03-02): -# It appears that the Chilean government has decided to postpone the -# change from summer time to winter time again, by three weeks to April -# 2nd: -# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651 -# -# This is not yet reflected in the official "cambio de hora" site, but -# probably will be soon: -# http://www.horaoficial.cl/cambio.htm - -# From Arthur David Olson (2011-03-02): -# The emol.com article mentions a water shortage as the cause of the -# postponement, which may mean that it's not a permanent change. - # From Glenn Eychaner (2011-03-28): -# The article: # http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E} -# # In English: # Chile's clocks will go back an hour this year on the 7th of May instead # of this Saturday. They will go forward again the 3rd Saturday in -# August, not in October as they have since 1968. This is a pilot plan -# which will be reevaluated in 2012. +# August, not in October as they have since 1968. # From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23): # As stated in the website of the Chilean Energy Ministry # http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html # The Chilean Government has decided to postpone the entrance into winter time -# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not -# been yet formalized but it will within the next days. +# (to leave DST) from March 11 2012 to April 28th 2012.... # Quote from the website communication: # # 6. For the year 2012, the dates of entry into winter time will be as follows: @@ -1237,17 +1248,9 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # From Paul Eggert (2015-03-03): # For now, assume that the extension will persist indefinitely. -# NOTE: ChileAQ rules for Antarctic bases are stored separately in the -# 'antarctica' file. - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Chile 1927 1932 - Sep 1 0:00 1:00 S +Rule Chile 1927 1931 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - -Rule Chile 1942 only - Jun 1 4:00u 0 - -Rule Chile 1942 only - Aug 1 5:00u 1:00 S -Rule Chile 1946 only - Jul 15 4:00u 1:00 S -Rule Chile 1946 only - Sep 1 3:00u 0:00 - -Rule Chile 1947 only - Apr 1 4:00u 0 - Rule Chile 1968 only - Nov 3 4:00u 1:00 S Rule Chile 1969 only - Mar 30 3:00u 0 - Rule Chile 1969 only - Nov 23 4:00u 1:00 S @@ -1258,10 +1261,8 @@ Rule Chile 1972 1986 - Mar Sun>=9 3:00u 0 - Rule Chile 1973 only - Sep 30 4:00u 1:00 S Rule Chile 1974 1987 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1987 only - Apr 12 3:00u 0 - -Rule Chile 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule Chile 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule Chile 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule Chile 1990 only - Mar 18 3:00u 0 - +Rule Chile 1988 1990 - Mar Sun>=9 3:00u 0 - +Rule Chile 1988 1989 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1990 only - Sep 16 4:00u 1:00 S Rule Chile 1991 1996 - Mar Sun>=9 3:00u 0 - Rule Chile 1991 1997 - Oct Sun>=9 4:00u 1:00 S @@ -1284,15 +1285,21 @@ Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 S # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 - -4:42:46 - SMT 1910 # Santiago Mean Time + -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time -5:00 - CLT 1916 Jul 1 # Chile Time - -4:42:46 - SMT 1918 Sep 1 # Santiago Mean Time - -4:00 - CLT 1919 Jul 1 # Chile Time - -4:42:46 - SMT 1927 Sep 1 # Santiago Mean Time - -5:00 Chile CL%sT 1947 May 22 # Chile Time + -4:42:46 - SMT 1918 Sep 10 + -4:00 - CLT 1919 Jul 1 + -4:42:46 - SMT 1927 Sep 1 + -5:00 Chile CL%sT 1932 Sep 1 + -4:00 - CLT 1942 Jun 1 + -5:00 - CLT 1942 Aug 1 + -4:00 - CLT 1946 Jul 15 + -4:00 1:00 CLST 1946 Sep 1 # central Chile + -4:00 - CLT 1947 Apr 1 + -5:00 - CLT 1947 May 21 23:00 -4:00 Chile CL%sT 2015 Apr 26 3:00u -3:00 - CLT -Zone Pacific/Easter -7:17:44 - LMT 1890 +Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time -6:00 Chile EAS%sT 2015 Apr 26 3:00u @@ -1302,6 +1309,25 @@ Zone Pacific/Easter -7:17:44 - LMT 1890 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, # and Antarctic bases, are like America/Santiago. +# Antarctic base using South American rules +# (See the file 'antarctica' for more.) +# +# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) +# +# From Ethan Dicks (1996-10-06): +# It keeps the same time as Punta Arenas, Chile, because, just like us +# and the South Pole, that's the other end of their supply line.... +# I verified with someone who was there that since 1980, +# Palmer has followed Chile. Prior to that, before the Falklands War, +# Palmer used to be supplied from Argentina. +# +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Palmer 0 - zzz 1965 + -4:00 Arg AR%sT 1969 Oct 5 + -3:00 Arg AR%sT 1982 May + -4:00 Chile CL%sT 2015 Apr 26 3:00u + -3:00 - CLT + # Colombia # Milne gives 4:56:16.4 for Bogotá time in 1899; round to nearest. He writes, diff --git a/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java b/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java index 75efc60e0db..2a9242c1e79 100644 --- a/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java +++ b/jdk/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java @@ -152,9 +152,6 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { String GST[] = new String[] {"Gulf Standard Time", "GST", "Gulf Daylight Time", "GDT", "Gulf Time", "GT"}; - String HAST[] = new String[] {"Hawaii-Aleutian Standard Time", "HAST", - "Hawaii-Aleutian Daylight Time", "HADT", - "Hawaii-Aleutian Time", "HAT"}; String HKT[] = new String[] {"Hong Kong Time", "HKT", "Hong Kong Summer Time", "HKST", "Hong Kong Time", "HKT"}; @@ -371,7 +368,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -393,7 +390,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { "Paraguay Summer Time", "PYST", "Paraguay Time", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java index 7dd97ebd058..152cc67fcb5 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/de/TimeZoneNames_de.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { String GST[] = new String[] {"Golf Normalzeit", "GST", "Golf Sommerzeit", "GDT", "Zeitzone f\u00FCr Persischen Golf", "GT"}; - String HAST[] = new String[] {"Hawaii-Aleutische Normalzeit", "HAST", - "Hawaii-Aleutische Sommerzeit", "HADT", - "Zeitzone f\u00FCr Hawaii und Al\u00EButen", "HAT"}; String HKT[] = new String[] {"Hongkong Zeit", "HKT", "Hongkong Sommerzeit", "HKST", "Hongkong Zeit", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { "Paraguay Sommerzeit", "PYST", "Paraguay Zeit", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java index 99f48b2d902..50075d56378 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/es/TimeZoneNames_es.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { String GST[] = new String[] {"Hora est\u00e1ndar del Golfo", "GST", "Hora de verano del Golfo", "GDT", "Hora del Golfo", "GT"}; - String HAST[] = new String[] {"Hora est\u00e1ndar de Hawaii-Aleutianas", "HAST", - "Hora de verano de Hawaii-Aleutianas", "HADT", - "Hora de Hawaii-Aleutian", "HAT"}; String HKT[] = new String[] {"Hora de Hong Kong", "HKT", "Hora de verano de Hong Kong", "HKST", "Hora de Hong Kong", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { "Hora de verano de Paraguay", "PYST", "Hora de Paraguay", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java index 9a89c8508df..50e2f5be093 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { String GST[] = new String[] {"Heure normale du Golfe", "GST", "Heure avanc\u00e9e du Golfe", "GDT", "Golfe", "GT"} ; - String HAST[] = new String[] {"Heure normale d'Hawa\u00ef-Al\u00e9outiennes", "HAST", - "Heure avanc\u00e9e d'Hawa\u00ef-Al\u00e9outiennes", "HADT", - "Hawa\u00EF-Iles Al\u00E9outiennes", "HAT"} ; String HKT[] = new String[] {"Heure de Hong Kong", "HKT", "Heure d'\u00e9t\u00e9 de Hong Kong", "HKST", "Heure de Hong-Kong", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { "Heure d'\u00e9t\u00e9 du Paraguay", "PYST", "Heure du Paraguay", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java index b3edb6e4236..d7021e7b465 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/it/TimeZoneNames_it.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { String GST[] = new String[] {"Ora solare del golfo", "GST", "Ora legale del golfo", "GDT", "Ora del golfo", "GT"}; - String HAST[] = new String[] {"Ora solare delle Isole Hawaii-Aleutine", "HAST", - "Ora solare delle Isole Hawaii-Aleutine", "HADT", - "Ora Hawaii-Aleutine", "HAT"}; String HKT[] = new String[] {"Ora di Hong Kong", "HKT", "Ora estiva di Hong Kong", "HKST", "Ora di Hong Kong", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { "Ora estiva del Paraguay", "PYST", "Ora del Paraguay", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java index df5d3acbba2..b4d3d2ad40e 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { String GST[] = new String[] {"\u6e7e\u5cb8\u6a19\u6e96\u6642", "GST", "\u6e7e\u5cb8\u590f\u6642\u9593", "GDT", "\u6E7E\u5CB8\u6642\u9593", "GT"}; - String HAST[] = new String[] {"\u30cf\u30ef\u30a4 - \u30a2\u30ea\u30e5\u30fc\u30b7\u30e3\u30f3\u6a19\u6e96\u6642", "HAST", - "\u30cf\u30ef\u30a4 - \u30a2\u30ea\u30e5\u30fc\u30b7\u30e3\u30f3\u590f\u6642\u9593", "HADT", - "\u30CF\u30EF\u30A4\u30FB\u30A2\u30EA\u30E5\u30FC\u30B7\u30E3\u30F3\u6642\u9593", "HAT"}; String HKT[] = new String[] {"\u9999\u6e2f\u6642\u9593", "HKT", "\u9999\u6e2f\u590f\u6642\u9593", "HKST", "\u9999\u6E2F\u6642\u9593", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { "\u30d1\u30e9\u30b0\u30a2\u30a4\u590f\u6642\u9593", "PYST", "\u30D1\u30E9\u30B0\u30A2\u30A4\u6642\u9593", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java index 2ef152babc1..522c3e8f0fd 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { String GST[] = new String[] {"\uac78\ud504\ub9cc \ud45c\uc900\uc2dc", "GST", "\uac78\ud504\ub9cc \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "GDT", "\uAC78\uD504\uB9CC \uD45C\uC900\uC2DC", "GT"}; - String HAST[] = new String[] {"\ud558\uc640\uc774 \uc54c\ub958\uc0e8 \ud45c\uc900\uc2dc", "HAST", - "\ud558\uc640\uc774 \uc54c\ub958\uc0e8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "HADT", - "\uD558\uC640\uC774-\uC54C\uB8E8\uC0E8 \uD45C\uC900\uC2DC", "HAT"}; String HKT[] = new String[] {"\ud64d\ucf69 \uc2dc\uac04", "HKT", "\ud64d\ucf69 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "HKST", "\uD64D\uCF69 \uD45C\uC900\uC2DC", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { "\ud30c\ub77c\uacfc\uc774 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "PYST", "\uD30C\uB77C\uACFC\uC774 \uD45C\uC900\uC2DC", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java index 9ff7e574c84..2e1d131215f 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java @@ -150,9 +150,6 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST", "Hor\u00e1rio de luz natural do golfo", "GDT", "Hor\u00E1rio do Golfo", "GT"}; - String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST", - "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT", - "Hor\u00E1rio do Hava\u00ED-Aleutas", "HAT"}; String HKT[] = new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT", "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST", "Hor\u00E1rio de Hong Kong", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST", "Hor\u00E1rio do Paraguai", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java index 916c2c5d981..f8b56830052 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { String GST[] = new String[] {"Gulf-normaltid", "GST", "Gulf-sommartid", "GDT", "Golfens tid", "GT"}; - String HAST[] = new String[] {"Hawaii-Aleuterna, normaltid", "HAST", - "Hawaii-Aleuterna, sommartid", "HADT", - "Hawaiiansk-aleutisk tid", "HAT"}; String HKT[] = new String[] {"Hong Kong, normaltid", "HKT", "Hong Kong, sommartid", "HKST", "Hongkong-tid", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { "Paraguay, sommartid", "PYST", "Paraguayansk tid", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java index 5cb70c85eb9..cdbfdbbcb6d 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { String GST[] = new String[] {"\u6ce2\u65af\u6e7e\u6807\u51c6\u65f6\u95f4", "GST", "\u6ce2\u65af\u6e7e\u590f\u4ee4\u65f6", "GDT", "\u6D77\u6E7E\u65F6\u95F4", "GT"}; - String HAST[] = new String[] {"\u590f\u5a01\u5937-\u963f\u7559\u7533\u7fa4\u5c9b\u6807\u51c6\u65f6\u95f4", "HAST", - "\u590f\u5a01\u5937-\u963f\u7559\u7533\u7fa4\u5c9b\u590f\u4ee4\u65f6", "HADT", - "\u590F\u5A01\u5937-\u963F\u7559\u7533\u65F6\u95F4", "HAT"}; String HKT[] = new String[] {"\u9999\u6e2f\u65f6\u95f4", "HKT", "\u9999\u6e2f\u590f\u4ee4\u65f6", "HKST", "\u9999\u6E2F\u65F6\u95F4", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { "\u5df4\u62c9\u572d\u590f\u4ee4\u65f6", "PYST", "\u5DF4\u62C9\u572D\u65F6\u95F4", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1024,7 +1021,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java index 0074f49da8b..4ba8e02139b 100644 --- a/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java +++ b/jdk/src/jdk.localedata/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java @@ -153,9 +153,6 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { String GST[] = new String[] {"\u6ce2\u65af\u7063\u6a19\u6e96\u6642\u9593", "GST", "\u6ce2\u65af\u7063\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "GDT", "\u6CE2\u65AF\u7063\u6642\u9593", "GT"}; - String HAST[] = new String[] {"\u590f\u5a01\u5937-\u963f\u7559\u7533\u7fa4\u5cf6\u6a19\u6e96\u6642\u9593", "HAST", - "\u590f\u5a01\u5937-\u963f\u7559\u7533\u7fa4\u5cf6\u65e5\u5149\u7bc0\u7d04\u6642\u9593", "HADT", - "\u590F\u5A01\u5937-\u963F\u7559\u7533\u6642\u9593", "HAT"}; String HKT[] = new String[] {"\u9999\u6e2f\u6642\u9593", "HKT", "\u9999\u6e2f\u590f\u4ee4\u6642\u9593", "HKST", "\u9999\u6E2F\u6642\u9593", "HKT"}; @@ -372,7 +369,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"Africa/Tripoli", EET}, {"Africa/Tunis", CET}, {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, + {"America/Adak", HST}, {"America/Anguilla", AST}, {"America/Antigua", AST}, {"America/Araguaina", BRT}, @@ -394,7 +391,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { "\u5df4\u62c9\u572d\u590f\u4ee4\u6642\u9593", "PYST", "\u5DF4\u62C9\u572D\u6642\u9593", "PYT"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, + {"America/Atka", HST}, {"America/Bahia", BRT}, {"America/Bahia_Banderas", CST}, {"America/Barbados", AST}, @@ -1026,7 +1023,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle { {"UCT", UTC}, {"Universal", UTC}, {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, + {"US/Aleutian", HST}, {"US/Arizona", MST}, {"US/Central", CST}, {"US/Eastern", EST}, diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION index ebd4db73b0e..19d5533385c 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION +++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2015b +tzdata2015d diff --git a/jdk/test/sun/util/calendar/zi/tzdata/africa b/jdk/test/sun/util/calendar/zi/tzdata/africa index 43103225577..6099a70f5e6 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/africa +++ b/jdk/test/sun/util/calendar/zi/tzdata/africa @@ -342,35 +342,29 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # above) says DST had no affect on electricity consumption. There is # no information about when DST will end this fall. See: # http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 + +# From Steffen Thorsen (2015-04-08): +# Egypt will start DST on midnight after Thursday, April 30, 2015. +# This is based on a law (no 35) from May 15, 2014 saying it starts the last +# Thursday of April.... Clocks will still be turned back for Ramadan, but +# dates not yet announced.... +# http://almogaz.com/news/weird-news/2015/04/05/1947105 ... +# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html + +# From Ahmed Nazmy (2015-04-20): +# Egypt's ministers cabinet just announced ... that it will cancel DST at +# least for 2015. # -# For now, guess that later spring and fall transitions will use -# 2010's rules, and guess that Egypt will switch to standard time at -# 24:00 the last Thursday before Ramadan, and back to DST at 00:00 the -# first Friday after Ramadan. To implement this, -# transition dates for 2015 through 2037 were determined by running -# the following program under GNU Emacs 24.3, with the results integrated -# by hand into the table below. Ramadan again intrudes on the guessed -# DST starting in 2038, but that's beyond our somewhat-arbitrary cutoff. -# (let ((islamic-year 1436)) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (friday 5)) -# (while (/= friday (mod a 7)) -# (setq a (1- a))) -# (while (/= friday (mod b 7)) -# (setq b (1+ b))) -# (setq a (1- a)) -# (setq b (1- b)) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t0\t-\n" -# "Rule\tEgypt\t%d\tonly\t-\t%s\t%2d\t24:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Tim Parenti (2015-04-20): +# http://english.ahram.org.eg/WriterArticles/NewsContentP/1/128195/Egypt/No-daylight-saving-this-summer-Egypts-prime-minist.aspx +# "Egypt's cabinet agreed on Monday not to switch clocks for daylight saving +# time this summer, and carry out studies on the possibility of canceling the +# practice altogether in future years." +# +# From Paul Eggert (2015-04-20): +# For now, assume DST will be canceled. Any resumption would likely +# use different rules anyway. + Rule Egypt 2008 only - Aug lastThu 24:00 0 - Rule Egypt 2009 only - Aug 20 24:00 0 - Rule Egypt 2010 only - Aug 10 24:00 0 - @@ -379,22 +373,7 @@ Rule Egypt 2010 only - Sep lastThu 24:00 0 - Rule Egypt 2014 only - May 15 24:00 1:00 S Rule Egypt 2014 only - Jun 26 24:00 0 - Rule Egypt 2014 only - Jul 31 24:00 1:00 S -Rule Egypt 2014 max - Sep lastThu 24:00 0 - -Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S -Rule Egypt 2015 only - Jun 11 24:00 0 - -Rule Egypt 2015 only - Jul 23 24:00 1:00 S -Rule Egypt 2016 only - Jun 2 24:00 0 - -Rule Egypt 2016 only - Jul 7 24:00 1:00 S -Rule Egypt 2017 only - May 25 24:00 0 - -Rule Egypt 2017 only - Jun 29 24:00 1:00 S -Rule Egypt 2018 only - May 10 24:00 0 - -Rule Egypt 2018 only - Jun 14 24:00 1:00 S -Rule Egypt 2019 only - May 2 24:00 0 - -Rule Egypt 2019 only - Jun 6 24:00 1:00 S -Rule Egypt 2020 only - May 28 24:00 1:00 S -Rule Egypt 2021 only - May 13 24:00 1:00 S -Rule Egypt 2022 only - May 5 24:00 1:00 S -Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S +Rule Egypt 2014 only - Sep lastThu 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Cairo 2:05:09 - LMT 1900 Oct diff --git a/jdk/test/sun/util/calendar/zi/tzdata/antarctica b/jdk/test/sun/util/calendar/zi/tzdata/antarctica index 1f3e4347b21..102b496341d 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/antarctica +++ b/jdk/test/sun/util/calendar/zi/tzdata/antarctica @@ -38,41 +38,6 @@ # I made up all time zone abbreviations mentioned here; corrections welcome! # FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited. -# These rules are stolen from the 'southamerica' file. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule ArgAQ 1964 1966 - Mar 1 0:00 0 - -Rule ArgAQ 1964 1966 - Oct 15 0:00 1:00 S -Rule ArgAQ 1967 only - Apr 2 0:00 0 - -Rule ArgAQ 1967 1968 - Oct Sun>=1 0:00 1:00 S -Rule ArgAQ 1968 1969 - Apr Sun>=1 0:00 0 - -Rule ArgAQ 1974 only - Jan 23 0:00 1:00 S -Rule ArgAQ 1974 only - May 1 0:00 0 - -Rule ChileAQ 1972 1986 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1974 1987 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1987 only - Apr 12 3:00u 0 - -Rule ChileAQ 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule ChileAQ 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1990 only - Mar 18 3:00u 0 - -Rule ChileAQ 1990 only - Sep 16 4:00u 1:00 S -Rule ChileAQ 1991 1996 - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1991 1997 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 1997 only - Mar 30 3:00u 0 - -Rule ChileAQ 1998 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 1998 only - Sep 27 4:00u 1:00 S -Rule ChileAQ 1999 only - Apr 4 3:00u 0 - -Rule ChileAQ 1999 2010 - Oct Sun>=9 4:00u 1:00 S -Rule ChileAQ 2000 2007 - Mar Sun>=9 3:00u 0 - -# N.B.: the end of March 29 in Chile is March 30 in Universal time, -# which is used below in specifying the transition. -Rule ChileAQ 2008 only - Mar 30 3:00u 0 - -Rule ChileAQ 2009 only - Mar Sun>=9 3:00u 0 - -Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 - -Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 - -Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S -Rule ChileAQ 2012 2015 - Apr Sun>=23 3:00u 0 - -Rule ChileAQ 2012 2014 - Sep Sun>=2 4:00u 1:00 S - # Argentina - year-round bases # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05 # Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01 @@ -367,21 +332,7 @@ Zone Antarctica/Rothera 0 - zzz 1976 Dec 1 # USA - year-round bases # # Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) -# -# From Ethan Dicks (1996-10-06): -# It keeps the same time as Punta Arenas, Chile, because, just like us -# and the South Pole, that's the other end of their supply line.... -# I verified with someone who was there that since 1980, -# Palmer has followed Chile. Prior to that, before the Falklands War, -# Palmer used to be supplied from Argentina. -# -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Antarctica/Palmer 0 - zzz 1965 - -4:00 ArgAQ AR%sT 1969 Oct 5 - -3:00 ArgAQ AR%sT 1982 May - -4:00 ChileAQ CL%sT 2015 Apr 26 3:00u - -3:00 - CLT -# +# See 'southamerica' for Antarctica/Palmer, since it uses South American DST. # # McMurdo Station, Ross Island, since 1955-12 # Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20 diff --git a/jdk/test/sun/util/calendar/zi/tzdata/backward b/jdk/test/sun/util/calendar/zi/tzdata/backward index 95266a6f16c..3c845cfc01c 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/backward +++ b/jdk/test/sun/util/calendar/zi/tzdata/backward @@ -43,6 +43,7 @@ Link America/Argentina/Jujuy America/Jujuy Link America/Indiana/Knox America/Knox_IN Link America/Kentucky/Louisville America/Louisville Link America/Argentina/Mendoza America/Mendoza +Link America/Toronto America/Montreal Link America/Rio_Branco America/Porto_Acre Link America/Argentina/Cordoba America/Rosario Link America/Denver America/Shiprock diff --git a/jdk/test/sun/util/calendar/zi/tzdata/europe b/jdk/test/sun/util/calendar/zi/tzdata/europe index 008268ac763..7cee9a81527 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/europe +++ b/jdk/test/sun/util/calendar/zi/tzdata/europe @@ -99,7 +99,7 @@ # 1:00:14 SET Swedish (1879-1899)* # 2:00 EET EEST Eastern Europe # 3:00 FET Further-eastern Europe (2011-2014)* -# 3:00 MSK MSD MSM* Moscow +# 3:00 MSK MSD MSM* Minsk, Moscow # From Peter Ilieve (1994-12-04), # The original six [EU members]: Belgium, France, (West) Germany, Italy, diff --git a/jdk/test/sun/util/calendar/zi/tzdata/northamerica b/jdk/test/sun/util/calendar/zi/tzdata/northamerica index 442a50eef0f..810cd93ade6 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica +++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica @@ -250,9 +250,14 @@ Zone PST8PDT -8:00 US P%sT # The law doesn't give abbreviations. # # From Paul Eggert (2000-01-08), following a heads-up from Rives McDow: -# Public law 106-564 (2000-12-23) introduced the abbreviation -# "Chamorro Standard Time" for time in Guam and the Northern Marianas. -# See the file "australasia". +# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time" +# for time in Guam and the Northern Marianas. See the file "australasia". +# +# From Paul Eggert (2015-04-17): +# HST and HDT are standardized abbreviations for Hawaii-Aleutian +# standard and daylight times. See section 9.47 (p 234) of the +# U.S. Government Printing Office Style Manual (2008) +# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf # From Arthur David Olson, 2005-08-09 # The following was signed into law on 2005-08-08. @@ -559,7 +564,7 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18 -11:00 - BST 1969 -11:00 US B%sT 1983 Oct 30 2:00 -10:00 US AH%sT 1983 Nov 30 - -10:00 US HA%sT + -10:00 US H%sT # The following switches don't quite make our 1970 cutoff. # # Shanks writes that part of southwest Alaska (e.g. Aniak) @@ -1354,14 +1359,9 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # Quebec -# From Paul Eggert (2013-08-30): -# Since 1970 most of Quebec has been like Toronto. -# However, because earlier versions of the tz database mistakenly relied on data -# from Shanks & Pottenger saying that Quebec differed from Ontario after 1970, -# a separate entry was created for most of Quebec. We're loath to lose -# its pre-1970 info, even though the tz database is normally limited to -# zones that differ after 1970, so keep this otherwise out-of-scope entry. - +# From Paul Eggert (2015-03-24): +# See America/Toronto for most of Quebec, including Montreal. +# # Matthews and Vincent (1998) also write that Quebec east of the -63 # meridian is supposed to observe AST, but residents as far east as # Natashquan use EST/EDT, and residents east of Natashquan use AST. @@ -1375,39 +1375,10 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # For lack of better info, guess this practice began around 1970, contra to # Shanks & Pottenger who have this region observing AST/ADT. -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Mont 1917 only - Mar 25 2:00 1:00 D -Rule Mont 1917 only - Apr 24 0:00 0 S -Rule Mont 1919 only - Mar 31 2:30 1:00 D -Rule Mont 1919 only - Oct 25 2:30 0 S -Rule Mont 1920 only - May 2 2:30 1:00 D -Rule Mont 1920 1922 - Oct Sun>=1 2:30 0 S -Rule Mont 1921 only - May 1 2:00 1:00 D -Rule Mont 1922 only - Apr 30 2:00 1:00 D -Rule Mont 1924 only - May 17 2:00 1:00 D -Rule Mont 1924 1926 - Sep lastSun 2:30 0 S -Rule Mont 1925 1926 - May Sun>=1 2:00 1:00 D -Rule Mont 1927 1937 - Apr lastSat 24:00 1:00 D -Rule Mont 1927 1937 - Sep lastSat 24:00 0 S -Rule Mont 1938 1940 - Apr lastSun 0:00 1:00 D -Rule Mont 1938 1939 - Sep lastSun 0:00 0 S -Rule Mont 1946 1973 - Apr lastSun 2:00 1:00 D -Rule Mont 1945 1948 - Sep lastSun 2:00 0 S -Rule Mont 1949 1950 - Oct lastSun 2:00 0 S -Rule Mont 1951 1956 - Sep lastSun 2:00 0 S -Rule Mont 1957 1973 - Oct lastSun 2:00 0 S - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Blanc-Sablon -3:48:28 - LMT 1884 -4:00 Canada A%sT 1970 -4:00 - AST -Zone America/Montreal -4:54:16 - LMT 1884 - -5:00 Mont E%sT 1918 - -5:00 Canada E%sT 1919 - -5:00 Mont E%sT 1942 Feb 9 2:00s - -5:00 Canada E%sT 1946 - -5:00 Mont E%sT 1974 - -5:00 Canada E%sT # Ontario @@ -1898,17 +1869,115 @@ Zone America/Creston -7:46:04 - LMT 1884 # Dawson switched to PST in 1973. Inuvik switched to MST in 1979. # Mathew Englander (1996-10-07) gives the following refs: # * 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68, -# c. 7 defines Yukon standard time as UTC-9. This is still valid; +# c. 7 defines Yukon standard time as UTC-9.... # see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1). +# [http://canlii.ca/t/7vhg] # * C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00. # * O.I.C. 1980/02 established DST. # * O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00. -# Shanks & Pottenger say Yukon's 1973-10-28 switch was at 2:00; go -# with Englander. -# From Chris Walton (2006-06-26): -# Here is a link to the old daylight saving portion of the interpretation -# act which was last updated in 1987: -# http://www.gov.yk.ca/legislation/regs/oic1987_056.pdf + +# From Brian Inglis (2015-04-14): +# +# I tried to trace the history of Yukon time and found the following +# regulations, giving the reference title and URL if found, regulation name, +# and relevant quote if available. Each regulation specifically revokes its +# predecessor. The final reference is to the current Interpretation Act +# authorizing and resulting from these regulatory changes. +# +# Only recent regulations were retrievable via Yukon government site search or +# index, and only some via Canadian legal sources. Other sources used include +# articles titled "Standard Time and Time Zones in Canada" from JRASC via ADS +# Abstracts, cited by ADO for 1932 ..., and updated versions from 1958 and +# 1970 quoted below; each article includes current extracts from provincial +# and territorial ST and DST regulations at the end, summaries and details of +# standard times and daylight saving time at many locations across Canada, +# with time zone maps, tables and calculations for Canadian Sunrise, Sunset, +# and LMST; they also cover many countries and global locations, with a chart +# and table showing current Universal Time offsets, and may be useful as +# another source of information for 1970 and earlier. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; JRASC, Vol. 26, +# pp.49-77; February 1932; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1932JRASC..26...49S from p.75: +# Yukon Interpretation Ordinance +# Yukon standard time is the local mean time at the one hundred and +# thirty-fifth meridian. +# +# * Standard Time and Time Zones in Canada; Smith, C.C.; Thomson, Malcolm M.; +# JRASC, Vol. 52, pp.193-223; October 1958; SAO/NASA Astrophysics Data System +# (ADS) http://adsabs.harvard.edu/abs/1958JRASC..52..193S from pp.220-1: +# Yukon Interpretation Ordinance, 1955, Chap. 16. +# +# (1) Subject to this section, standard time shall be reckoned as nine +# hours behind Greenwich Time and called Yukon Standard Time. +# +# (2) Notwithstanding subsection (1), the Commissioner may make regulations +# varying the manner of reckoning standard time. +# +# * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance +# http://? - no online source found +# +# * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC, +# Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS) +# http://adsabs.harvard.edu/abs/1970JRASC..64..129T from p.156: Yukon +# Territory Commissioner's Order 1967-59 Interpretation Ordinance ... +# +# 1. Commissioner's Order 1966-20 dated at Whitehorse in the Yukon +# Territory on 27th January, 1966, is hereby revoked. +# +# 2. Yukon (East) Standard Time as defined by section 36 of the +# Interpretation Ordinance from and after mid-night on the 28th day of May, +# 1967 shall be reckoned in the same manner as Pacific Standard Time, that +# is to say, eight hours behind Greenwich Time in the area of the Yukon +# Territory lying east of the 138th degree longitude west. +# +# 3. In the remainder of the Territory, lying west of the 138th degree +# longitude west, Yukon (West) Standard Time shall be reckoned as nine +# hours behind Greenwich Time. +# +# * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214 +# http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html +# C.O. 1973/214 INTERPRETATION ACT ... +# +# 1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby +# revoked. +# +# 2. Yukon Standard Time as defined by section 36 of the Interpretation +# Act from and after midnight on the twenty-eighth day of October, 1973 +# shall be reckoned in the same manner as Pacific Standard Time, that is +# to say eight hours behind Greenwich Time. +# +# * O.I.C. 1980/02 INTERPRETATION ACT +# http://? - no online source found +# +# * Yukon Daylight Saving Time, YOIC 1987/56 +# http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html +# O.I.C. 1987/056 INTERPRETATION ACT ... +# +# In every year between +# (a) two o'clock in the morning in the first Sunday in April, and +# (b) two o'clock in the morning in the last Sunday in October, +# Standard Time shall be reckoned as seven hours behind Greenwich Time and +# called Yukon Daylight Saving Time. +# ... +# Dated ... 9th day of March, A.D., 1987. +# +# * Yukon Daylight Saving Time 2006, YOIC 2006/127 +# http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html +# O.I.C. 2006/127 INTERPRETATION ACT ... +# +# 1. In Yukon each year the time for general purposes shall be 7 hours +# behind Greenwich mean time during the period commencing at two o'clock +# in the forenoon on the second Sunday of March and ending at two o'clock +# in the forenoon on the first Sunday of November and shall be called +# Yukon Daylight Saving Time. +# +# 2. Order-in-Council 1987/56 is revoked. +# +# 3. This order comes into force January 1, 2007. +# +# * Interpretation Act, RSY 2002, c 125 +# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html # From Rives McDow (1999-09-04): # Nunavut ... moved ... to incorporate the whole territory into one time zone. @@ -2134,7 +2203,7 @@ Zone America/Inuvik 0 - zzz 1953 # Inuvik founded -7:00 NT_YK M%sT 1980 -7:00 Canada M%sT Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20 - -9:00 NT_YK Y%sT 1966 Jul 1 2:00 + -9:00 NT_YK Y%sT 1967 May 28 0:00 -8:00 NT_YK P%sT 1980 -8:00 Canada P%sT Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 diff --git a/jdk/test/sun/util/calendar/zi/tzdata/southamerica b/jdk/test/sun/util/calendar/zi/tzdata/southamerica index 238ae3dc569..375c2d2fa9d 100644 --- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica +++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica @@ -1121,6 +1121,60 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Chile +# From Paul Eggert (2015-04-03): +# Shanks & Pottenger says America/Santiago introduced standard time in +# 1890 and rounds its UTC offset to 70W40; guess that in practice this +# was the same offset as in 1916-1919. It also says Pacific/Easter +# standardized on 109W22 in 1890; assume this didn't change the clocks. +# +# Dates for America/Santiago from 1910 to 2004 are primarily from +# the following source, cited by Oscar van Vlijmen (2006-10-08): +# [1] Chile Law +# http://www.webexhibits.org/daylightsaving/chile.html +# This contains a copy of a this official table: +# Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30) +# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm +# [1] needs several corrections, though. +# +# The first set of corrections is from: +# [2] History of the Official Time of Chile +# http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06). See: +# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html +# This is an English translation of: +# Historia de la hora oficial de Chile (retrieved 2012-10-24). See: +# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm +# A fancier Spanish version (requiring mouse-clicking) is at: +# http://www.horaoficial.cl/historia_hora.html +# Conflicts between [1] and [2] were resolved as follows: +# +# - [1] says the 1910 transition was Jan 1, [2] says Jan 10 and cites +# Boletín Nº 1, Aviso Nº 1 (1910). Go with [2]. +# +# - [1] says SMT was -4:42:45, [2] says Chile's official time from +# 1916 to 1919 was -4:42:46.3, the meridian of Chile's National +# Astronomical Observatory (OAN), then located in what is now +# Quinta Normal in Santiago. Go with [2], rounding it to -4:42:46. +# +# - [1] says the 1918 transition was Sep 1, [2] says Sep 10 and cites +# Boletín Nº 22, Aviso Nº 129/1918 (1918-08-23). Go with [2]. +# +# - [1] does not give times for transitions; assume they occur +# at midnight mainland time, the current common practice. However, +# go with [2]'s specification of 23:00 for the 1947-05-21 transition. +# +# Another correction to [1] is from Jesper Nørgaard Welen, who +# wrote (2006-10-08), "I think that there are some obvious mistakes in +# the suggested link from Oscar van Vlijmen,... for instance entry 66 +# says that GMT-4 ended 1990-09-12 while entry 67 only begins GMT-3 at +# 1990-09-15 (they should have been 1990-09-15 and 1990-09-16 +# respectively), but anyhow it clears up some doubts too." +# +# Data for Pacific/Easter from 1910 through 1967 come from Shanks & +# Pottenger. After that, for lack of better info assume +# Pacific/Easter is always two hours behind America/Santiago; +# this is known to work for DST transitions starting in 2008 and +# may well be true for earlier transitions. + # From Eduardo Krell (1995-10-19): # The law says to switch to DST at midnight [24:00] on the second SATURDAY # of October.... The law is the same for March and October. @@ -1133,78 +1187,35 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # Because of the same drought, the government decided to end DST later, # on April 3, (one-time change). -# From Oscar van Vlijmen (2006-10-08): -# http://www.horaoficial.cl/cambio.htm - -# From Jesper Nørgaard Welen (2006-10-08): -# I think that there are some obvious mistakes in the suggested link -# from Oscar van Vlijmen,... for instance entry 66 says that GMT-4 -# ended 1990-09-12 while entry 67 only begins GMT-3 at 1990-09-15 -# (they should have been 1990-09-15 and 1990-09-16 respectively), but -# anyhow it clears up some doubts too. - -# From Paul Eggert (2014-08-12): -# The following data entries for Chile and America/Santiago are from -# (2006-09-20), transcribed by -# Jesper Nørgaard Welen. The data entries for Pacific/Easter are from Shanks -# & Pottenger, except with DST transitions after 1932 cloned from -# America/Santiago. The pre-1980 Pacific/Easter data entries are dubious, -# but we have no other source. - # From Germán Poo-Caamaño (2008-03-03): # Due to drought, Chile extends Daylight Time in three weeks. This # is one-time change (Saturday 3/29 at 24:00 for America/Santiago # and Saturday 3/29 at 22:00 for Pacific/Easter) # The Supreme Decree is located at # http://www.shoa.cl/servicios/supremo316.pdf -# and the instructions for 2008 are located in: -# http://www.horaoficial.cl/cambio.htm - +# # From José Miguel Garrido (2008-03-05): -# ... -# You could see the announces of the change on # http://www.shoa.cl/noticias/2008/04hora/hora.htm # From Angel Chiang (2010-03-04): # Subject: DST in Chile exceptionally extended to 3 April due to earthquake # http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098 -# (in Spanish, last paragraph). # -# This is breaking news. There should be more information available later. - # From Arthur David Olson (2010-03-06): # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch. -# From Glenn Eychaner (2011-03-02): -# It appears that the Chilean government has decided to postpone the -# change from summer time to winter time again, by three weeks to April -# 2nd: -# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651 -# -# This is not yet reflected in the official "cambio de hora" site, but -# probably will be soon: -# http://www.horaoficial.cl/cambio.htm - -# From Arthur David Olson (2011-03-02): -# The emol.com article mentions a water shortage as the cause of the -# postponement, which may mean that it's not a permanent change. - # From Glenn Eychaner (2011-03-28): -# The article: # http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E} -# # In English: # Chile's clocks will go back an hour this year on the 7th of May instead # of this Saturday. They will go forward again the 3rd Saturday in -# August, not in October as they have since 1968. This is a pilot plan -# which will be reevaluated in 2012. +# August, not in October as they have since 1968. # From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23): # As stated in the website of the Chilean Energy Ministry # http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html # The Chilean Government has decided to postpone the entrance into winter time -# (to leave DST) from March 11 2012 to April 28th 2012. The decision has not -# been yet formalized but it will within the next days. +# (to leave DST) from March 11 2012 to April 28th 2012.... # Quote from the website communication: # # 6. For the year 2012, the dates of entry into winter time will be as follows: @@ -1237,17 +1248,9 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # From Paul Eggert (2015-03-03): # For now, assume that the extension will persist indefinitely. -# NOTE: ChileAQ rules for Antarctic bases are stored separately in the -# 'antarctica' file. - # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Chile 1927 1932 - Sep 1 0:00 1:00 S +Rule Chile 1927 1931 - Sep 1 0:00 1:00 S Rule Chile 1928 1932 - Apr 1 0:00 0 - -Rule Chile 1942 only - Jun 1 4:00u 0 - -Rule Chile 1942 only - Aug 1 5:00u 1:00 S -Rule Chile 1946 only - Jul 15 4:00u 1:00 S -Rule Chile 1946 only - Sep 1 3:00u 0:00 - -Rule Chile 1947 only - Apr 1 4:00u 0 - Rule Chile 1968 only - Nov 3 4:00u 1:00 S Rule Chile 1969 only - Mar 30 3:00u 0 - Rule Chile 1969 only - Nov 23 4:00u 1:00 S @@ -1258,10 +1261,8 @@ Rule Chile 1972 1986 - Mar Sun>=9 3:00u 0 - Rule Chile 1973 only - Sep 30 4:00u 1:00 S Rule Chile 1974 1987 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1987 only - Apr 12 3:00u 0 - -Rule Chile 1988 1989 - Mar Sun>=9 3:00u 0 - -Rule Chile 1988 only - Oct Sun>=1 4:00u 1:00 S -Rule Chile 1989 only - Oct Sun>=9 4:00u 1:00 S -Rule Chile 1990 only - Mar 18 3:00u 0 - +Rule Chile 1988 1990 - Mar Sun>=9 3:00u 0 - +Rule Chile 1988 1989 - Oct Sun>=9 4:00u 1:00 S Rule Chile 1990 only - Sep 16 4:00u 1:00 S Rule Chile 1991 1996 - Mar Sun>=9 3:00u 0 - Rule Chile 1991 1997 - Oct Sun>=9 4:00u 1:00 S @@ -1284,15 +1285,21 @@ Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 S # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:46 - LMT 1890 - -4:42:46 - SMT 1910 # Santiago Mean Time + -4:42:46 - SMT 1910 Jan 10 # Santiago Mean Time -5:00 - CLT 1916 Jul 1 # Chile Time - -4:42:46 - SMT 1918 Sep 1 # Santiago Mean Time - -4:00 - CLT 1919 Jul 1 # Chile Time - -4:42:46 - SMT 1927 Sep 1 # Santiago Mean Time - -5:00 Chile CL%sT 1947 May 22 # Chile Time + -4:42:46 - SMT 1918 Sep 10 + -4:00 - CLT 1919 Jul 1 + -4:42:46 - SMT 1927 Sep 1 + -5:00 Chile CL%sT 1932 Sep 1 + -4:00 - CLT 1942 Jun 1 + -5:00 - CLT 1942 Aug 1 + -4:00 - CLT 1946 Jul 15 + -4:00 1:00 CLST 1946 Sep 1 # central Chile + -4:00 - CLT 1947 Apr 1 + -5:00 - CLT 1947 May 21 23:00 -4:00 Chile CL%sT 2015 Apr 26 3:00u -3:00 - CLT -Zone Pacific/Easter -7:17:44 - LMT 1890 +Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time -7:00 Chile EAS%sT 1982 Mar 14 3:00u # Easter Time -6:00 Chile EAS%sT 2015 Apr 26 3:00u @@ -1302,6 +1309,25 @@ Zone Pacific/Easter -7:17:44 - LMT 1890 # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, # and Antarctic bases, are like America/Santiago. +# Antarctic base using South American rules +# (See the file 'antarctica' for more.) +# +# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968) +# +# From Ethan Dicks (1996-10-06): +# It keeps the same time as Punta Arenas, Chile, because, just like us +# and the South Pole, that's the other end of their supply line.... +# I verified with someone who was there that since 1980, +# Palmer has followed Chile. Prior to that, before the Falklands War, +# Palmer used to be supplied from Argentina. +# +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Antarctica/Palmer 0 - zzz 1965 + -4:00 Arg AR%sT 1969 Oct 5 + -3:00 Arg AR%sT 1982 May + -4:00 Chile CL%sT 2015 Apr 26 3:00u + -3:00 - CLT + # Colombia # Milne gives 4:56:16.4 for Bogotá time in 1899; round to nearest. He writes, From b308a894cf3ecfa288d638f01c143575dd12b5b6 Mon Sep 17 00:00:00 2001 From: Peter Levart Date: Mon, 4 May 2015 10:13:19 +0200 Subject: [PATCH 57/63] 8074003: java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized Make epochSecond part of ZoneOffsetTransition so it doesn't have to be recomputed frequently Reviewed-by: scolebourne, rriggs --- .../java/time/zone/ZoneOffsetTransition.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java b/jdk/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java index 5f05338bd09..32ab6b82ddf 100644 --- a/jdk/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java +++ b/jdk/src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java @@ -103,6 +103,10 @@ public final class ZoneOffsetTransition * Serialization version. */ private static final long serialVersionUID = -6946044323557704546L; + /** + * The transition epoch-second. + */ + private final long epochSecond; /** * The local transition date-time at the transition. */ @@ -152,6 +156,7 @@ public final class ZoneOffsetTransition * @param offsetAfter the offset at and after the transition, not null */ ZoneOffsetTransition(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter) { + this.epochSecond = transition.toEpochSecond(offsetBefore); this.transition = transition; this.offsetBefore = offsetBefore; this.offsetAfter = offsetAfter; @@ -165,6 +170,7 @@ public final class ZoneOffsetTransition * @param offsetAfter the offset at and after the transition, not null */ ZoneOffsetTransition(long epochSecond, ZoneOffset offsetBefore, ZoneOffset offsetAfter) { + this.epochSecond = epochSecond; this.transition = LocalDateTime.ofEpochSecond(epochSecond, 0, offsetBefore); this.offsetBefore = offsetBefore; this.offsetAfter = offsetAfter; @@ -209,7 +215,7 @@ public final class ZoneOffsetTransition * @throws IOException if an error occurs */ void writeExternal(DataOutput out) throws IOException { - Ser.writeEpochSec(toEpochSecond(), out); + Ser.writeEpochSec(epochSecond, out); Ser.writeOffset(offsetBefore, out); Ser.writeOffset(offsetAfter, out); } @@ -253,7 +259,7 @@ public final class ZoneOffsetTransition * @return the transition epoch second */ public long toEpochSecond() { - return transition.toEpochSecond(offsetBefore); + return epochSecond; } //------------------------------------------------------------------------- @@ -397,7 +403,13 @@ public final class ZoneOffsetTransition */ @Override public int compareTo(ZoneOffsetTransition transition) { - return this.getInstant().compareTo(transition.getInstant()); + if (epochSecond < transition.epochSecond) { + return -1; + } else if (epochSecond > transition.epochSecond) { + return 1; + } else { + return this.getInstant().compareTo(transition.getInstant()); + } } //----------------------------------------------------------------------- @@ -416,7 +428,8 @@ public final class ZoneOffsetTransition } if (other instanceof ZoneOffsetTransition) { ZoneOffsetTransition d = (ZoneOffsetTransition) other; - return transition.equals(d.transition) && + return epochSecond == d.epochSecond && + transition.equals(d.transition) && offsetBefore.equals(d.offsetBefore) && offsetAfter.equals(d.offsetAfter); } return false; From 4385df0f3d2ba814c71d71b9ffc556ad8be454fe Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 4 May 2015 11:35:10 +0200 Subject: [PATCH 58/63] 8079248: JDK fails with "jdk\\bin\\management_ext.dll: The specified procedure could not be found" Reviewed-by: jbachorik, dholmes, erikj, ihse --- jdk/make/lib/Lib-java.management.gmk | 5 ----- jdk/make/lib/Lib-jdk.management.gmk | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk index 3da181b0d1a..b0062445341 100644 --- a/jdk/make/lib/Lib-java.management.gmk +++ b/jdk/make/lib/Lib-java.management.gmk @@ -38,11 +38,6 @@ LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include $(LIBJAVA_HEADER_FLAGS) \ # -# In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate -# a binary that is compatible with windows versions older than 7/2008R2. -# See MSDN documentation for GetProcessMemoryInfo for more information. -BUILD_LIBMANAGEMENT_CFLAGS += -DPSAPI_VERSION=1 - LIBMANAGEMENT_OPTIMIZATION := HIGH ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), ) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) diff --git a/jdk/make/lib/Lib-jdk.management.gmk b/jdk/make/lib/Lib-jdk.management.gmk index 819bef81252..bd07d478f5b 100644 --- a/jdk/make/lib/Lib-jdk.management.gmk +++ b/jdk/make/lib/Lib-jdk.management.gmk @@ -39,6 +39,11 @@ LIBMANAGEMENT_EXT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/inc $(LIBJAVA_HEADER_FLAGS) \ # +# In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate +# a binary that is compatible with windows versions older than 7/2008R2. +# See MSDN documentation for GetProcessMemoryInfo for more information. +BUILD_LIBMANAGEMENT_EXT_CFLAGS += -DPSAPI_VERSION=1 + LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), ) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) From b4dc8b67ff0e6f87b339c061f55a40695fc7eefc Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 4 May 2015 17:56:33 +0800 Subject: [PATCH 59/63] 8078495: End time checking for native TGT is wrong Reviewed-by: xuelei --- .../windows/native/libw2k_lsa_auth/NativeCreds.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c b/jdk/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c index ab0ee036e6b..554eb63c19d 100644 --- a/jdk/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c +++ b/jdk/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c @@ -389,7 +389,7 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ jobject authTime, renewTillTime, hostAddresses = NULL; KERB_EXTERNAL_TICKET *msticket; int found = 0; - FILETIME Now, EndTime, LocalEndTime; + FILETIME Now, EndTime; int i, netypes; jint *etypes = NULL; @@ -476,8 +476,7 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ GetSystemTimeAsFileTime(&Now); EndTime.dwLowDateTime = msticket->EndTime.LowPart; EndTime.dwHighDateTime = msticket->EndTime.HighPart; - FileTimeToLocalFileTime(&EndTime, &LocalEndTime); - if (CompareFileTime(&Now, &LocalEndTime) < 0) { + if (CompareFileTime(&Now, &EndTime) < 0) { for (i=0; iSessionKey.KeyType) { found = 1; From 9caa55bf9c30facc1ba677aba4688f07bc12e47d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 5 May 2015 12:49:11 +0200 Subject: [PATCH 60/63] 8077422: hprof agent: Build failed with VS2013 Update 4 Reviewed-by: sla, tbell --- jdk/make/lib/Lib-jdk.hprof.agent.gmk | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/make/lib/Lib-jdk.hprof.agent.gmk b/jdk/make/lib/Lib-jdk.hprof.agent.gmk index 7c43331b33c..7f01e04790c 100644 --- a/jdk/make/lib/Lib-jdk.hprof.agent.gmk +++ b/jdk/make/lib/Lib-jdk.hprof.agent.gmk @@ -49,6 +49,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \ CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ $(BUILD_LIBHPROF_CFLAGS), \ CFLAGS_debug := -DHPROF_LOGGING, \ + CFLAGS_windows := -D_WINSOCK_DEPRECATED_NO_WARNINGS, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ From 3db31d77fc996724f1fd79beaa2b1d6595a4d525 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Tue, 5 May 2015 21:14:12 +0800 Subject: [PATCH 61/63] 8078439: SPNEGO auth fails if client proposes MS krb5 OID Reviewed-by: valeriep --- .../classes/sun/security/jgss/GSSUtil.java | 5 +- .../security/jgss/spnego/SpNegoContext.java | 9 ++- jdk/test/sun/security/jgss/spnego/MSOID.java | 75 ++++++++++++++++++ jdk/test/sun/security/jgss/spnego/msoid.txt | 27 +++++++ jdk/test/sun/security/krb5/auto/MSOID2.java | 78 +++++++++++++++++++ 5 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 jdk/test/sun/security/jgss/spnego/MSOID.java create mode 100644 jdk/test/sun/security/jgss/spnego/msoid.txt create mode 100644 jdk/test/sun/security/krb5/auto/MSOID2.java diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSUtil.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSUtil.java index 51dbdd62846..abcacf024a4 100644 --- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSUtil.java +++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSUtil.java @@ -59,6 +59,8 @@ public class GSSUtil { GSSUtil.createOid("1.2.840.113554.1.2.2"); public static final Oid GSS_KRB5_MECH_OID2 = GSSUtil.createOid("1.3.5.1.5.2"); + public static final Oid GSS_KRB5_MECH_OID_MS = + GSSUtil.createOid("1.2.840.48018.1.2.2"); public static final Oid GSS_SPNEGO_MECH_OID = GSSUtil.createOid("1.3.6.1.5.5.2"); @@ -101,7 +103,8 @@ public class GSSUtil { public static boolean isKerberosMech(Oid oid) { return (GSS_KRB5_MECH_OID.equals(oid) || - GSS_KRB5_MECH_OID2.equals(oid)); + GSS_KRB5_MECH_OID2.equals(oid) || + GSS_KRB5_MECH_OID_MS.equals(oid)); } diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spnego/SpNegoContext.java b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spnego/SpNegoContext.java index 355816dc887..416c091d4e6 100644 --- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spnego/SpNegoContext.java +++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spnego/SpNegoContext.java @@ -538,14 +538,21 @@ public class SpNegoContext implements GSSContextSpi { // get the token for mechanism byte[] accept_token; - if (mechList[0].equals(mech_wanted)) { + if (mechList[0].equals(mech_wanted) || + (GSSUtil.isKerberosMech(mechList[0]) && + GSSUtil.isKerberosMech(mech_wanted))) { // get the mechanism token + if (DEBUG && !mech_wanted.equals(mechList[0])) { + System.out.println("SpNegoContext.acceptSecContext: " + + "negotiated mech adjusted to " + mechList[0]); + } byte[] mechToken = initToken.getMechToken(); if (mechToken == null) { throw new GSSException(GSSException.FAILURE, -1, "mechToken is missing"); } accept_token = GSS_acceptSecContext(mechToken); + mech_wanted = mechList[0]; } else { accept_token = null; } diff --git a/jdk/test/sun/security/jgss/spnego/MSOID.java b/jdk/test/sun/security/jgss/spnego/MSOID.java new file mode 100644 index 00000000000..9926544fadf --- /dev/null +++ b/jdk/test/sun/security/jgss/spnego/MSOID.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015, 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 8078439 + * @summary SPNEGO auth fails if client proposes MS krb5 OID + */ + +import org.ietf.jgss.GSSContext; +import org.ietf.jgss.GSSCredential; +import org.ietf.jgss.GSSException; +import org.ietf.jgss.GSSManager; + +import java.lang.Exception; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Base64; + +public class MSOID { + public static void main(String[] args) throws Exception { + + // msoid.txt is a NegTokenInit packet sent from Internet Explorer to + // IIS server on a test machine. No sensitive info included. + byte[] header = Files.readAllBytes( + Paths.get(System.getProperty("test.src"), "msoid.txt")); + byte[] token = Base64.getMimeDecoder().decode( + Arrays.copyOfRange(header, 10, header.length)); + + GSSCredential cred = null; + GSSContext ctx = GSSManager.getInstance().createContext(cred); + + try { + ctx.acceptSecContext(token, 0, token.length); + // Before the fix, GSS_KRB5_MECH_OID_MS is not recognized + // and acceptor chooses another mech and goes on + throw new Exception("Should fail"); + } catch (GSSException gsse) { + // After the fix, GSS_KRB5_MECH_OID_MS is recognized but the token + // cannot be accepted because we don't have any krb5 credential. + gsse.printStackTrace(); + if (gsse.getMajor() != GSSException.NO_CRED) { + throw gsse; + } + for (StackTraceElement st: gsse.getStackTrace()) { + if (st.getClassName().startsWith("sun.security.jgss.krb5.")) { + // Good, it is already in krb5 mech's hand. + return; + } + } + throw gsse; + } + } +} diff --git a/jdk/test/sun/security/jgss/spnego/msoid.txt b/jdk/test/sun/security/jgss/spnego/msoid.txt new file mode 100644 index 00000000000..9277c0d80ef --- /dev/null +++ b/jdk/test/sun/security/jgss/spnego/msoid.txt @@ -0,0 +1,27 @@ +Negotiate YIIGPAYGKwYBBQUCoIIGMDCCBiygMDAuBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBA +GCNwICHgYKKwYBBAGCNwICCqKCBfYEggXyYIIF7gYJKoZIhvcSAQICAQBuggXdMIIF2aADAgEFoQMCAQ +6iBwMFACAAAACjggTIYYIExDCCBMCgAwIBBaEOGwxUV0VMVkUuVEhJTkuiIzAhoAMCAQKhGjAYGwRIVF +RQGxBrZGMuVFdFTFZFLlRISU5Lo4IEgjCCBH6gAwIBEqEDAgEJooIEcASCBGyoIL0zQevk57pY6D25+1 +SQbAeldYXkpdn8JlKgSyz1cdiTpwqDt8B7pj7AoKMPHCiVss37XCEpBIuZClBK3Jmry+QWXCbQemKvyO +Caz806RDNB7TA7l1NxUJ6LsCiQncNV1TEq37NM6H8il6PjnbcBoMcHH/+cFGVPNP3eP+Z5Kd+5DZELPV +qQkYogXybmngmYy2168OsfyANzotUpm/HBwEHKujCPH9Gbhwhmx4tUcBvCetPNoXmHOQZLB4u7uyblKO +c6R2yGTFCa8DBQNXx38RRHgsvlNGlx+UsSoF4/DixAreNRkZnpKabn1cRK/KZh6vHfbL2QVegr1hrp71 +IJwyVuR+RTGL/7WCSWFClJyWD3Cm4+eK46uVj4MKPUJBc0XVViV/Dsh4N9EomVDkovWU/v+0d+W4pQJk +BFnJoNYuaG8UnLWrxMKGNwVOfsblcJtB7B5zuZzsWsUIdmMT1n8mtWrv0wYiwvotfT6z/suk+Vhg9MGd +uDmeneeG9deMDUMwrwB8u5J2VEeWKurBfDB02jv/08qAZS2ovBfV2SiXCuky5z7llvQ8uPsoezVwYdhu +HmBuPE7PqDIkmkEJRWpq95dqxllCXvlL4uINxFadkhcbzuCDjSGil78p6FJTKc4Dt/kuug1zJuXhJO1L +2CgkMsYPTogoUvAtplzIDF0nSMwJUIJzQXIHCFasmDNJA1GAvQD+Qh7Mp4dYb2Uid+sSM2qlQn8bgR9S +dlfL/olQ9GKPOBBGwsVoZKR3Brimc9LOJofPMEEa560KQNgtO1MyjoqEJKzFq+2wVZQahvpcV7VgixCq +Nom3Wd4NdZ3QM0PHL7e9bl3/qCsWaiNlmRW7gupz8nNCtWNMf4UBqIeo9jPH9Cb96fOUM4c7XXp4iX6w +ns1MsmPZ4VQDRU7VK+yTC81KGfMlSvrvqCJfGoxy0NaeXtmkN55oAhaj8ebiEBdKCXXF5wk0zqvt1ifE +9ywYk/AbdFBPThyOT6Tu9x41gi6mCTiMtSdg7cFY+5yXd3UIgUwnbOG3IwAkdLXlepvnHwEXCXkbfbr9 +e1wjs5LMmYRunJ05FOx8iAibB8bWjgiFmYWbeyjyQF3KDs5cpvROXcapT1+KlFU4lEO8lnKM/Ipq81ED +s+/DygXCvlskeKV57URx+XcMWnURu4hdGHbCPY/X7eOmox0mw5/V0rJMIjSjQNPyi4UM4dDTso6mt0XE +h+YyCGmV67D8/nihO/NaRFEFxHlaGwh3Lqu/Tero88iuDb9U1uEWz8cF8wr+2azyOTmhi/ID/jfiEC8i +b/hjYEcBI99x/CNmuuM7uCwTPIsJtBD3AnUdPa/yo41rCtm/K5HZCTzw2W93vaHqyttEC7c70rdAUB49 +CfSAVtH4gwxCDKMSJMlELfHGrIloEppEoUEc7LOdmzinvzcuajj0moBn5WUZHiVmopLjGjW7wunmMPQS +H9FmCQf2I1N4E6nZfH+cUzBbHkIF5XHY4KXwmJQ3UdbUDp8z3npIH3MIH0oAMCARKigewEgenD23U6gQ +aORjuWnT1nqadqR+E5fa/viohey4g6mn6uPfVRPz5a7OsDOurQV9wHR/VEwvjpdlZzMcANbt28Ut3YvQ +SWWwqALoLtSLOTgXmK9Higb+NSSO7hKtqKgDWREfQisn3xE9PGkMUlanu2es34+k43AQmJf2InvFNNcy +PcKllikoMOldVeoF1BIKvbDI0+vE3SwSrD0UhUdDeeZTN33b0Y8f3I1UYtidwxcRRkvCaNEhphtr8hp8 +hXWQkuxVvF2TiQyHF4PnJkgb1Zr6GXydOmMgMJE1anPFKFKWH6PZWGnp8mw0F5zw== diff --git a/jdk/test/sun/security/krb5/auto/MSOID2.java b/jdk/test/sun/security/krb5/auto/MSOID2.java new file mode 100644 index 00000000000..e81be6a8a3d --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/MSOID2.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2015, 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 8078439 + * @summary SPNEGO auth fails if client proposes MS krb5 OID + * @compile -XDignore.symbol.file MSOID2.java + * @run main/othervm MSOID2 + */ + +import sun.security.jgss.GSSUtil; + +// The basic krb5 test skeleton you can copy from +public class MSOID2 { + + public static void main(String[] args) throws Exception { + + new OneKDC(null).writeJAASConf(); + + Context c, s; + c = Context.fromJAAS("client"); + s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_SPNEGO_MECH_OID); + s.startAsServer(GSSUtil.GSS_SPNEGO_MECH_OID); + + byte[] t = new byte[0]; + boolean first = true; + while (true) { + if (t != null || !c.x().isEstablished()) t = c.take(t); + if (first) { + // Tweak the packet to append an extra OID + int len = t.length; + byte[] nt = new byte[len + 11]; + System.arraycopy(t, 0, nt, 0, 0x23); + System.arraycopy(t, 0x18, nt, 0x23, 11); // dup the OID + System.arraycopy(t, 0x23, nt, 0x2e, len-0x23); + nt[0x1d] = (byte)0x82; // change the 1st to MS OID + // Length bytes to be tweaked + for (int pos: new int[] {3, 0xf, 0x13, 0x15, 0x17}) { + nt[pos] = (byte)(nt[pos] + 11); + } + t = nt; + new sun.misc.HexDumpEncoder().encodeBuffer(t, System.out); + } + if (t != null || !s.x().isEstablished()) t = s.take(t); + if (c.x().isEstablished() && s.x().isEstablished()) break; + first = false; + } + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + s.dispose(); + c.dispose(); + } +} From 45ae6536d67f14a75fe61cfc3cba35696c0f3da4 Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Tue, 5 May 2015 09:08:20 +0000 Subject: [PATCH 62/63] 8078245: AARCH64: JDK fails to build due to undefined symbol in libpng Add -DPNG_ARM_NEON_OPT=0 to LIBSPLASHSCREEN_CFLAGS flags Reviewed-by: dholmes, ihse, erikj --- jdk/make/lib/Awt2dLibraries.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index 254f446a000..f0847a60e4b 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -827,7 +827,7 @@ ifndef BUILD_HEADLESS_ONLY LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen endif - LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE \ + LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \ $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \ $(LIBJAVA_HEADER_FLAGS) \ # From 99e090089e21dbcb8fc89cb8656bcefe88c87c12 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Tue, 5 May 2015 17:55:16 +0100 Subject: [PATCH 63/63] 8079129: NullPointerException in PKCS#12 Keystore in PKCS12KeyStore.java Reviewed-by: weijun --- .../sun/security/pkcs12/PKCS12KeyStore.java | 23 +++++++-------- .../security/pkcs12/StoreSecretKeyTest.java | 29 +++++++++++++++---- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java index 1f52015392c..625d31115a9 100644 --- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java +++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -1642,23 +1642,22 @@ public final class PKCS12KeyStore extends KeyStoreSpi { Entry entry = entries.get(alias); // certificate chain - int chainLen = 1; - Certificate[] certs = null; + Certificate[] certs; if (entry instanceof PrivateKeyEntry) { PrivateKeyEntry keyEntry = (PrivateKeyEntry) entry; - if (keyEntry.chain == null) { - chainLen = 0; - } else { - chainLen = keyEntry.chain.length; - } - certs = keyEntry.chain; - + if (keyEntry.chain != null) { + certs = keyEntry.chain; + } else { + certs = new Certificate[0]; + } } else if (entry instanceof CertEntry) { - certs = new Certificate[]{((CertEntry) entry).cert}; + certs = new Certificate[]{((CertEntry) entry).cert}; + } else { + certs = new Certificate[0]; } - for (int i = 0; i < chainLen; i++) { + for (int i = 0; i < certs.length; i++) { // create SafeBag of Type CertBag DerOutputStream safeBag = new DerOutputStream(); safeBag.putOID(CertBag_OID); diff --git a/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java b/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java index 84c28899126..97bc3758d62 100644 --- a/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java +++ b/jdk/test/sun/security/pkcs12/StoreSecretKeyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015 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 @@ -23,12 +23,14 @@ /* * @test - * @bug 8005408 + * @bug 8005408 8079129 * @summary KeyStore API enhancements */ import java.io.*; import java.security.*; +import java.security.cert.*; +import java.security.cert.Certificate; import java.util.*; import javax.crypto.*; import javax.crypto.spec.*; @@ -39,7 +41,9 @@ public class StoreSecretKeyTest { private final static String DIR = System.getProperty("test.src", "."); private static final char[] PASSWORD = "passphrase".toCharArray(); private static final String KEYSTORE = "keystore.p12"; - private static final String ALIAS = "my secret key"; + private static final String CERT = DIR + "/trusted.pem"; + private static final String ALIAS = "my trusted cert"; + private static final String ALIAS2 = "my secret key"; public static void main(String[] args) throws Exception { @@ -56,8 +60,13 @@ public class StoreSecretKeyTest { KeyStore keystore = KeyStore.getInstance("PKCS12"); keystore.load(null, null); - // Set entry + // Set trusted certificate entry + Certificate cert = loadCertificate(CERT); keystore.setEntry(ALIAS, + new KeyStore.TrustedCertificateEntry(cert), null); + + // Set secret key entry + keystore.setEntry(ALIAS2, new KeyStore.SecretKeyEntry(generateSecretKey("AES", 128)), new KeyStore.PasswordProtection(PASSWORD)); @@ -73,7 +82,7 @@ public class StoreSecretKeyTest { " entries"); } - KeyStore.Entry entry = keystore.getEntry(ALIAS, + KeyStore.Entry entry = keystore.getEntry(ALIAS2, new KeyStore.PasswordProtection(PASSWORD)); System.out.println("Retrieved entry: " + entry); @@ -101,4 +110,14 @@ public class StoreSecretKeyTest { generator.init(size); return generator.generateKey(); } + + private static Certificate loadCertificate(String certFile) + throws Exception { + X509Certificate cert = null; + try (FileInputStream certStream = new FileInputStream(certFile)) { + CertificateFactory factory = + CertificateFactory.getInstance("X.509"); + return factory.generateCertificate(certStream); + } + } }