-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
NPE thrown during scanning #758
Comments
@ronshemerws Thanks for the bug report and the complete testcase. I can reproduce the issue. This seems to be a compiler bug in whatever compiled The error occurs while scanning class The classfile specifies there's an annotation on the generic paramater Was this compiled from Kotlin? The Kotlin compiler has many classfile generation bugs that in the past I have had to work around. I'll keep looking into this in case I'm missing something. |
I don't even know where this annotation comes from, because the source code doesn't have it:
However, definitely the type bound |
So this was compiled from Java, and the annotations were injected after the fact, using bytecode manipulation? If so, the bug may be in the bytecode manipulation stage. |
@lukehutch thank you for the quick response! Actually I also failed to find a method with that signature in the sources so I also believe that this is some bytecode manipulation as you suggest. |
The fully annotated method (without the parameter problem) is @org.checkerframework.checker.formatter.qual.UnknownFormat boolean (java.util.Collection<?>) but with the type parameter annotation, the classfile says the type is supposed to be (for some non-existent/non-present @org.checkerframework.checker.formatter.qual.UnknownFormat boolean (java.util.Collection<? extends @org.checkerframework.checker.formatter.qual.UnknownFormat X>) |
I double-checked everything, and as far as I can see, the classfile is definitely wrong. |
OK, so since this isn't even code you maintain, and it's probably created by a buggy tool (so there are probably other libraries out there with the same problem), I chose to just ignore this case where an NPE is obviously going to be triggered. The type annotation will simply be dropped in this case, because its target doesn't even exist. Fixed and released as 4.8.157. Thanks again for the bug report! |
Scanning artifact org.plumelib:plume-util:1.6.5 with latest classgraph release (4.8.156) throws an NPE. This is happening with both java 11 & 17.
It looks like it is happening when processing the method
which is defined in
org.plumelib.util.IdentityArraySet
Unfortunately, I could not come up with a solution yet.
This is a short program that reproduces the issue, assuming the plume-util jar file is placed in the resources folder:
This is the output of this program:
Adding also the full project:
plume-util-scanner.zip
Once extracted, running the following should reproduce the issue:
mvn package
java -jar target/bug_report-1.0-SNAPSHOT-shaded.jar
And here is the full verbose log:
verbose_log.txt
The text was updated successfully, but these errors were encountered: