RFR: 8291508: Fix some tests with "requires vm.continuations"

Ao Qi aoqi at openjdk.org
Mon Aug 1 12:04:41 UTC 2022


On Mon, 1 Aug 2022 07:18:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> `vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001/TestDescription.java`, `vmTestbase/nsk/jvmti/RedefineClasses/StressRedefineVirtual/StressRedefineVirtual.java`, `java/beans/XMLDecoder/8028054/TestConstructorFinder.java` and `java/beans/XMLDecoder/8028054/TestMethodFinder.java` are added or modified by [JDK-8284161](https://bugs.openjdk.org/browse/JDK-8284161), and they are failed if Loom is not supported. Also, `vmTestbase/nsk/jvmti/GetThreadInfo/thrinfo001/TestDescription.java` and `vmTestbase/nsk/jvmti/RedefineClasses/StressRedefineVirtual/StressRedefineVirtual.java` need "requires vm.jvmti".
>> 
>> The issue could be reproduced by zero.
>
> For the XMLDecoder tests then I think the issue is that it's using the 1-arg Class.forName rather than the 3-arg Class.forName. Can you try this:
> 
> 
> diff --git a/test/jdk/java/beans/XMLDecoder/8028054/Task.java b/test/jdk/java/beans/XMLDecoder/8028054/Task.java
> index 1d55fa8e358..add48336d16 100644
> --- a/test/jdk/java/beans/XMLDecoder/8028054/Task.java
> +++ b/test/jdk/java/beans/XMLDecoder/8028054/Task.java
> @@ -130,8 +130,9 @@ abstract class Task<T> implements Runnable {
>                  .map(s -> s.substring(s.indexOf("java")))
>                  .collect(Collectors.toList());
>  
> +        ClassLoader scl = ClassLoader.getSystemClassLoader();
>          for (String name : fileNames) {
> -            classes.add(Class.forName(name));
> +            classes.add(Class.forName(name, false, scl));
>              if (count == classes.size()) {
>                  break;
>              }

Hi @AlanBateman , your method works. It is a much better way. Thank you very much!

Since these two kinds (`jvmti` and `XMLDecoder` tests) of the fix are a little different, should I split this issue into two?

-------------

PR: https://git.openjdk.org/jdk/pull/9677



More information about the client-libs-dev mailing list