Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proguard: IllegalArgumentException: Stacks have different current sizes

Proguard is crashing with "Proguard returned with error code 1", and this crash in the console:

java.lang.IllegalArgumentException: Stacks have different current sizes [0] and [1]
at proguard.evaluation.Stack.generalize(Stack.java:125)
at proguard.evaluation.TracedStack.generalize(TracedStack.java:140)
at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:683)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:587)
at proguard.optimize.evaluation.PartialEvaluator.visitExceptionInfo(PartialEvaluator.java:1078)
at proguard.classfile.visitor.ExceptionHandlerFilter.visitExceptionInfo(ExceptionHandlerFilter.java:67)
at proguard.classfile.attribute.CodeAttribute.exceptionsAccept(CodeAttribute.java:186)
at proguard.optimize.evaluation.PartialEvaluator.evaluateExceptionHandlers(PartialEvaluator.java:1018)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:567)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:264)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181)
at proguard.optimize.evaluation.LivenessAnalyzer.visitCodeAttribute(LivenessAnalyzer.java:205)
at proguard.optimize.evaluation.VariableOptimizer.visitCodeAttribute(VariableOptimizer.java:105)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
at proguard.classfile.ClassPool.classesAccept(ClassPool.java:116)
at proguard.optimize.Optimizer.execute(Optimizer.java:833)
at proguard.ProGuard.optimize(ProGuard.java:306)
at proguard.ProGuard.execute(ProGuard.java:115)
at proguard.ProGuard.main(ProGuard.java:492)

I have narrowed it down to a try catch block for an IOException. If I comment out that try catch block then it shows this error for another IOException try catch block elsewhere in the app. If I comment that one out, then it successfully builds.

So in both places proguard seems to be crashing on an IOException try catch block. These blocks have been in the code in previous builds that went through proguard without any trouble before.

Also, there are other IOException catch blocks that don't give any errors.

I tried this with proguard 4.5, 4.6, and 4.7 and all failed.

Any ideas?

Thanks

like image 427
cottonBallPaws Avatar asked Feb 14 '12 18:02

cottonBallPaws


1 Answers

This appears to be a bug in ProGuard. You can log it on ProGuard's bug tracker, preferably with a small test case that allows me to reproduce the problem, or you can mail it to me (Eric, developer of ProGuard).

For the time being, you can work around the problem by switching off optimization (with the option -dontoptimize).

like image 143
Eric Lafortune Avatar answered Oct 21 '22 05:10

Eric Lafortune