Menu

#499 static boolean problem with optimize

v4.11
open-works-for-me
None
6
2014-09-23
2014-03-03
No

Under the version 4.11, I got following errors.

[proguard] Unexpected error while shrinking instructions after partial evaluation:
[proguard] Class = [com/sun/lwuit/util/UIBuilder2]
[proguard] Method = [createComponent(Ljava/io/DataInputStream;Lcom/sun/lwuit/Container;Lcom/sun/lwuit/Container;Lcom/sun/lwuit/util/Resources;Ljava/util/Hashtable;Lcom/sun/lwuit/util/EmbeddedContainer;)Lcom/sun/lwuit/Component;]
[proguard] Exception = [java.lang.NullPointerException] (null)
[proguard] Not optimizing this method
[proguard] Unexpected error while performing partial evaluation:
[proguard] Class = [com/sun/lwuit/util/UIBuilder2]
[proguard] Method = [createComponent(Ljava/io/DataInputStream;Lcom/sun/lwuit/Container;Lcom/sun/lwuit/Container;Lcom/sun/lwuit/util/Resources;Ljava/util/Hashtable;Lcom/sun/lwuit/util/EmbeddedContainer;)Lcom/sun/lwuit/Component;]
[proguard] Exception = [java.lang.IllegalArgumentException] (Stacks have different current sizes [2] and [8])

BUILD FAILED
build.xml:282: java.lang.IllegalArgumentException: Stacks have different current sizes [2] and [8]
at proguard.evaluation.Stack.generalize(Stack.java:125)
at proguard.evaluation.TracedStack.generalize(TracedStack.java:148)
at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:683)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:602)
at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:560)
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:124)
at proguard.optimize.Optimizer.execute(Optimizer.java:926)
at proguard.ProGuard.optimize(ProGuard.java:306)
at proguard.ProGuard.execute(ProGuard.java:115)
at proguard.ant.ProGuardTask.execute(ProGuardTask.java:316)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

In my code,
I have a condition clause with static boolean like the below

static boolean flag;

if (!flag) {
blahblah
} else {
blahblah
}

Of course, else phrase won't run due to the uninitialized boolean variable.
This code is a part of LWUIT, and I got solution with following way.

private static boolean getFlag() {
return flag;
}

~~~

if (!getFlag()) {
blahblah
} else {
blahblah
}

I think it should be fixed.

Thanks
Kyoungwon Lee

Discussion

  • Eric Lafortune

    Eric Lafortune - 2014-04-19

    Thanks for your report. I can't seem to reproduce the problem with the LWUIT library or with the small code snippet that you provide. Do you have a complete sample that shows the problem?

     
  • Eric Lafortune

    Eric Lafortune - 2014-04-19
    • status: open --> open-works-for-me
    • assigned_to: Eric Lafortune
    • Priority: 5 --> 6
     

Log in to post a comment.