Menu ▾ ▴

#175 Remove constant pool entries introduced in Java 8

v5.0
closed
nobody
None
5
2019-05-16
2016-01-11
Maik
No

Starting with Java 8 Oracle created constant pool entries for classes with already inlined constants even though this class it not referenced at runtime by the compiled class. This behavior is intentional to support compile-time dependency analysis using class files.

The disadvantage is, that the resulting classes are larger because of these entries and one can get more information about the application. The biggest disadvantage for us is, that these classes (because they are not referenced at runtime) are not available during obfuscation. Therefore we get hundreds of "can't find referenced class" warnings and the obfuscation fails.

Discussion

  • Eric Lafortune

    Eric Lafortune - 2016-01-11

    Thanks for the report; I wasn't aware of such constants. ProGuard tries to resolve all references though, whether they are really used or not. If the referenced classes are present in the input (-injars or -libraryjars), you shouldn't get these warnings. At a later stage, ProGuard removes the unused constants. Do you have a different scenario? Can you provide a small sample project?

    You can specify -dontwarn to avoid the problem.

    Eric

     
  • Maik

    Maik - 2016-01-18

    Hi Eric, thanks for your reply. In our scenario the referenced classes are available only during compile time as we are working for an embedded system and size matters. At the moment we are evaluating if we can move to Java 8, but as long as this problem exists, the answer is no.

    I put a little maven project together to reproduce the problem. Compile it with Java 6 and Java 8 and see the differences in de\yasc\a\ClassA.class. Two precompiled classes, one compiled with Java 6 and one compiled with Java 8 were also included in the zip. See de\yasc\a\ClassA.class.Java6 and de\yasc\a\ClassA.class.Java8.

    It would be great if you can have a look. The sooner, the better. :)

    Thanks in advance!

    Maik

     
  • Eric Lafortune

    Eric Lafortune - 2019-05-16
    • Status: open --> closed
     

Log in to post a comment.