On Fri, 11 Dec 2020 13:47:54 GMT, Igor Ignatyev <iignat...@openjdk.org> wrote:

>> Ivan Šipka has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   8166026: Refactor java/lang shell tests to java
>
> test/jdk/java/lang/annotation/LoaderLeakTest.java line 54:
> 
>> 52:         List<String> classes = List.of("A.class", "B.class", "C.class");
>> 53:         for (String fileName : classes) {
>> 54:             Files.move(
> 
> I don't think it's a good idea to move files created and managed by `jtreg`. 
> I'd recommend you copying them here and, in `runJavaProcess...` constructing 
> `ProcessBuilder` youself:
> 
> var args = new ArrayList<String>(command.length + 1);
> args.add(JDKToolFinder.getJDKTool("java"));
> Collections.addAll(args, command);
> var pb = new 
> ProcessBuilder(args).directory(Paths.get(Utils.TEST_CLASSES).toFile());

They are intentionally moved out of class path so that the application class 
loader can not find them. If they are not moved they will be loaded by the 
application class loader and they need to be 
[loaded](https://github.com/openjdk/jdk/blob/bc56a63702b8730abc1d0aebee133a5884145fa1/test/jdk/java/lang/annotation/LoaderLeakTest.java#L96)
 by the tests very own `SimpleClassLoader` in order to be able to test for the 
leakage.

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

PR: https://git.openjdk.java.net/jdk/pull/1577

Reply via email to