Home | History | Annotate | Download | only in annotations
      1 #
      2 # This ProGuard configuration file illustrates how to use annotations for
      3 # specifying which classes and class members should be kept.
      4 # Usage:
      5 #     java -jar proguard.jar @examples.pro
      6 #
      7 
      8 # Specify the input, output, and library jars.
      9 # This is assuming the code has been compiled in the examples directory.
     10 
     11 #-injars  examples(*.class)
     12 -injars  classes(*.class)
     13 -outjars out
     14 
     15 -libraryjars <java.home>/lib/rt.jar
     16 
     17 # Some important configuration is based on the annotations in the code.
     18 # We have to specify what the annotations mean to ProGuard.
     19 
     20 -include lib/annotations.pro
     21 
     22 #
     23 # We can then still add any other options that might be useful.
     24 #
     25 
     26 # Print out a list of what we're preserving.
     27 
     28 -printseeds
     29 
     30 # Preserve all annotations themselves.
     31 
     32 -keepattributes *Annotation*
     33 
     34 # Preserve all native method names and the names of their classes.
     35 
     36 -keepclasseswithmembernames class * {
     37     native <methods>;
     38 }
     39 
     40 # Preserve the special static methods that are required in all enumeration
     41 # classes.
     42 
     43 -keepclassmembers class * extends java.lang.Enum {
     44     public static **[] values();
     45     public static ** valueOf(java.lang.String);
     46 }
     47 
     48 # Explicitly preserve all serialization members. The Serializable interface
     49 # is only a marker interface, so it wouldn't save them.
     50 # You can comment this out if your application doesn't use serialization.
     51 # If your code contains serializable classes that have to be backward 
     52 # compatible, please refer to the manual.
     53 
     54 -keepclassmembers class * implements java.io.Serializable {
     55     static final long serialVersionUID;
     56     static final java.io.ObjectStreamField[] serialPersistentFields;
     57     private void writeObject(java.io.ObjectOutputStream);
     58     private void readObject(java.io.ObjectInputStream);
     59     java.lang.Object writeReplace();
     60     java.lang.Object readResolve();
     61 }
     62