diff options
Diffstat (limited to 'examples/annotations')
20 files changed, 0 insertions, 566 deletions
diff --git a/examples/annotations/examples.pro b/examples/annotations/examples.pro deleted file mode 100644 index d2b212c..0000000 --- a/examples/annotations/examples.pro +++ /dev/null @@ -1,60 +0,0 @@ -# -# This ProGuard configuration file illustrates how to use annotations for -# specifying which classes and class members should be kept. -# Usage: -# java -jar proguard.jar @examples.pro -# - -# Specify the input, output, and library jars. -# This is assuming the code has been compiled in the examples directory. - --injars examples(*.class) --outjars out - --libraryjars <java.home>/lib/rt.jar - -# Some important configuration is based on the annotations in the code. -# We have to specify what the annotations mean to ProGuard. - --include lib/annotations.pro - -# -# We can then still add any other options that might be useful. -# - -# Print out a list of what we're preserving. - --printseeds - -# Preserve all annotations themselves. - --keepattributes *Annotation* - -# Preserve all native method names and the names of their classes. - --keepclasseswithmembernames,includedescriptorclasses class * { - native <methods>; -} - -# Preserve the special static methods that are required in all enumeration -# classes. - --keepclassmembers,allowoptimization enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - -# Explicitly preserve all serialization members. The Serializable interface -# is only a marker interface, so it wouldn't save them. -# You can comment this out if your application doesn't use serialization. -# If your code contains serializable classes that have to be backward -# compatible, please refer to the manual. - --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; - static final java.io.ObjectStreamField[] serialPersistentFields; - private void writeObject(java.io.ObjectOutputStream); - private void readObject(java.io.ObjectInputStream); - java.lang.Object writeReplace(); - java.lang.Object readResolve(); -} diff --git a/examples/annotations/examples/Applet.java b/examples/annotations/examples/Applet.java deleted file mode 100644 index e5b7acc..0000000 --- a/examples/annotations/examples/Applet.java +++ /dev/null @@ -1,23 +0,0 @@ -import proguard.annotation.*; - -/** - * This applet illustrates the use of annotations for configuring ProGuard. - * - * You can compile it with: - * javac -classpath ../lib/annotations.jar Applet.java - * You can then process it with: - * java -jar ../../../lib/proguard.jar @ ../examples.pro - * - * The annotation will preserve the class and its essential methods, - * as a result of the specifications in lib/annotations.pro. - */ -@Keep -public class Applet extends java.applet.Applet -{ - // Implementations for Applet. - - public void init() - { - // ... - } -} diff --git a/examples/annotations/examples/Application.java b/examples/annotations/examples/Application.java deleted file mode 100644 index 777d286..0000000 --- a/examples/annotations/examples/Application.java +++ /dev/null @@ -1,21 +0,0 @@ -import proguard.annotation.KeepApplication; - -/** - * This application illustrates the use of annotations for configuring ProGuard. - * - * You can compile it with: - * javac -classpath ../lib/annotations.jar Application.java - * You can then process it with: - * java -jar ../../../lib/proguard.jar @ ../examples.pro - * - * The annotation will preserve the class and its main method, - * as a result of the specifications in lib/annotations.pro. - */ -@KeepApplication -public class Application -{ - public static void main(String[] args) - { - System.out.println("The answer is 42"); - } -} diff --git a/examples/annotations/examples/Bean.java b/examples/annotations/examples/Bean.java deleted file mode 100644 index aacb501..0000000 --- a/examples/annotations/examples/Bean.java +++ /dev/null @@ -1,57 +0,0 @@ -import proguard.annotation.*; - -/** - * This bean illustrates the use of annotations for configuring ProGuard. - * - * You can compile it with: - * javac -classpath ../lib/annotations.jar Bean.java - * You can then process it with: - * java -jar ../../../lib/proguard.jar @ ../examples.pro - * - * The annotations will preserve the class and its public getters and setters, - * as a result of the specifications in lib/annotations.pro. - */ -@Keep -@KeepPublicGettersSetters -public class Bean -{ - public boolean booleanProperty; - public int intProperty; - public String stringProperty; - - - public boolean isBooleanProperty() - { - return booleanProperty; - } - - - public void setBooleanProperty(boolean booleanProperty) - { - this.booleanProperty = booleanProperty; - } - - - public int getIntProperty() - { - return intProperty; - } - - - public void setIntProperty(int intProperty) - { - this.intProperty = intProperty; - } - - - public String getStringProperty() - { - return stringProperty; - } - - - public void setStringProperty(String stringProperty) - { - this.stringProperty = stringProperty; - } -} diff --git a/examples/annotations/examples/NativeCallBack.java b/examples/annotations/examples/NativeCallBack.java deleted file mode 100644 index a4e5583..0000000 --- a/examples/annotations/examples/NativeCallBack.java +++ /dev/null @@ -1,52 +0,0 @@ -import proguard.annotation.*; - -/** - * This application illustrates the use of annotations for configuring ProGuard. - * - * You can compile it with: - * javac -classpath ../lib/annotations.jar NativeCallBack.java - * You can then process it with: - * java -jar ../../../lib/proguard.jar @ ../examples.pro - * - * The annotation will preserve the class and its main method, - * as a result of the specifications in lib/annotations.pro. - */ -@KeepApplication -public class NativeCallBack -{ - /** - * Suppose this is a native method that computes an answer. - * - * The -keep option for native methods in the regular ProGuard - * configuration will make sure it is not removed or renamed when - * processing this code. - */ - public native int computeAnswer(); - - - /** - * Suppose this method is called back from the above native method. - * - * ProGuard would remove it, because it is not referenced from java. - * The annotation will make sure it is preserved anyhow. - */ - @Keep - public int getAnswer() - { - return 42; - } - - - /** - * The main entry point of the application. - * - * The @KeepApplication annotation of this class will make sure it is not - * removed or renamed when processing this code. - */ - public static void main(String[] args) - { - int answer = new NativeCallBack().computeAnswer(); - - System.out.println("The answer is " + answer); - } -} diff --git a/examples/annotations/lib/annotations.jar b/examples/annotations/lib/annotations.jar Binary files differdeleted file mode 100644 index d931505..0000000 --- a/examples/annotations/lib/annotations.jar +++ /dev/null diff --git a/examples/annotations/lib/annotations.pro b/examples/annotations/lib/annotations.pro deleted file mode 100644 index f704af2..0000000 --- a/examples/annotations/lib/annotations.pro +++ /dev/null @@ -1,118 +0,0 @@ -# -# This ProGuard configuration file specifies how annotations can be used -# to configure the processing of other code. -# Usage: -# java -jar proguard.jar @annotations.pro -libraryjars annotations.jar ... -# -# Note that the other input/output options still have to be specified. -# If you specify them in a separate file, you can simply include this file: -# -include annotations.pro -# -# You can add any other options that are required. For instance, if you are -# processing a library, you can still include the options from library.pro. - - -# The annotations are defined in the accompanying jar. For now, we'll start -# with these. You can always define your own annotations, if necessary. --libraryjars annotations.jar - - -# The following annotations can be specified with classes and with class -# members. - -# @Keep specifies not to shrink, optimize, or obfuscate the annotated class -# or class member as an entry point. - --keep @proguard.annotation.Keep class * - --keepclassmembers class * { - @proguard.annotation.Keep *; -} - - -# @KeepName specifies not to optimize or obfuscate the annotated class or -# class member as an entry point. - --keepnames @proguard.annotation.KeepName class * - --keepclassmembernames class * { - @proguard.annotation.KeepName *; -} - - -# The following annotations can only be specified with classes. - -# @KeepImplementations and @KeepPublicImplementations specify to keep all, -# resp. all public, implementations or extensions of the annotated class as -# entry points. Note the extension of the java-like syntax, adding annotations -# before the (wild-carded) interface name. - --keep class * implements @proguard.annotation.KeepImplementations * --keep public class * implements @proguard.annotation.KeepPublicImplementations * - -# @KeepApplication specifies to keep the annotated class as an application, -# together with its main method. - --keepclasseswithmembers @proguard.annotation.KeepApplication public class * { - public static void main(java.lang.String[]); -} - -# @KeepClassMembers, @KeepPublicClassMembers, and -# @KeepPublicProtectedClassMembers specify to keep all, all public, resp. -# all public or protected, class members of the annotated class from being -# shrunk, optimized, or obfuscated as entry points. - --keepclassmembers @proguard.annotation.KeepClassMembers class * { - *; -} - --keepclassmembers @proguard.annotation.KeepPublicClassMembers class * { - public *; -} - --keepclassmembers @proguard.annotation.KeepPublicProtectedClassMembers class * { - public protected *; -} - -# @KeepClassMemberNames, @KeepPublicClassMemberNames, and -# @KeepPublicProtectedClassMemberNames specify to keep all, all public, resp. -# all public or protected, class members of the annotated class from being -# optimized or obfuscated as entry points. - --keepclassmembernames @proguard.annotation.KeepClassMemberNames class * { - *; -} - --keepclassmembernames @proguard.annotation.KeepPublicClassMemberNames class * { - public *; -} - --keepclassmembernames @proguard.annotation.KeepPublicProtectedClassMemberNames class * { - public protected *; -} - -# @KeepGettersSetters and @KeepPublicGettersSetters specify to keep all, resp. -# all public, getters and setters of the annotated class from being shrunk, -# optimized, or obfuscated as entry points. - --keepclassmembers @proguard.annotation.KeepGettersSetters class * { - void set*(***); - void set*(int, ***); - - boolean is*(); - boolean is*(int); - - *** get*(); - *** get*(int); -} - --keepclassmembers @proguard.annotation.KeepPublicGettersSetters class * { - public void set*(***); - public void set*(int, ***); - - public boolean is*(); - public boolean is*(int); - - public *** get*(); - public *** get*(int); -} diff --git a/examples/annotations/src/proguard/annotation/Keep.java b/examples/annotations/src/proguard/annotation/Keep.java deleted file mode 100644 index 93a469f..0000000 --- a/examples/annotations/src/proguard/annotation/Keep.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies not to optimize or obfuscate the annotated class or - * class member as an entry point. - */ -@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface Keep {} diff --git a/examples/annotations/src/proguard/annotation/KeepApplication.java b/examples/annotations/src/proguard/annotation/KeepApplication.java deleted file mode 100644 index 181f9b1..0000000 --- a/examples/annotations/src/proguard/annotation/KeepApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep the annotated class as an application, - * together with its a main method. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepApplication {} diff --git a/examples/annotations/src/proguard/annotation/KeepClassMemberNames.java b/examples/annotations/src/proguard/annotation/KeepClassMemberNames.java deleted file mode 100644 index b2f1df9..0000000 --- a/examples/annotations/src/proguard/annotation/KeepClassMemberNames.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all class members of the annotated class - * from being optimized or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepClassMemberNames {} diff --git a/examples/annotations/src/proguard/annotation/KeepClassMembers.java b/examples/annotations/src/proguard/annotation/KeepClassMembers.java deleted file mode 100644 index 7ed755b..0000000 --- a/examples/annotations/src/proguard/annotation/KeepClassMembers.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all class members of the annotated class - * from being shrunk, optimized, or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepClassMembers {} diff --git a/examples/annotations/src/proguard/annotation/KeepGettersSetters.java b/examples/annotations/src/proguard/annotation/KeepGettersSetters.java deleted file mode 100644 index 497dcb7..0000000 --- a/examples/annotations/src/proguard/annotation/KeepGettersSetters.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all getters and setters of the annotated - * class from being shrunk, optimized, or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepGettersSetters {} diff --git a/examples/annotations/src/proguard/annotation/KeepImplementations.java b/examples/annotations/src/proguard/annotation/KeepImplementations.java deleted file mode 100644 index 47406a3..0000000 --- a/examples/annotations/src/proguard/annotation/KeepImplementations.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all implementations or extensions of the - * annotated class as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepImplementations {} diff --git a/examples/annotations/src/proguard/annotation/KeepName.java b/examples/annotations/src/proguard/annotation/KeepName.java deleted file mode 100644 index 5dd3680..0000000 --- a/examples/annotations/src/proguard/annotation/KeepName.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies not to optimize or obfuscate the annotated class or - * class member as an entry point. - */ -@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepName {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java b/examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java deleted file mode 100644 index f24b126..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public class members of the annotated - * class from being optimized or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicClassMemberNames {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java b/examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java deleted file mode 100644 index 2be7fa4..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public class members of the annotated - * class from being shrunk, optimized, or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicClassMembers {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java b/examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java deleted file mode 100644 index 6028ba9..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public getters and setters of the - * annotated class from being shrunk, optimized, or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicGettersSetters {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicImplementations.java b/examples/annotations/src/proguard/annotation/KeepPublicImplementations.java deleted file mode 100644 index 52ee5b9..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicImplementations.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public implementations or extensions - * of the annotated class as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicImplementations {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java b/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java deleted file mode 100644 index 59f0004..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public or protected class members of - * the annotated class from being optimized or obfuscated as entry points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicProtectedClassMemberNames {} diff --git a/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java b/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java deleted file mode 100644 index e918a9b..0000000 --- a/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * ProGuard -- shrinking, optimization, obfuscation, and preverification - * of Java bytecode. - * - * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) - */ -package proguard.annotation; - -import java.lang.annotation.*; - -/** - * This annotation specifies to keep all public or protected class members of - * the annotated class from being shrunk, optimized, or obfuscated as entry - * points. - */ -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.CLASS) -@Documented -public @interface KeepPublicProtectedClassMembers {} |