-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: [junit] cannot load system class java.lang.Object #50
Comments
Before Java module system (introudced in JDK 9), once compiled, all compiled classes are nested inside the destination directory, based on their respective packages. So for instance, build/classes/ ├── java │ ├── io │ ├── lang │ │ ├── annotation │ │ ├── ref │ │ └── reflect But when compiled with Java 9/10, directory structure of the destination directory for the generated class files is as follows. build/classes/ ├── java.base │ ├── java │ │ ├── io │ │ ├── lang │ │ │ ├── annotation │ │ │ ├── ref │ │ │ └── reflect So if we are to include classes from build/classes directory as a fileset into jpf-classes.jar, as done previously, like: <jar jarfile="build/jpf-classes.jar"> <fileset dir="build/classes"/> .. JPF classloader will fail to resolve the model classes, because the class urls are different than previously. [junit] gov.nasa.jpf.vm.ClassInfoException: class not found: java.lang.Object at gov.nasa.jpf.vm.ClassLoaderInfo.getResolvedClassInfo(ClassLoaderInfo.java:363) at gov.nasa.jpf.vm.SystemClassLoaderInfo.getResolvedClassInfo(SystemClassLoaderInfo.java:147) [SEVERE] cannot load system class java.lang.Object So this restructure the files in jpf-classes.jar (same as before) without introducing any implementation changes to the code. Fixes: javapathfinder#50
Before Java module system (introduced in JDK 9), once compiled, all compiled classes are nested inside the destination directory, based on their respective packages. So for instance, build/classes/ ├── java │ ├── io │ ├── lang │ │ ├── annotation │ │ ├── ref │ │ └── reflect But when compiled with Java 9/10, directory structure of the destination directory for the generated class files is as follows. build/classes/ ├── java.base │ ├── java │ │ ├── io │ │ ├── lang │ │ │ ├── annotation │ │ │ ├── ref │ │ │ └── reflect So if we are to include classes from build/classes directory as a fileset into jpf-classes.jar, as done previously, like: <jar jarfile="build/jpf-classes.jar"> <fileset dir="build/classes"/> .. JPF classloader will fail to resolve the model classes, because the class urls are different than previously. [junit] gov.nasa.jpf.vm.ClassInfoException: class not found: java.lang.Object at gov.nasa.jpf.vm.ClassLoaderInfo.getResolvedClassInfo(ClassLoaderInfo.java:363) at gov.nasa.jpf.vm.SystemClassLoaderInfo.getResolvedClassInfo(SystemClassLoaderInfo.java:147) [SEVERE] cannot load system class java.lang.Object So this restructure the files in jpf-classes.jar (same as before) without introducing any implementation changes to the code. Fixes: javapathfinder#50
Thanks! |
@cyrille-artho |
Sorry to appear to be nitpicking, but can you please try to remove the line removal on line 431? This creates a second hunk in the patch. Simply add an empty line again, and the resulting pull request will be smaller. |
Before Java module system (introduced in JDK 9), once compiled, all compiled classes are nested inside the destination directory, based on their respective packages. So for instance, build/classes/ ├── java │ ├── io │ ├── lang │ │ ├── annotation │ │ ├── ref │ │ └── reflect But when compiled with Java 9/10, directory structure of the destination directory for the generated class files is as follows. build/classes/ ├── java.base │ ├── java │ │ ├── io │ │ ├── lang │ │ │ ├── annotation │ │ │ ├── ref │ │ │ └── reflect So if we are to include classes from build/classes directory as a fileset into jpf-classes.jar, as done previously, like: <jar jarfile="build/jpf-classes.jar"> <fileset dir="build/classes"/> .. JPF classloader will fail to resolve the model classes, because the class urls are different than previously. [junit] gov.nasa.jpf.vm.ClassInfoException: class not found: java.lang.Object at gov.nasa.jpf.vm.ClassLoaderInfo.getResolvedClassInfo(ClassLoaderInfo.java:363) at gov.nasa.jpf.vm.SystemClassLoaderInfo.getResolvedClassInfo(SystemClassLoaderInfo.java:147) [SEVERE] cannot load system class java.lang.Object So this restructure the files in jpf-classes.jar (same as before) without introducing any implementation changes to the code. Fixes: javapathfinder#50
Np. Done. |
* Rearrange class files in jpf-classes.jar: Change java/x to java.base/java/x. Fixes: #50 * Exclude JPF and JUnit classes from jpf-classes.jar
Gayan Weerakutti wrote:
Np. Done.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG9eR2fg8ClSe9eaujfEifHvo2ZTKsNdks5t04aMgaJpZM4UGqqo>.
Thanks!
…--
Regards,
Cyrille Artho - http://artho.com/
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne
|
This is related to the issue javapathfinder#50 which is about JPF failing to load model classes from jpf-classes.jar due to different URI structure of the .class files being introuduced in Java Module System. The previous workaround introudced by the PR javapathfinder#51 is specifically for the jpf-classes.jar And JPF will still fail to locate classes from the other jar files. Thus this reverts it. And make a implementation changes to JarClassFileContainer which is JPF's universal continer for loading classes from any jar file.
When running tests compiled with Java 9 and later, results in the run time errors look like the following:
Possibly because of the new Module System, the class URI of the generated .class files in the build destination directory are different than previously, which makes JPF classloader to fail resolve the model classes from jpf-classes.jar
JDK 8
JDK 9/10
https://travis-ci.org/javapathfinder/jpf-core/builds/381450375#L3059-L3073
The text was updated successfully, but these errors were encountered: