I use the version 5.2.1. The follow call to a super interface default method:
@Override
public default <T> T unwrap( Class<T> clazz ) {
return Bar.super.unwrap( clazz );
}
will result in follow bad code which produce a StackOverFlowException:
@Override
public default <T> T unwrap( Class<T> clazz ) {
return unwrap( clazz );
}
With the javap disambler it look like:
// before ProGuard
public <t extends="" java="" lang="" object=""> T unwrap(java.lang.Class<t>);
Code:
0: aload_0
1: aload_1
2: invokespecial #1 // InterfaceMethod foo/Bar.unwrap:(Ljava/lang/Class;)Ljava/lang/Object;
5: areturn</t></t>
// after ProGuard
public <t extends="" java="" lang="" object=""> T unwrap(java.lang.Class<t>);
Code:
0: aload_0
1: aload_1
2: invokeinterface #4, 2 // InterfaceMethod foo/Bar.unwrap:(Ljava/lang/Class;)Ljava/lang/Object;
7: areturn</t></t>
A workaround is the option:
-dontoptimize
Thanks for your report. I can't seem to reproduce the issue yet (with a hierarchy of a class, a first interface, and a second interface). Can you provide the complete sample?
Attached is a full sample with original compiled classes and obfuscated classes.
Thanks for the sample. I can see how your processed code is incorrect, but I get correct code with ProGuard 5.2.1 and the following configuration:
What configuration are you using?
We use a mix of gradle properties and file settings. in gradle we set:
configuration, printseeds, printmapping, printusage, keepparameternames,
renamesourcefileattribute "SourceFile"
keepattributes "Exceptions,InnerClasses,Deprecated,SourceFile,Signature,Annotation,LineNumberTable,EnclosingMethod"
keeppackagenames "com.inet.**"
In the configuration file we set:
-dontusemixedcaseclassnames
-keep @com.inet.annotations.PublicApi class * { public *; }
And a long list of other keep settings.
Hello,
I think i have similar problem. This is my code:
and it gets obfuscated to this:
notice the call to the
superdefaultmethod is replaced tothismethod.How can I add make it work?
And I confirm that adding
-dontoptimizeworks, but is this the real solution, or just a workaround?