#530 Method must be overridden in [proguard.optimize.DuplicateInitializerInvocationFixer] if ever called

v5.0
closed-fixed
optimize (1)
7
2015-01-23
2014-06-25
Axel Dörfler
No

After making the switch from Java 7 to Java 8, and from proguard 4.9 to 5.0beta2, I can no longer optimize my project due to the error mentioned in the title.

I did not find a way to get the actual exception stack, if you like to enlighten me :-)

The maybe relevant program output looks like this:

      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 3 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 4 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 11 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Ignoring unused library classes...
  Original number of library classes: 44120
  Final number of library classes:    44120
Printing kept classes, fields, and methods...
Shrinking...
Removing unused program classes and class elements...
  Original number of program classes: 4692
  Final number of program classes:    4163
Inlining subroutines...
Optimizing...
Method must be overridden in [proguard.optimize.DuplicateInitializerInvocationFixer] if ever called~~~~

Discussion

  • Eric Lafortune
    Eric Lafortune
    2014-06-25

    Thanks for your report. Could you add the flag -verbose and provide the complete stack trace that ProGuard prints out?

     
  • Axel Dörfler
    Axel Dörfler
    2014-06-25

    Ouch, I only tried the -verbose option in the UI, and that one doesn't show the stack trace (as that one works nicer than the Windows console when testing out options...).

    Anyway, here it is:

     [java] Ignoring unused library classes...
     [java]   Original number of library classes: 44120
     [java]   Final number of library classes:    44120
     [java] Printing kept classes, fields, and methods...
     [java] Shrinking...
     [java] Removing unused program classes and class elements...
     [java]   Original number of program classes: 4697
     [java]   Final number of program classes:    4697
     [java] Inlining subroutines...
     [java] Optimizing...
     [java] java.lang.UnsupportedOperationException: Method must be overridden in [proguard.optimize.DuplicateInitializerInvocationFixer] if ever called
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyConstant(SimplifiedVisitor.java:121)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyRefConstant(SimplifiedVisitor.java:178)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyMethodrefConstant(SimplifiedVisitor.java:193)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitInterfaceMethodrefConstant(SimplifiedVisitor.java:199)
     [java]     at proguard.classfile.constant.InterfaceMethodrefConstant.accept(InterfaceMethodrefConstant.java:69)
     [java]     at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:453)
     [java]     at proguard.optimize.DuplicateInitializerInvocationFixer.visitConstantInstruction(DuplicateInitializerInvocationFixer.java:106)
     [java]     at proguard.classfile.instruction.ConstantInstruction.accept(ConstantInstruction.java:157)
     [java]     at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:138)
     [java]     at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:110)
     [java]     at proguard.optimize.DuplicateInitializerInvocationFixer.visitCodeAttribute(DuplicateInitializerInvocationFixer.java:87)
     [java]     at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
     [java]     at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
     [java]     at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:92)
     [java]     at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
     [java]     at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
     [java]     at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
     [java]     at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
     [java]     at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
     [java]     at proguard.optimize.Optimizer.execute(Optimizer.java:604)
     [java]     at proguard.ProGuard.optimize(ProGuard.java:317)
     [java]     at proguard.ProGuard.execute(ProGuard.java:126)
     [java]     at proguard.ProGuard.main(ProGuard.java:507)
    

    BTW there is no 1.8 target option yet.

     
  • Eric Lafortune
    Eric Lafortune
    2014-08-05

    This bug has now been fixed for the upcoming ProGuard 5.0 beta3.

     
  • Eric Lafortune
    Eric Lafortune
    2014-08-05

    • status: open --> open-fixed
    • assigned_to: Eric Lafortune
    • Priority: 5 --> 7
     
  • Axel Dörfler
    Axel Dörfler
    2014-08-06

    Great, thanks!

     
  • Eric Lafortune
    Eric Lafortune
    2014-08-19

    • Status: open-fixed --> closed-fixed
     
  • Axel Dörfler
    Axel Dörfler
    2014-08-20

    I still have the same issue with Proguard 5.0.

     [java] java.lang.UnsupportedOperationException: Method must be overridden in [proguard.optimize.DuplicateInitializerInvocationFixer] if ever called
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyConstant(SimplifiedVisitor.java:121)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyRefConstant(SimplifiedVisitor.java:178)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitAnyMethodrefConstant(SimplifiedVisitor.java:193)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitInterfaceMethodrefConstant(SimplifiedVisitor.java:199)
     [java]     at proguard.classfile.constant.InterfaceMethodrefConstant.accept(InterfaceMethodrefConstant.java:69)
     [java]     at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:453)
     [java]     at proguard.optimize.DuplicateInitializerInvocationFixer.visitConstantInstruction(DuplicateInitializerInvocationFixer.java:106)
     [java]     at proguard.classfile.instruction.ConstantInstruction.accept(ConstantInstruction.java:157)
     [java]     at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:138)
     [java]     at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:110)
     [java]     at proguard.optimize.DuplicateInitializerInvocationFixer.visitCodeAttribute(DuplicateInitializerInvocationFixer.java:87)
     [java]     at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
     [java]     at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
     [java]     at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
     [java]     at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:92)
     [java]     at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
     [java]     at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504)
     [java]     at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
     [java]     at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
     [java]     at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
     [java]     at proguard.optimize.Optimizer.execute(Optimizer.java:604)
     [java]     at proguard.ProGuard.optimize(ProGuard.java:317)
     [java]     at proguard.ProGuard.execute(ProGuard.java:126)
     [java]     at proguard.ProGuard.main(ProGuard.java:507)
    
     
  • Eric Lafortune
    Eric Lafortune
    2014-08-20

    Ouch, you're right. I had fixed it, but then accidentally re-introduced the bug later on. My test suite doesn't have an example to reproduce it, so it got through.

    You should be able to fix the problem by replacing line 134 in proguard/optimize/DuplicateInitializerInvocationFixer.java:

    public void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
    

    by

    public void visitAnyMethodrefConstant(Clazz clazz, RefConstant methodrefConstant)
    

    I'll fix it for the next update.

     
  • Eric Lafortune
    Eric Lafortune
    2014-08-20

    • status: closed-fixed --> open-accepted
     
  • Axel Dörfler
    Axel Dörfler
    2014-08-20

    Thanks! At least it's a good incentive to extend your test suite :-)

     
  • Eric Lafortune
    Eric Lafortune
    2014-10-27

    • Status: open-accepted --> closed-fixed