-
Notifications
You must be signed in to change notification settings - Fork 75
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
ReflectionException: Cannot read class file for some JDK9 classes #152
Comments
Hi, Thanks for reporting this. Unfortunately, I haven't had time to investigate Java 9 yet. I've just installed it, and I can reproduce your problem. I managed to reduce it to the following little program: import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
import java.io.InputStream;
public class Example {
public static void main(String[] args) throws Exception {
Class<?> c = javax.swing.filechooser.FileFilter.class;
// Class<?> c = Example.class;
ClassLoader cl = ClassLoader.getSystemClassLoader();
Type asmType = Type.getType(c);
String url = asmType.getInternalName() + ".class";
System.out.println(asmType + " -- " + url);
InputStream is = cl.getResourceAsStream(url);
new ClassReader(is);
}
} (It depends on ASM 5.1.) The program terminates without problem om Java 8, but it throws this exception on Java 9:
It does the same thing for other types provided by Java (such as ASM has released an alpha version that supports Java 9, but there's no official release yet. Although I can imagine that the problem lies in the way I get hold of a class loader; probably lots of things have changed here due to Project Jigsaw. In other words, I'll have to find some time to investigate this further. If you have some ideas about this, or if you can point me to some good resources to read up on this, I'd be very grateful 😄 . In the mean time, you can work around the issue by suppressing |
Thanks for the heads up! FYI we already use ASM 6.0_Alpha with Findbugs 3.1.0_preview2 and we didn't notice any error. |
…/equalsverifier#152 git-svn-id: http://josm.openstreetmap.de/svn/trunk@10956 0c6e7542-c601-0410-84e7-c038aed88b3b
Perhaps the particular use case that I use ASM for, doesn't come up with FindBugs. I tried replacing EqualsVerifier's version of ASM with the 6.0_ALPHA, but that didn't work, unfortunately. I'll let you know when I find a solution. |
I have good news and bad news. I'm attaching the patch file to this issue, so you can try it out locally if you like, and so that I won't forget about it when these issues are fixed :). Keep in mind though, this is still proof of concept code; I wouldn't release this code in the state it's in now. Use at your own risk ;). |
Did you try Jacoco 0.7.7 or latest snapshot of 0.7.8? We currently use 0.7.8 snapshot to get Java 9 fixes, see jacoco/jacoco#434 |
I used Jacoco 0.7.7. I could indeed try the snapshot, but I can (and do) work around it by simply compiling from Java 7 or 8. EqualsVerifier needs to be compatible with all three anyway. Not being able to do Jacoco from Java 9 is very inconvenient, but the real show stopper is the Maven Shade plugin. Without that, I can't build a jar file to publish on Maven Central. If you have a workaround for that as well, I'd be very grateful :). |
Found the issue in Apache's Jira: https://issues.apache.org/jira/browse/MSHADE-234 |
According to https://issues.apache.org/jira/browse/MSHADE-242 they are also waiting for the next ASM release to support Java 9. |
I tried reproducing this issue today, and upgrading to ASM 6.0_ALPHA fixes it. I don't even need the patch anymore that I mentioned before, so that's a plus. However, I'm not comfortable relying on this ALPHA release. I'd rather wait until there's a final version. The JaCoCo issue has been resolved; Maven Shade is indeed also still waiting on a final release for ASM 6.0. |
I agree it's best to wait. Oracle has the obligation to release the final draft of JPMS (module system) next week, we can hope for a new release of ASM not long after, as the maintainer is also in the Expert Group :) |
ASM 6.0 beta is released! https://mail.ow2.org/wws/arc/asm/2017-07/msg00002.html |
Thanks for the heads-up! I'll play around with it. If they come up with a final version soon, I'll try to have a Java 9 compatible version soon after. If it takes a while longer, I may release a beta version of EqualsVerifier based on ASM's beta in the mean time. It depends a little on when I have time to work on it. |
ASM 6.0 beta is finally available on Maven Central: https://twitter.com/rfscholte/status/893511314575851521 |
Again, thanks for the heads-up; we've been waiting for this for quite a while :). I'll try it out this weekend! |
I just released version 2.3.2 which uses ASM 6.0_BETA as a dependency. It passes all my tests. Could you give it a try and see if it works for you too? |
Yes, it works! Thanks a lot! |
I'm very glad to hear that! Thanks for your help :). |
Maven Shade plugin 3.1.0 is available, see tcurdt/jdependency#11 (comment) :) |
Thanks for letting me know about this! I upgraded, and it works like a charm. |
…/equalsverifier#152 git-svn-id: https://josm.openstreetmap.de/svn/trunk@10956 0c6e7542-c601-0410-84e7-c038aed88b3b
What steps will reproduce the problem?
Run JOSM JUnit tests with JDK9: https://josm.openstreetmap.de/jenkins/job/Java-EarlyAccess-JOSM/jdk=JDK9/lastCompletedBuild/testReport/
What is the code that triggers this problem? (first case)
What is the code that triggers this problem? (second case)
What error message or stack trace does EqualsVerifier give?
What did you expect?
Test success, like with JDK8
Which version of EqualsVerifier are you using?
2.1.5
Please provide any additional information below.
Complete source code:
https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
The text was updated successfully, but these errors were encountered: