8170599: compiler/** tests using ToolProvider.getSystemClassLoader failing
harold seigel
harold.seigel at oracle.com
Thu Dec 1 15:40:40 UTC 2016
Hi Alan,
The changes look good.
Thanks, Harold
On 12/1/2016 10:05 AM, Alan Bateman wrote:
> I need a Reviewer for a trivial change to two tests in
> hotspot/test/compiler/** that are failing in jdk9/dev. We noticed
> these failures while trying to bring the module system into jdk9/dev.
> The failures have been in jdk9/dev since Nov 22 when
> javax.tool.ToolProvider was changed via JDK-8155765 to return null.
> The impact of that change is that these two tests fail with NCDFE as
> they are attempting to load the entry point for the attach API with
> the null loader (but these classes aren't visible via that loader).
> The change is to use the system class loader to load the entry point
> for the attach API. I've also used the opportunity to update the
> @modules tag to add jdk.attach because that's a lurking issue with
> these tests too. Patch inlined below.
>
> -Alan
>
>
> $ hg diff -g
> diff --git
> a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
> b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
> --- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
> +++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
> @@ -30,6 +30,7 @@
> * java.compiler
> * java.instrument
> * java.management
> + * jdk.attach
> *
> * @run main/othervm
> compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
> */
> @@ -42,7 +43,6 @@
> import jdk.internal.org.objectweb.asm.MethodVisitor;
> import jdk.internal.org.objectweb.asm.Opcodes;
>
> -import javax.tools.ToolProvider;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.io.InputStream;
> @@ -132,7 +132,7 @@
> int p = vmName.indexOf('@');
> assert p != -1 : "VM name not in <pid>@<host> format: " +
> vmName;
> String pid = vmName.substring(0, p);
> - ClassLoader cl = ToolProvider.getSystemToolClassLoader();
> + ClassLoader cl = ClassLoader.getSystemClassLoader();
> Class<?> c =
> Class.forName("com.sun.tools.attach.VirtualMachine", true, cl);
> Method attach = c.getDeclaredMethod("attach", String.class);
> Method loadAgent = c.getDeclaredMethod("loadAgent",
> String.class);
> diff --git
> a/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
> b/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
>
> ---
> a/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
> +++
> b/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java
> @@ -27,6 +27,7 @@
> * @library ../../../../../
> * @modules jdk.vm.ci/jdk.vm.ci.meta
> * jdk.vm.ci/jdk.vm.ci.runtime
> + * jdk.attach
> * java.base/jdk.internal.misc
> * @run junit/othervm -XX:+UnlockExperimentalVMOptions
> -XX:+EnableJVMCI jdk.vm.ci.runtime.test.RedefineClassTest
> */
> @@ -37,7 +38,6 @@
> import org.junit.Assert;
> import org.junit.Test;
>
> -import javax.tools.ToolProvider;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.io.InputStream;
> @@ -137,7 +137,7 @@
> int p = vmName.indexOf('@');
> assumeTrue(p != -1);
> String pid = vmName.substring(0, p);
> - ClassLoader cl = ToolProvider.getSystemToolClassLoader();
> + ClassLoader cl = ClassLoader.getSystemClassLoader();
> Class<?> c =
> Class.forName("com.sun.tools.attach.VirtualMachine", true, cl);
> Method attach = c.getDeclaredMethod("attach", String.class);
> Method loadAgent = c.getDeclaredMethod("loadAgent",
> String.class, String.class);
>
More information about the hotspot-dev
mailing list