Closed donalmurtagh closed 11 months ago
is it possible to get the .classfile for the problematic class? What version of java was the target class compiled in?
is it possible to get the .classfile for the problematic class? What version of java was the target class compiled in?
@mebigfatguy When you say "problematic class", do you mean the class being analyzed, i.e. com.example.MyClass
in the example above? My app uses JDK21, so that's what all of the analyzed classes were compiled with.
yes com.example.MyClass, probably related to jdk21
@mebigfatguy I added the following trivial class to my project
package com.example;
public class MyClass {
}
I ran Spotbugs and confirmed that the error occurs for this class (it seems to occur for every analysed class).
Exception analyzing com.example.MyClass using detector com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse
org.apache.bcel.classfile.ClassFormatException: Invalid constant pool reference using index: 0. Constant pool size is: 16
At org.apache.bcel.classfile.ConstantPool.getConstant(ConstantPool.java:305)
At org.apache.bcel.classfile.ConstantPool.getConstant(ConstantPool.java:257)
At com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse.visitClassContext(IncorrectInternalClassUse.java:85)
At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
I've attached MyClass.class file to this comment. I had to add it as a .zip archive because GitHub doesn't allow .class file attachments.
targetted for 7.6.4
I upgraded the Spotbugs Gradle plugin from 6.0.2 to 6.0.3. After the upgrade I ran the checks, and I now get a lot of these exceptions (one for every class analysed, I think)
I'm using v7.6.3 of sb-contrib.