Skip to content

4.9.0 Regression: IllegalStateException in ThrowingExceptions detector when parsing method signature containing nested generics #3267

@bmeier-pros

Description

@bmeier-pros

After attempting to upgrade to 4.9.0, I started observing a regression throwing an ISE when analyzing some of our files. Best guess is that this has to do with nested generics and the compilation settings of the file.

The existing stack trace is:

The following errors occurred during analysis:
Exception analyzing {filename} using detector edu.umd.cs.findbugs.detect.ThrowingExceptions
java.lang.IllegalStateException: Invalid method signature: (Ljava/util/Map<Ljava/lang/String;Ljava/util/List<Ljava/lang/String;>;>;Ljava/io/PrintWriter;)V
At edu.umd.cs.findbugs.ba.SignatureParser$ParameterSignatureIterator.next(SignatureParser.java:132)
At edu.umd.cs.findbugs.ba.SignatureParser$ParameterSignatureIterator.next(SignatureParser.java:83)
At edu.umd.cs.findbugs.ba.SignatureParser.getParameterOffset(SignatureParser.java:59)
At edu.umd.cs.findbugs.ba.SignatureParser.getNumParameters(SignatureParser.java:208)
At edu.umd.cs.findbugs.detect.ThrowingExceptions.signatureMatches(ThrowingExceptions.java:170)
At edu.umd.cs.findbugs.detect.ThrowingExceptions.lambda$parentThrows$3(ThrowingExceptions.java:134)
At java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
At java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:1034)
At java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
At java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
At java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
At java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
At java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
At java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
At java.base/java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:652)
At edu.umd.cs.findbugs.detect.ThrowingExceptions.parentThrows(ThrowingExceptions.java:135)
At edu.umd.cs.findbugs.detect.ThrowingExceptions.visit(ThrowingExceptions.java:70)
At edu.umd.cs.findbugs.visitclass.BetterVisitor.visitMethod(BetterVisitor.java:351)
At org.apache.bcel.classfile.Method.accept(Method.java:115)
At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:320)
At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:405)
At org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:249)
At edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38)
At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
At edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$1(FindBugs2.java:1100)
At java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
At edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
At java.base/java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:247)
At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1110)
At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:399)
At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1223)

The signature of the method is:

public void execute(Map<String, List<String>> parameters, PrintWriter output) throws Exception {...},

and it appears that the parser is complaining about the Map<String, List<String>> construct in the first parameter.

This file was able to be parsed in 4.8.6 without any errors being surfaced.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions