Menu ▾ ▴

#413 Overloading aggressively without -overloadaggressively

v4.6
closed-invalid
7
2011-08-27
2011-08-26
No

I do not specify the option -overloadaggressively but Proguard is overloading classes. Here is an example, where methods getText, putMetadata get the same name 'a':
com.google.zxing.Result -> a.b.a.l:
java.lang.String text -> a
byte[] rawBytes -> b
com.google.zxing.ResultPoint[] resultPoints -> c
com.google.zxing.BarcodeFormat format -> d
java.util.Hashtable resultMetadata -> e
java.lang.String getText() -> a
byte[] getRawBytes() -> b
com.google.zxing.ResultPoint[] getResultPoints() -> c
com.google.zxing.BarcodeFormat getBarcodeFormat() -> d
java.util.Hashtable getResultMetadata() -> e
void putMetadata(com.google.zxing.ResultMetadataType,java.lang.Object) -> a
java.lang.String toString() -> toString

Discussion

  • Marek Urbaniak

    Marek Urbaniak - 2011-08-26
    • priority: 5 --> 7
     
  • Marek Urbaniak

    Marek Urbaniak - 2011-08-26

    This bug is quite severe because it is hard to reproduce stack traces because they do not have parameter list next to a method name.

     
  • Eric Lafortune

    Eric Lafortune - 2011-08-27
    • assigned_to: nobody --> lafortune
    • status: open --> closed-invalid
     
  • Eric Lafortune

    Eric Lafortune - 2011-08-27

    This kind of method name overloading is standard; it is even allowed in the java language. E.g., System.getProperty has two overloaded versions. ProGuard can't solve this for you. You can reduce the effect with -useuniqueclassmembernames. You can get proper stack traces by preserving line numbers, as explained in the ProGuard manual > Examples > Producing useful stack traces.

     
  • Marek Urbaniak

    Marek Urbaniak - 2011-08-29

    Thanks Eric for the explanation :) However, I do not think it is an intuitive name for the option ("useuniqueclassmembernames") - a method is not a member. I would expect something like dontoverload which would be consistent with other Proguard's options.

     
  • Eric Lafortune

    Eric Lafortune - 2011-08-29

    -useuniqueclassmembernames does more than not overloading method names in classes: it makes sure all unique class member names remain unique (irrespective of any possible overloading, although that is a major side-effect).

    Fields and methods are called class members (cfr. JM specs).

     
  • Marek Urbaniak

    Marek Urbaniak - 2011-09-05

    It makes sense, thank you very much, Eric, for the explanation and for your great work connected with Proguard :)

     

Log in to post a comment.