spotbugs / spotbugs

SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.

Home Page:https://spotbugs.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DataflowAnalysisException in 4.7.3 and 4.8.3

myaponchik opened this issue · comments

I have the Exception by scanning with Ant:

[spotbugs] edu.umd.cs.findbugs.ba.DataflowAnalysisException: not enough values on stack: access=1, avail=0
[spotbugs] At edu.umd.cs.findbugs.ba.Frame.getStackLocation(Frame.java:266)
[spotbugs] At edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefAnalysis.checkUnconditionalDerefDatabase(UnconditionalValueDerefAnalysis.java:416)
[spotbugs] At edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefAnalysis.checkAllNonNullParams(UnconditionalValueDerefAnalysis.java:529)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueFrameModelingVisitor.handleInvoke(IsNullValueFrameModelingVisitor.java:188)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueFrameModelingVisitor.visitINVOKESPECIAL(IsNullValueFrameModelingVisitor.java:513)
[spotbugs] At org.apache.bcel.generic.INVOKESPECIAL.accept(INVOKESPECIAL.java:64)
[spotbugs] At edu.umd.cs.findbugs.ba.AbstractFrameModelingVisitor.analyzeInstruction(AbstractFrameModelingVisitor.java:84)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueFrameModelingVisitor.analyzeInstruction(IsNullValueFrameModelingVisitor.java:106)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueAnalysis.transferInstruction(IsNullValueAnalysis.java:336)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueAnalysis.transferInstruction(IsNullValueAnalysis.java:73)
[spotbugs] At edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis.transfer(AbstractDataflowAnalysis.java:136)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueAnalysis.transfer(IsNullValueAnalysis.java:280)
[spotbugs] At edu.umd.cs.findbugs.ba.npe.IsNullValueAnalysis.transfer(IsNullValueAnalysis.java:73)
[spotbugs] At edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis.getFactAtLocation(AbstractDataflowAnalysis.java:84)
[spotbugs] At edu.umd.cs.findbugs.ba.Dataflow.getFactAtLocation(Dataflow.java:503)
[spotbugs] At edu.umd.cs.findbugs.detect.LoadOfKnownNullValue.analyzeMethod(LoadOfKnownNullValue.java:129)
[spotbugs] At edu.umd.cs.findbugs.detect.LoadOfKnownNullValue.visitClassContext(LoadOfKnownNullValue.java:62)
[spotbugs] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$1(FindBugs2.java:1108)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2$$Lambda$119/0x0000000000000000.call(Unknown Source)
[spotbugs] At java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[spotbugs] At edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
[spotbugs] At java.base/java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:242)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
[spotbugs] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
[spotbugs] Error analyzing public static void main(String[] args) (class: de.hl.bps.sts.maschrefiverkaufandritteendgsetzen.MaschReFiVerkaufAnDritteEndgSetzenStarter)
[spotbugs] edu.umd.cs.findbugs.ba.DataflowAnalysisException: Accessing TOP or BOTTOM frame!
[spotbugs] At edu.umd.cs.findbugs.ba.Frame.getStackValue(Frame.java:243)
[spotbugs] At edu.umd.cs.findbugs.detect.FindUselessObjects$UselessValuesContext.initObservedValues(FindUselessObjects.java:144)
[spotbugs] At edu.umd.cs.findbugs.detect.FindUselessObjects.analyzeMethod(FindUselessObjects.java:461)
[spotbugs] At edu.umd.cs.findbugs.detect.FindUselessObjects.visitClassContext(FindUselessObjects.java:451)
[spotbugs] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$1(FindBugs2.java:1108)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2$$Lambda$119/0x0000000000000000.call(Unknown Source)
[spotbugs] At java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[spotbugs] At edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
[spotbugs] At java.base/java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:242)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
[spotbugs] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
[spotbugs] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

Thanks for reporting this and thanks for the code!
Would you be able to share the compiled .class triggering the problem? SpotBugs works by analysing the compiled bytecode (not the source) and the code shared above refers to many other java classes so compiling it would be complicated

.class, sure, my mistake. Is attached.

MaschReFiVerkaufAnDritteAufteilenStarter.gz

No problem and thank you! I tried analysing the .class file but it does not seem to reproduce the error.
May I ask how you know that this particular class is causing the problem? Unless I'm missing something the error message does not say what .class file it was analysing when it crashed

Edit: Ah now I see it: [spotbugs] Error analyzing public static void main(String[] args) (class: de.hl.bps.sts.maschrefiverkaufandritteendgsetzen.MaschReFiVerkaufAnDritteEndgSetzenStarter)

Yes, the main method is a problem.