Skip to content
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

IllegalArgumentException in OpcodeStack.constantToInt #125

Closed
ghost opened this issue Sep 16, 2016 · 10 comments
Closed

IllegalArgumentException in OpcodeStack.constantToInt #125

ghost opened this issue Sep 16, 2016 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 16, 2016

Using findbugs-3.0.1, we run into the following situation during analysis:
[findbugs] Executing findbugs FindBugsTask from ant task [findbugs] Running FindBugs... [findbugs] The following errors occurred during analysis: [findbugs] Error processing2 < I, 1 >iadd< Ljava/lang/String;, "", r4 > @ 706 in workflow.fileupload.swift.mt101.Mt101MultibankingWorkflowTest.testMultibankingOkWithMultipleASeqs : ()V [findbugs] java.lang.IllegalArgumentException: [findbugs] At edu.umd.cs.findbugs.OpcodeStack.constantToInt(OpcodeStack.java:2179) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.pushByIntMath(OpcodeStack.java:3198) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.sawOpcode(OpcodeStack.java:1644) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory$JumpStackComputation.sawOpcode(OpcodeStack.java:2846) [findbugs] At edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:883) [findbugs] At edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:218) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:235) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory$JumpStackComputation.visitCode(OpcodeStack.java:2832) [findbugs] At org.apache.bcel.classfile.Code.accept(Code.java:135) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:307) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.computeJumpInfo(OpcodeStack.java:2876) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2806) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2789) [findbugs] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:369) [findbugs] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:322) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.getJumpInfo(OpcodeStack.java:3007) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.resetForMethodEntry(OpcodeStack.java:2978) [findbugs] At edu.umd.cs.findbugs.bcel.OpcodeStackDetector.visitCode(OpcodeStackDetector.java:62) [findbugs] At org.apache.bcel.classfile.Code.accept(Code.java:135) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:307) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:395) [findbugs] At org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:215) [findbugs] At edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38) [findbugs] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76) [findbugs] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1089) [findbugs] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:283) [findbugs] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:402) [findbugs] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1200) [findbugs] Error processing2 < I, 1 >iadd< Ljava/lang/String;, "", r4 > @ 706 in workflow.fileupload.swift.mt101.Mt101MultibankingWorkflowTest.testMultibankingOkWithMultipleASeqs : ()V [findbugs] java.lang.IllegalArgumentException: [findbugs] At edu.umd.cs.findbugs.OpcodeStack.constantToInt(OpcodeStack.java:2179) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.pushByIntMath(OpcodeStack.java:3198) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.sawOpcode(OpcodeStack.java:1644) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory$JumpStackComputation.sawOpcode(OpcodeStack.java:2846) [findbugs] At edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:883) [findbugs] At edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:218) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:235) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory$JumpStackComputation.visitCode(OpcodeStack.java:2832) [findbugs] At org.apache.bcel.classfile.Code.accept(Code.java:135) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:307) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.computeJumpInfo(OpcodeStack.java:2876) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2806) [findbugs] At edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory.analyze(OpcodeStack.java:2789) [findbugs] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:369) [findbugs] At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:322) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.getJumpInfo(OpcodeStack.java:3007) [findbugs] At edu.umd.cs.findbugs.OpcodeStack.resetForMethodEntry(OpcodeStack.java:2978) [findbugs] At edu.umd.cs.findbugs.bcel.OpcodeStackDetector.visitCode(OpcodeStackDetector.java:62) [findbugs] At org.apache.bcel.classfile.Code.accept(Code.java:135) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:307) [findbugs] At edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:395) [findbugs] At org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:215) [findbugs] At edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38) [findbugs] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76) [findbugs] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1089) [findbugs] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:283) [findbugs] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:402) [findbugs] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1200) [findbugs] [findbugs] Calculating exit code... [findbugs] Exit code set to: 0

@iloveeclipse
Copy link
Member

Please provide more context (Java version used to run FB, which JLS compilation level was used for Mt101MultibankingWorkflowTest etc), and please test first with the latest snapshot from https://github.com/findbugsproject/findbugs/releases/tag/3.1.0_preview2.

@ghost
Copy link
Author

ghost commented Sep 16, 2016

Thank you for the quick response.
We have a JDK 1.7 build environment, but for trying out the latest FB snapshot I temporarily switched this to JDK 1.8.0u102, which is now used as well for compilation as for running FB. The Exception still occurs, with slightly different line numbers in the stack trace.
The class under analysis is compiled with javac options -target 1.7 -g:source,lines,vars -Xlint:-deprecation -source 1.7

@iloveeclipse
Copy link
Member

Can you please attach the stack trace from the FB snapshot and also strip down the code from Mt101MultibankingWorkflowTest.testMultibankingOkWithMultipleASeqs() to a single reproducible test case?

@ghost
Copy link
Author

ghost commented Sep 16, 2016

Attached the new stack trace. As to stripping down the code, I have not yet succeeded to isolate the problem. However, the code makes use of anonymous code blocks to restrict variable scope and removing these is a way to avoid the exception, at the cost of changing the semantics of the method (as now variables are reused instead of redefined).
stacktrace_dev.txt

@ghost
Copy link
Author

ghost commented Sep 19, 2016

This is what appears to be a minimal test case.
FbTest.java.txt

@ghost
Copy link
Author

ghost commented Sep 29, 2016

I am wondering, iloveeclipse, whether you have had time to look into the issue? Is this at all the right place for bug reports or should I go to https://sourceforge.net/p/findbugs/bugs?

@iloveeclipse
Copy link
Member

This is the right place, but I'm the wrong owner for this :-)

@ghost
Copy link
Author

ghost commented Oct 17, 2016

Can I do anything to address the issue to the right owner? The problem still persists in our production environment.

@iloveeclipse
Copy link
Member

Currently there seem to be no interested developers in FB team working on this issue. If you want to get this bug fixed, you have to debug & understand FB code by yourself. Any patches are welcome of course :-)

@iloveeclipse
Copy link
Member

This project continues development in a new home: https://github.com/spotbugs/spotbugs/

Please do not open new issues here anymore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant