You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building against an obfuscated library (providing its mapping file using -applymapping), I have noticed that lambda expressions which represent an implementation of an interface do not get obfuscated correctly when that interface is part of the obfuscated library.
At runtime this produces an AbstractMethodError because the interface's single member method was renamed, but the lambda instance still has the unobfuscated method name.
Steps to Reproduce
The idea is to build an obfuscated library defining an interface and an application defining a lambda
Now when we run this, we get an AbstractMethodError and see that the method defined on the passed object is still called doSomething:
$ java -cp lib_stripped.jar:app_stripped.jar Main
methods:
public void Main$$Lambda/0x000071a1e8001800.doSomething(int)
Exception in thread "main" java.lang.AbstractMethodError: Receiver class Main$$Lambda/0x000071a1e8001800 does not define or inherit an implementation of the resolved method 'abstract void a(int)' of interface a.
at b.a(Unknown Source)
at Main.main(Unknown Source)
Additional context
If you run with the unobfuscated jars, you get the expected output:
$ java -cp lib.jar:app.jar Main
methods:
public void Main$$Lambda/0x00007baadc001800.doSomething(int)
101
The text was updated successfully, but these errors were encountered:
patrick96
changed the title
AbstractMethodError at runtime when lambda expression is passed as an instance of an interface defined in obfuscated library
Method of lambda expression passed as an instance of an interface defined in obfuscated library is not obfuscated correclty
May 22, 2024
When building against an obfuscated library (providing its mapping file using
-applymapping
), I have noticed that lambda expressions which represent an implementation of an interface do not get obfuscated correctly when that interface is part of the obfuscated library.At runtime this produces an
AbstractMethodError
because the interface's single member method was renamed, but the lambda instance still has the unobfuscated method name.Steps to Reproduce
The idea is to build an obfuscated library defining an interface and an application defining a lambda
lib_stripped.jar
Interface.java
Lib.java
lib.pro
To build
lib_stripped.jar
:app_stripped.jar
Main.java
app.pro
To build
app_stripped.jar
:Now when we run this, we get an AbstractMethodError and see that the method defined on the passed object is still called
doSomething
:Additional context
If you run with the unobfuscated jars, you get the expected output:
The text was updated successfully, but these errors were encountered: