Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any option include Java Generics Type in proguard prop file

Tags:

java

proguard

I have a configuration class in spring boot project. It has the List of Tenant object class member in that class. I don't find the 'private List<Tenant> tenant' after obfuscating the class using Proguard.

How to configure in proguard configuration file to get an expected result?

<b>Code</b>

public class MTConfig {

  private List<Tenant> tenant;

  .....

}

Verifying the class file after obfuscation using proguard;

<u><i>Actual Result :</i></u>

public class MTConfig {

  private List tenant;

  .....

}

<b>Expected Result:</b>

"
public class MTConfig {

  private List<Tenant> tenant;

  .....

}
"
like image 533
arm Avatar asked Nov 19 '25 02:11

arm


1 Answers

put this in your progurad.conf file

-keepclassmembers class com.yourproject.MTConfig** {
    private java.util.List<com.yourprojectPath.Tenant> tenant;
 }

and use

-keepattributes Signature

The "Signature" attribute is required to be able to access generic types when compiling in JDK 5.0 and higher.

like image 146
Khalid Shah Avatar answered Nov 21 '25 19:11

Khalid Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!