Store constructor if field annotated

I have the following class.

public class StatusCategory { @JsonProperty("key") private final String m_key = null; public String getKey() { return(m_key); } } 

What is the -keep option, which ensures that the constructor will not be removed by Proguard?

The following will save the constructor; however, I do not want to specify every single class or package.

 -keep class oracle.psr.ndr.jira.api.StatusCategory {<init>;} 
+5
source share
1 answer

Annotate the constructor using @JsonCreator and use -keepclassmembers as follows:

 -keepclassmembers public class * { @com.fasterxml.jackson.annotation.JsonCreator *; } 
+2
source

All Articles