default method in generic interface
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Applies to version 5.1
I reported my problem in https://sourceforge.net/p/proguard/bugs/537/#62a5. I tested it with new ProGuard 5.1 and it seems, that the bug still exists.
Java 1.8.20, Win7.
I override default method in generic interface. ProGuard removes call of that method.
public class J8ProGuardGenerics {
public static void main(String[] args) {
Interface1 o = new J8PG();
System.out.println("before setObjectValue");
//--- this line is not excecuted after obfuscation
//--- workaround: -dontshrink
o.setObjectValue("setObjectValue");
System.out.println("after setObjectValue");
}
public static interface Interface1 {
public void setObjectValue(Object value);
}
public static interface Interface2<Type> extends Interface1 {
void setValue(Type value);
@SuppressWarnings("unchecked")
default public void setObjectValue(Object value) {
setValue((Type)value);
}
}
public static class J8PG implements Interface2<String> {
@Override
public void setValue(String value) {
System.out.println(value);
}
}
}
Output without obfuscation:
before setObjectValue
setObjectValue
after setObjectValue
Output with obfuscation:
before setObjectValue
after setObjectValue
Regards
Adam
Thanks for your report. This bug has been solved in ProGuard 5.2 beta1.
I confirm bug is fixed. Thanks for your great work.