On Mon, 11 Apr 2022 06:41:54 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> The tests serviceability/jvmti/RedefineClasses start failing in loom-repo 
>> with CNFE like "java.lang.NoClassDefFoundError: 
>> jdk/test/lib/compiler/InMemoryJavaCompiler"
>> 
>> It is not a loom specific bug, it might happen in jdk/jdk also.
>> 
>> The workaround is to build some classes explicitly. The fix was implemented 
>> in repo-loom in Nov 2021 and there was no such failure after the fix in the 
>> loom repo.
>> 
>> Also fix inlcudes some text refactoring to make push from loom smaller.
>
> The issue with RedefineClassTest throwing NoClassDefFoundError: 
> jdk/test/lib/InMemoryJavaCompiler  seems to go back to 2016 at least. We've 
> had issues in other areas in the past that stemmed from implicit compilation 
> so I assume this is what is suspected here too.
> 
> In the loom repo, two of the existing RedefineClasss* classes have an 
> explicit `@compile` because the updated tests needed to be compiled with 
> `--enable-preview`. I would be surprised if this caused an issue but maybe it 
> creates an issue with concurrent test execution when tests that depend on 
> implicit compilation are running at the same time (in another agentvm) but 
> doing explicit compilation?  I wonder if creating a TEST.properties with 
> `exclusiveAccess.dirs=.` would help this area.

@AlanBateman  adding the explicit compile commands to add `--enable-preview` is 
exactly what causes the problem. By compiling that individual file first it 
also compiled some testlib dependencies but puts the classes in a different 
place. When another class is later compiled, the compilation path includes that 
destination and so compilation succeeds, but at runtime the path is different 
and we get the NCDFE. This is the analysis that Alex did in a similar issue - 
see his comment in JBS.

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

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

Reply via email to