当功能需要 ASM8_EXPERIMENTAL 时跳过 Spot Bug 堆栈跟踪
Skip Spot Bugs stack traces when features require ASM8_EXPERIMENTAL
我正在使用 spotbugs-maven-plugin 4.0.0(+ spotbugs 4.0.2 依赖)。
问题是无法识别Java14条记录.
每次当它找到一条记录或使用该记录的 class 时,它都会打印一个长堆栈跟踪。
[INFO] >>> spotbugs-maven-plugin:4.0.0:check (default) > :spotbugs @ core >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:4.0.0:spotbugs (spotbugs) @ core ---
[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Unable to get XClass for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Exception analyzing com.something.MyClassThatUsesMyRecord using detector edu.umd.cs.findbugs.detect.CalledMethods
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
...
[INFO] Done SpotBugs Analysis....
我怎样才能摆脱这些详细的异常?
虽然插件的 latest release 通过 JDK-15 读取支持,但 ASM 对 预览功能 的支持需要 8.0+ 版本,而库仍然是在 7.3.1
.
也就是说,changes to their deployable branch 应该可以解决这个问题。具体区别在于:
- <asm.version>7.3.1</asm.version>
+ <asm.version>8.0.1</asm.version>
所以就等下一个版本,同时要求他们尽快发布。 :)
我正在使用 spotbugs-maven-plugin 4.0.0(+ spotbugs 4.0.2 依赖)。
问题是无法识别Java14条记录.
每次当它找到一条记录或使用该记录的 class 时,它都会打印一个长堆栈跟踪。
[INFO] >>> spotbugs-maven-plugin:4.0.0:check (default) > :spotbugs @ core >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:4.0.0:spotbugs (spotbugs) @ core ---
[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Unable to get XClass for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Couldn't get class info for com/something/MyRecord
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[java] Exception analyzing com.something.MyClassThatUsesMyRecord using detector edu.umd.cs.findbugs.detect.CalledMethods
[java] java.lang.UnsupportedOperationException: This feature requires ASM8_EXPERIMENTAL
[java] At org.objectweb.asm.ClassVisitor.visitRecordComponentExperimental(ClassVisitor.java:304)
[java] At org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:929)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:704)
[java] At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
[java] At org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:552)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:736)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:79)
[java] At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
[java] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:261)
[java] At edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:685)
[java] At edu.umd.cs.findbugs.ba.AnalysisContext.setAppClassList(AnalysisContext.java:975)
[java] At edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:909)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:252)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
...
[INFO] Done SpotBugs Analysis....
我怎样才能摆脱这些详细的异常?
虽然插件的 latest release 通过 JDK-15 读取支持,但 ASM 对 预览功能 的支持需要 8.0+ 版本,而库仍然是在 7.3.1
.
也就是说,changes to their deployable branch 应该可以解决这个问题。具体区别在于:
- <asm.version>7.3.1</asm.version>
+ <asm.version>8.0.1</asm.version>
所以就等下一个版本,同时要求他们尽快发布。 :)