summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-08-31 10:12:00 -0700
committerJoe Onorato <joeo@android.com>2009-08-31 10:12:00 -0700
commitb72c5c2e5482cf10117b2b25f642f7616b2326c3 (patch)
treef02ba1bc29f4fe6853d9b7008eed37cdcfb96e81 /examples
parenta23344a828357fe4b6596f8af5fed467d72757ab (diff)
downloadproguard-b72c5c2e5482cf10117b2b25f642f7616b2326c3.tar.gz
Diffstat (limited to 'examples')
-rw-r--r--examples/annotations/examples.pro61
-rw-r--r--examples/annotations/examples/Applet.java22
-rw-r--r--examples/annotations/examples/Application.java20
-rw-r--r--examples/annotations/examples/Bean.java56
-rw-r--r--examples/annotations/examples/NativeCallBack.java44
-rw-r--r--examples/annotations/lib/annotations.jarbin0 -> 6123 bytes
-rw-r--r--examples/annotations/lib/annotations.pro118
-rw-r--r--examples/annotations/src/proguard/annotation/Keep.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepApplication.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepClassMemberNames.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepClassMembers.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepGettersSetters.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepImplementations.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepName.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicImplementations.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java18
-rw-r--r--examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java19
-rw-r--r--examples/ant/applets.xml81
-rw-r--r--examples/ant/applications1.xml15
-rw-r--r--examples/ant/applications2.xml68
-rw-r--r--examples/ant/applications3.xml92
-rw-r--r--examples/ant/library.xml102
-rw-r--r--examples/ant/midlets.xml45
-rw-r--r--examples/ant/proguard.xml73
-rw-r--r--examples/ant/servlets.xml81
-rw-r--r--examples/applets.pro60
-rw-r--r--examples/applications.pro66
-rw-r--r--examples/dictionaries/compact.txt18
-rw-r--r--examples/dictionaries/keywords.txt58
-rwxr-xr-xexamples/dictionaries/shakespeare.txt23
-rw-r--r--examples/dictionaries/windows.txt209
-rw-r--r--examples/library.pro78
-rw-r--r--examples/midlets.pro56
-rw-r--r--examples/proguard.pro57
-rw-r--r--examples/proguardall.pro62
-rw-r--r--examples/proguardgui.pro55
-rw-r--r--examples/retrace.pro43
-rw-r--r--examples/servlets.pro61
41 files changed, 1959 insertions, 0 deletions
diff --git a/examples/annotations/examples.pro b/examples/annotations/examples.pro
new file mode 100644
index 0000000..270092a
--- /dev/null
+++ b/examples/annotations/examples.pro
@@ -0,0 +1,61 @@
+#
+# 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)
+-injars classes(*.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 class * {
+ native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.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
new file mode 100644
index 0000000..8a5874b
--- /dev/null
+++ b/examples/annotations/examples/Applet.java
@@ -0,0 +1,22 @@
+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.
+ */
+@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
new file mode 100644
index 0000000..f8d5060
--- /dev/null
+++ b/examples/annotations/examples/Application.java
@@ -0,0 +1,20 @@
+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.
+ */
+@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
new file mode 100644
index 0000000..0544bf3
--- /dev/null
+++ b/examples/annotations/examples/Bean.java
@@ -0,0 +1,56 @@
+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.
+ */
+@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
new file mode 100644
index 0000000..2c72f7b
--- /dev/null
+++ b/examples/annotations/examples/NativeCallBack.java
@@ -0,0 +1,44 @@
+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.
+ */
+@KeepApplication
+public class NativeCallBack
+{
+ /**
+ * Suppose this is a native method that computes an answer.
+ *
+ * The -keep option regular ProGuard configuration will make sure it is
+ * not 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;
+ }
+
+
+ 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
new file mode 100644
index 0000000..967d604
--- /dev/null
+++ b/examples/annotations/lib/annotations.jar
Binary files differ
diff --git a/examples/annotations/lib/annotations.pro b/examples/annotations/lib/annotations.pro
new file mode 100644
index 0000000..f704af2
--- /dev/null
+++ b/examples/annotations/lib/annotations.pro
@@ -0,0 +1,118 @@
+#
+# 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
new file mode 100644
index 0000000..93a469f
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/Keep.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..181f9b1
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepApplication.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..b2f1df9
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepClassMemberNames.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..7ed755b
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepClassMembers.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..497dcb7
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepGettersSetters.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..47406a3
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepImplementations.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..5dd3680
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepName.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..f24b126
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..2be7fa4
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..6028ba9
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..52ee5b9
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicImplementations.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..59f0004
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java
@@ -0,0 +1,18 @@
+/*
+ * 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
new file mode 100644
index 0000000..e918a9b
--- /dev/null
+++ b/examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java
@@ -0,0 +1,19 @@
+/*
+ * 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 {}
diff --git a/examples/ant/applets.xml b/examples/ant/applets.xml
new file mode 100644
index 0000000..a55b1c3
--- /dev/null
+++ b/examples/ant/applets.xml
@@ -0,0 +1,81 @@
+<!-- This Ant build file illustrates how to process applets.
+ Usage: ant -f applets.xml -->
+
+<project name="Applets" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard printseeds="on">
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="in.jar" />
+ <outjar file="out.jar" />
+
+ <libraryjar file="${java.home}/lib/rt.jar" />
+
+ <!-- Preserve all public applets. -->
+
+ <keep access="public" extends="java.applet.Applet" />
+
+ <!-- Preserve all annotations. -->
+
+ <keepattribute name="*Annotation*" />
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ <keepclasseswithmembernames>
+ <method access="native" />
+ </keepclasseswithmembernames>
+
+ <!-- Preserve the methods that are required in all enumeration classes. -->
+
+ <keepclassmembers extends="java.lang.Enum">
+ <method access="public static"
+ type="**[]"
+ name="values"
+ parameters="" />
+ <method access="public static"
+ type="**"
+ name="valueOf"
+ parameters="java.lang.String" />
+ </keepclassmembers>
+
+ <!-- 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 library doesn't use serialization.
+ If your code contains serializable classes that have to be backward
+ compatible, please refer to the manual. -->
+
+ <keepclassmembers implements="java.io.Serializable">
+ <field access ="static final"
+ type ="long"
+ name ="serialVersionUID" />
+ <field access ="static final"
+ type ="java.io.ObjectStreamField[]"
+ name ="serialPersistentFields" />
+ <method access ="private"
+ type ="void"
+ name ="writeObject"
+ parameters="java.io.ObjectOutputStream" />
+ <method access ="private"
+ type ="void"
+ name ="readObject"
+ parameters="java.io.ObjectInputStream" />
+ <method type ="java.lang.Object"
+ name ="writeReplace"
+ parameters="" />
+ <method type ="java.lang.Object"
+ name ="readResolve"
+ parameters="" />
+ </keepclassmembers>
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/applications1.xml b/examples/ant/applications1.xml
new file mode 100644
index 0000000..7a3d473
--- /dev/null
+++ b/examples/ant/applications1.xml
@@ -0,0 +1,15 @@
+<!-- This Ant build file illustrates how to process applications,
+ by including a ProGuard-style configuration file.
+ Usage: ant -f applications.xml -->
+
+<project name="Applications" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard configuration="examples/applications.pro" />
+
+</target>
+
+</project>
diff --git a/examples/ant/applications2.xml b/examples/ant/applications2.xml
new file mode 100644
index 0000000..2e28f01
--- /dev/null
+++ b/examples/ant/applications2.xml
@@ -0,0 +1,68 @@
+<!-- This Ant build file illustrates how to process applications,
+ by including ProGuard-style configuration options.
+ Usage: ant -f applications.xml -->
+
+<project name="Applications" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard>
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ -injars in.jar
+ -outjars out.jar
+
+ -libraryjars ${java.home}/lib/rt.jar
+ <!-- -libraryjars junit.jar -->
+ <!-- -libraryjars servlet.jar -->
+ <!-- -libraryjars jai_core.jar -->
+ <!-- ... -->
+
+ <!-- Preserve all public applications. -->
+
+ -keepclasseswithmembers public class * {
+ public static void main(java.lang.String[]);
+ }
+
+ <!-- Preserve all annotations. -->
+
+ -keepattributes *Annotation*
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ -keepclasseswithmembernames class * {
+ native &lt;methods&gt;;
+ }
+
+ <!-- Preserve the methods that are required in all enumeration classes. -->
+
+ -keepclassmembers class * extends java.lang.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 library 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();
+ }
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/applications3.xml b/examples/ant/applications3.xml
new file mode 100644
index 0000000..d5501e0
--- /dev/null
+++ b/examples/ant/applications3.xml
@@ -0,0 +1,92 @@
+<!-- This Ant build file illustrates how to process applications,
+ using a full-blown XML configuration.
+ Usage: ant -f applications.xml -->
+
+<project name="Applications" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard printseeds="on">
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="in.jar" />
+ <outjar file="out.jar" />
+
+ <libraryjar file="${java.home}/lib/rt.jar" />
+ <!-- libraryjar file="junit.jar" / -->
+ <!-- libraryjar file="servlet.jar" / -->
+ <!-- libraryjar file="jai_core.jar" / -->
+ <!-- ... / -->
+
+
+ <!-- Preserve all public applications. -->
+
+ <keepclasseswithmembers access="public">
+ <method access ="public static"
+ type ="void"
+ name ="main"
+ parameters="java.lang.String[]" />
+ </keepclasseswithmembers>
+
+ <!-- Preserve all annotations. -->
+
+ <keepattribute name="*Annotation*" />
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ <keepclasseswithmembernames>
+ <method access="native" />
+ </keepclasseswithmembernames>
+
+ <!-- Preserve the methods that are required in all enumeration classes. -->
+
+ <keepclassmembers extends="java.lang.Enum">
+ <method access="public static"
+ type="**[]"
+ name="values"
+ parameters="" />
+ <method access="public static"
+ type="**"
+ name="valueOf"
+ parameters="java.lang.String" />
+ </keepclassmembers>
+
+ <!-- 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 library doesn't use serialization.
+ If your code contains serializable classes that have to be backward
+ compatible, please refer to the manual. -->
+
+ <keepclassmembers implements="java.io.Serializable">
+ <field access ="static final"
+ type ="long"
+ name ="serialVersionUID" />
+ <field access ="static final"
+ type ="java.io.ObjectStreamField[]"
+ name ="serialPersistentFields" />
+ <method access ="private"
+ type ="void"
+ name ="writeObject"
+ parameters="java.io.ObjectOutputStream" />
+ <method access ="private"
+ type ="void"
+ name ="readObject"
+ parameters="java.io.ObjectInputStream" />
+ <method type ="java.lang.Object"
+ name ="writeReplace"
+ parameters="" />
+ <method type ="java.lang.Object"
+ name ="readResolve"
+ parameters="" />
+ </keepclassmembers>
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/library.xml b/examples/ant/library.xml
new file mode 100644
index 0000000..d87bd16
--- /dev/null
+++ b/examples/ant/library.xml
@@ -0,0 +1,102 @@
+<!-- This Ant build file illustrates how to process a program library,
+ such that it remains usable as a library.
+ Usage: ant -f library.xml -->
+
+<project name="Library" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard printmapping="out.map"
+ renamesourcefileattribute="SourceFile">
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="library.jar" />
+ <outjar file="library_out.jar" />
+
+ <libraryjar file="${java.home}/lib/rt.jar" />
+
+ <!-- Keep some useful attributes. -->
+
+ <keepattribute name="InnerClasses" />
+ <keepattribute name="SourceFile" />
+ <keepattribute name="LineNumberTable" />
+ <keepattribute name="Deprecated" />
+ <keepattribute name="*Annotation*" />
+
+ <!-- Preserve all public classes, and their public and protected fields
+ and methods. -->
+
+ <keep access="public">
+ <field access="public protected" />
+ <method access="public protected" />
+ </keep>
+
+ <!-- Preserve all .class method names. -->
+
+ <keepclassmembernames access="public">
+ <method type ="java.lang.Class"
+ name ="class$"
+ parameters="java.lang.String" />
+ <method type ="java.lang.Class"
+ name ="class$"
+ parameters="java.lang.String,boolean" />
+ </keepclassmembernames>
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ <keepclasseswithmembernames>
+ <method access="native" />
+ </keepclasseswithmembernames>
+
+ <!-- Preserve the methods that are required in all enumeration classes. -->
+
+ <keepclassmembers extends="java.lang.Enum">
+ <method access="public static"
+ type="**[]"
+ name="values"
+ parameters="" />
+ <method access="public static"
+ type="**"
+ name="valueOf"
+ parameters="java.lang.String" />
+ </keepclassmembers>
+
+ <!-- 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 library doesn't use serialization.
+ If your code contains serializable classes that have to be backward
+ compatible, please refer to the manual. -->
+
+ <keepclassmembers implements="java.io.Serializable">
+ <field access ="final"
+ type ="long"
+ name ="serialVersionUID" />
+ <field access ="static final"
+ type ="java.io.ObjectStreamField[]"
+ name ="serialPersistentFields" />
+ <method access ="private"
+ type ="void"
+ name ="writeObject"
+ parameters="java.io.ObjectOutputStream" />
+ <method access ="private"
+ type ="void"
+ name ="readObject"
+ parameters="java.io.ObjectInputStream" />
+ <method type ="java.lang.Object"
+ name ="writeReplace"
+ parameters="" />
+ <method type ="java.lang.Object"
+ name ="readResolve"
+ parameters="" />
+ </keepclassmembers>
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/midlets.xml b/examples/ant/midlets.xml
new file mode 100644
index 0000000..b17d036
--- /dev/null
+++ b/examples/ant/midlets.xml
@@ -0,0 +1,45 @@
+<!-- This Ant build file illustrates how to process J2ME midlets.
+ Usage: ant -f midlets.xml -->
+
+<project name="Midlets" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard microedition="on"
+ overloadaggressively="on"
+ repackageclasses=""
+ allowaccessmodification="on"
+ printseeds="on">
+
+ <!-- On Windows, you can't use mixed case class names,
+ for the sake of the preverify tool.
+ usemixedcaseclassnames="false">
+ -->
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="in.jar" />
+ <outjar file="out.jar" />
+
+ <libraryjar file="/usr/local/java/wtk2.1/lib/midpapi20.jar" />
+ <libraryjar file="/usr/local/java/wtk2.1/lib/cldcapi11.jar" />
+
+ <!-- Preserve all public midlets. -->
+
+ <keep access="public" extends="javax.microedition.midlet.MIDlet" />
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ <keepclasseswithmembernames>
+ <method access="native" />
+ </keepclasseswithmembernames>
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/proguard.xml b/examples/ant/proguard.xml
new file mode 100644
index 0000000..315e628
--- /dev/null
+++ b/examples/ant/proguard.xml
@@ -0,0 +1,73 @@
+<!-- This Ant build file illustrates how to process ProGuard (including its
+ main application, its GUI, its Ant task, and its WTK plugin), and the
+ ReTrace tool, all in one go.
+ Usage: ant -f proguard.xml -->
+
+<project name="ProGuard" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard skipnonpubliclibraryclasses="off"
+ printmapping="proguard.map"
+ overloadaggressively="on"
+ repackageclasses="">
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="lib/proguard.jar" />
+ <injar file="lib/proguardgui.jar" filter="!META-INF/**" />
+ <injar file="lib/retrace.jar" filter="!META-INF/**" />
+
+ <outjar file="examples/ant/proguard_out.jar" />
+
+ <libraryjar file="${java.home}/lib/rt.jar" />
+ <libraryjar file="/usr/local/java/ant1.7.0/lib/ant.jar" />
+ <libraryjar file="/usr/local/java/wtk2.1/wtklib/kenv.zip" />
+
+ <!-- Adapt the resource file names, based on the corresponding obfuscated
+ class names. -->
+
+ <adaptresourcefilenames filter="**.properties,**.gif,**.jpg" />
+ <adaptresourcefilecontents filter="proguard/ant/task.properties" />
+
+ <!-- The main seeds: ProGuard and its companion tool ReTrace. -->
+
+ <keep access="public" name="proguard.ProGuard">
+ <method access ="public static"
+ type ="void"
+ name ="main"
+ parameters="java.lang.String[]" />
+ </keep>
+ <keep access="public" name="proguard.gui.ProGuardGUI">
+ <method access ="public static"
+ type ="void"
+ name ="main"
+ parameters="java.lang.String[]" />
+ </keep>
+ <keep access="public" name="proguard.retrace.ReTrace">
+ <method access ="public static"
+ type ="void"
+ name ="main"
+ parameters="java.lang.String[]" />
+ </keep>
+
+ <!-- If we have ant.jar, we can properly process the Ant task. -->
+
+ <keeppackagename name="proguard.ant" />
+ <keep name="proguard.ant.*" allowobfuscation="true" />
+ <keepclassmembers access="public" name="proguard.ant.*">
+ <constructor parameters="org.apache.tools.ant.Project" />
+ <method access="public" type="void" name="set*" parameters="***" />
+ <method access="public" type="void" name="add*" parameters="***" />
+ </keepclassmembers>
+
+ <!-- If we have kenv.zip, we can process the J2ME WTK plugin. -->
+
+ <keep access="public" name="proguard.wtk.ProGuardObfuscator" />
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/ant/servlets.xml b/examples/ant/servlets.xml
new file mode 100644
index 0000000..83af0f2
--- /dev/null
+++ b/examples/ant/servlets.xml
@@ -0,0 +1,81 @@
+<!-- This Ant build file illustrates how to process servlets.
+ Usage: ant -f servlets.xml -->
+
+<project name="Servlets" default="obfuscate" basedir="../..">
+
+<target name="obfuscate">
+ <taskdef resource="proguard/ant/task.properties"
+ classpath="lib/proguard.jar" />
+
+ <proguard printseeds="on">
+
+ <!-- Specify the input jars, output jars, and library jars. -->
+
+ <injar file="in.jar" />
+ <outjar file="out.jar" />
+
+ <libraryjar file="${java.home}/lib/rt.jar" />
+
+ <!-- Keep all public servlets. -->
+
+ <keep access="public" implements="javax.servlet.Servlet" />
+
+ <!-- Preserve all annotations. -->
+
+ <keepattribute name="*Annotation*" />
+
+ <!-- Preserve all native method names and the names of their classes. -->
+
+ <keepclasseswithmembernames>
+ <method access="native" />
+ </keepclasseswithmembernames>
+
+ <!-- Preserve the methods that are required in all enumeration classes. -->
+
+ <keepclassmembers extends="java.lang.Enum">
+ <method access="public static"
+ type="**[]"
+ name="values"
+ parameters="" />
+ <method access="public static"
+ type="**"
+ name="valueOf"
+ parameters="java.lang.String" />
+ </keepclassmembers>
+
+ <!-- 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 library doesn't use serialization.
+ If your code contains serializable classes that have to be backward
+ compatible, please refer to the manual. -->
+
+ <keepclassmembers implements="java.io.Serializable">
+ <field access ="static final"
+ type ="long"
+ name ="serialVersionUID" />
+ <field access ="static final"
+ type ="java.io.ObjectStreamField[]"
+ name ="serialPersistentFields" />
+ <method access ="private"
+ type ="void"
+ name ="writeObject"
+ parameters="java.io.ObjectOutputStream" />
+ <method access ="private"
+ type ="void"
+ name ="readObject"
+ parameters="java.io.ObjectInputStream" />
+ <method type ="java.lang.Object"
+ name ="writeReplace"
+ parameters="" />
+ <method type ="java.lang.Object"
+ name ="readResolve"
+ parameters="" />
+ </keepclassmembers>
+
+ <!-- Your application may contain more items that need to be preserved;
+ typically classes that are dynamically created using Class.forName -->
+
+ </proguard>
+</target>
+
+</project>
diff --git a/examples/applets.pro b/examples/applets.pro
new file mode 100644
index 0000000..ee90db0
--- /dev/null
+++ b/examples/applets.pro
@@ -0,0 +1,60 @@
+#
+# This ProGuard configuration file illustrates how to process applets.
+# Usage:
+# java -jar proguard.jar @applets.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+
+-injars in.jar
+-outjars out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+
+# Preserve all public applets.
+
+-keep public class * extends java.applet.Applet
+
+# Print out a list of what we're preserving.
+
+-printseeds
+
+# Preserve all annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.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 library 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();
+}
+
+# Your application may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface
diff --git a/examples/applications.pro b/examples/applications.pro
new file mode 100644
index 0000000..29d8e43
--- /dev/null
+++ b/examples/applications.pro
@@ -0,0 +1,66 @@
+#
+# This ProGuard configuration file illustrates how to process applications.
+# Usage:
+# java -jar proguard.jar @applications.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+
+-injars in.jar
+-outjars out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+#-libraryjars junit.jar
+#-libraryjars servlet.jar
+#-libraryjars jai_core.jar
+#...
+
+# Preserve all public applications.
+
+-keepclasseswithmembers public class * {
+ public static void main(java.lang.String[]);
+}
+
+# Print out a list of what we're preserving.
+
+-printseeds
+
+# Preserve all annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.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();
+}
+
+# Your application may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface
diff --git a/examples/dictionaries/compact.txt b/examples/dictionaries/compact.txt
new file mode 100644
index 0000000..5636a3e
--- /dev/null
+++ b/examples/dictionaries/compact.txt
@@ -0,0 +1,18 @@
+#
+# This obfuscation dictionary contains strings that are already present
+# in many class files. Since these strings can be shared, the resulting
+# obfuscated class files will generally be a little bit more compact.
+# Usage:
+# java -jar proguard.jar ..... -obfuscationdictionary compact.txt
+#
+
+Code
+V
+I
+Z
+B
+C
+S
+F
+D
+L
diff --git a/examples/dictionaries/keywords.txt b/examples/dictionaries/keywords.txt
new file mode 100644
index 0000000..76f5a7b
--- /dev/null
+++ b/examples/dictionaries/keywords.txt
@@ -0,0 +1,58 @@
+#
+# This obfuscation dictionary contains reserved Java keywords. They can't
+# be used in Java source files, but they can be used in compiled class files.
+# Note that this hardly improves the obfuscation. Decent decompilers can
+# automatically replace reserved keywords, and the effect can fairly simply be
+# undone by obfuscating again with simpler names.
+# Usage:
+# java -jar proguard.jar ..... -obfuscationdictionary keywords.txt
+#
+
+do
+if
+for
+int
+new
+try
+byte
+case
+char
+else
+goto
+long
+this
+void
+break
+catch
+class
+const
+final
+float
+short
+super
+throw
+while
+double
+import
+native
+public
+return
+static
+switch
+throws
+boolean
+default
+extends
+finally
+package
+private
+abstract
+continue
+strictfp
+volatile
+interface
+protected
+transient
+implements
+instanceof
+synchronized
diff --git a/examples/dictionaries/shakespeare.txt b/examples/dictionaries/shakespeare.txt
new file mode 100755
index 0000000..28b1cd8
--- /dev/null
+++ b/examples/dictionaries/shakespeare.txt
@@ -0,0 +1,23 @@
+#
+# This obfuscation dictionary contains quotes from plays by Shakespeare.
+# It illustrates that any text can be used, for whatever flippant reasons
+# one may have.
+# Usage:
+# java -jar proguard.jar ..... -obfuscationdictionary shakespeare.txt
+#
+
+
+"This thing of darkness I acknowledge mine."
+
+ --From The Tempest (V, i, 275-276)
+
+
+"Though this be madness, yet there is method in 't."
+
+ --From Hamlet (II, ii, 206)
+
+
+"What's in a name? That which we call a rose
+ By any other word would smell as sweet."
+
+ --From Romeo and Juliet (II, ii, 1-2)
diff --git a/examples/dictionaries/windows.txt b/examples/dictionaries/windows.txt
new file mode 100644
index 0000000..fd65dc9
--- /dev/null
+++ b/examples/dictionaries/windows.txt
@@ -0,0 +1,209 @@
+#
+# This obfuscation dictionary contains names that are not allowed as file names
+# in Windows, not even with extensions like .class or .java. They can however
+# be used without problems in jar archives, which just begs to apply them as
+# obfuscated class names. Trying to unpack the obfuscated archives in Windows
+# will probably generate some sparks.
+# Usage:
+# java -jar proguard.jar ..... -classobfuscationdictionary windows.txt
+# -packageobfuscationdictionary windows.txt
+#
+
+aux
+Aux
+aUx
+AUx
+auX
+AuX
+aUX
+AUX
+AUX
+con
+Con
+cOn
+COn
+coN
+CoN
+cON
+CON
+CON
+nul
+Nul
+nUl
+NUl
+nuL
+NuL
+nUL
+NUL
+NUL
+prn
+Prn
+pRn
+PRn
+prN
+PrN
+pRN
+PRN
+PRN
+com1
+Com1
+cOm1
+COm1
+coM1
+CoM1
+cOM1
+COM1
+COM1
+com2
+Com2
+cOm2
+COm2
+coM2
+CoM2
+cOM2
+COM2
+COM2
+com3
+Com3
+cOm3
+COm3
+coM3
+CoM3
+cOM3
+COM3
+COM3
+com4
+Com4
+cOm4
+COm4
+coM4
+CoM4
+cOM4
+COM4
+COM4
+com5
+Com5
+cOm5
+COm5
+coM5
+CoM5
+cOM5
+COM5
+COM5
+com6
+Com6
+cOm6
+COm6
+coM6
+CoM6
+cOM6
+COM6
+COM6
+com7
+Com7
+cOm7
+COm7
+coM7
+CoM7
+cOM7
+COM7
+COM7
+com8
+Com8
+cOm8
+COm8
+coM8
+CoM8
+cOM8
+COM8
+COM8
+com9
+Com9
+cOm9
+COm9
+coM9
+CoM9
+cOM9
+COM9
+COM9
+lpt1
+Lpt1
+lPt1
+LPt1
+lpT1
+LpT1
+lPT1
+LPT1
+LPT1
+lpt2
+Lpt2
+lPt2
+LPt2
+lpT2
+LpT2
+lPT2
+LPT2
+LPT2
+lpt3
+Lpt3
+lPt3
+LPt3
+lpT3
+LpT3
+lPT3
+LPT3
+LPT3
+lpt4
+Lpt4
+lPt4
+LPt4
+lpT4
+LpT4
+lPT4
+LPT4
+LPT4
+lpt5
+Lpt5
+lPt5
+LPt5
+lpT5
+LpT5
+lPT5
+LPT5
+LPT5
+lpt6
+Lpt6
+lPt6
+LPt6
+lpT6
+LpT6
+lPT6
+LPT6
+LPT6
+lpt7
+Lpt7
+lPt7
+LPt7
+lpT7
+LpT7
+lPT7
+LPT7
+LPT7
+lpt8
+Lpt8
+lPt8
+LPt8
+lpT8
+LpT8
+lPT8
+LPT8
+LPT8
+lpt9
+Lpt9
+lPt9
+LPt9
+lpT9
+LpT9
+lPT9
+LPT9
+LPT9
diff --git a/examples/library.pro b/examples/library.pro
new file mode 100644
index 0000000..37be47e
--- /dev/null
+++ b/examples/library.pro
@@ -0,0 +1,78 @@
+#
+# This ProGuard configuration file illustrates how to process a program
+# library, such that it remains usable as a library.
+# Usage:
+# java -jar proguard.jar @library.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+# In this case, the input jar is the program library that we want to process.
+
+-injars in.jar
+-outjars out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+
+# Save the obfuscation mapping to a file, so we can de-obfuscate any stack
+# traces later on. Keep a fixed source file attribute and all line number
+# tables to actually get these stack traces.
+# You can comment this out if you're not interested in stack traces.
+
+-printmapping out.map
+-renamesourcefileattribute SourceFile
+-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
+ SourceFile,LineNumberTable,EnclosingMethod
+
+# Preserve all annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all public classes, and their public and protected fields and
+# methods.
+
+-keep public class * {
+ public protected *;
+}
+
+# Preserve all .class method names.
+
+-keepclassmembernames class * {
+ java.lang.Class class$(java.lang.String);
+ java.lang.Class class$(java.lang.String, boolean);
+}
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.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 library 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();
+}
+
+# Your library may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface
diff --git a/examples/midlets.pro b/examples/midlets.pro
new file mode 100644
index 0000000..bffc38e
--- /dev/null
+++ b/examples/midlets.pro
@@ -0,0 +1,56 @@
+#
+# This ProGuard configuration file illustrates how to process J2ME midlets.
+# Usage:
+# java -jar proguard.jar @midlets.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+
+-injars in.jar
+-outjars out.jar
+
+-libraryjars /usr/local/java/wtk2.1/lib/midpapi20.jar
+-libraryjars /usr/local/java/wtk2.1/lib/cldcapi11.jar
+
+# Preverify the code suitably for Java Micro Edition.
+
+-microedition
+
+# Allow methods with the same signature, except for the return type,
+# to get the same obfuscation name.
+
+-overloadaggressively
+
+# Put all obfuscated classes into the nameless root package.
+
+-repackageclasses ''
+
+# Allow classes and class members to be made public.
+
+-allowaccessmodification
+
+# On Windows, you can't use mixed case class names,
+# should you still want to use the preverify tool.
+#
+# -dontusemixedcaseclassnames
+
+# Preserve all public midlets.
+
+-keep public class * extends javax.microedition.midlet.MIDlet
+
+# Print out a list of what we're preserving.
+
+-printseeds
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Your midlet may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface
diff --git a/examples/proguard.pro b/examples/proguard.pro
new file mode 100644
index 0000000..c48b87e
--- /dev/null
+++ b/examples/proguard.pro
@@ -0,0 +1,57 @@
+#
+# This ProGuard configuration file illustrates how to process ProGuard itself.
+# Configuration files for typical applications will be very similar.
+# Usage:
+# java -jar proguard.jar @proguard.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+# We'll filter out the Ant and WTK classes, keeping everything else.
+
+-injars ../lib/proguard.jar(!proguard/ant/**,!proguard/wtk/**)
+-outjars proguard_out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+
+# Write out an obfuscation mapping file, for de-obfuscating any stack traces
+# later on, or for incremental obfuscation of extensions.
+
+-printmapping proguard.map
+
+# Allow methods with the same signature, except for the return type,
+# to get the same obfuscation name.
+
+-overloadaggressively
+
+# Put all obfuscated classes into the nameless root package.
+
+-repackageclasses ''
+
+# Allow classes and class members to be made public.
+
+-allowaccessmodification
+
+# The entry point: ProGuard and its main method.
+
+-keep public class proguard.ProGuard {
+ public static void main(java.lang.String[]);
+}
+
+# If you want to preserve the Ant task as well, you'll have to specify the
+# main ant.jar.
+
+#-libraryjars /usr/local/java/ant/lib/ant.jar
+#-adaptresourcefilecontents proguard/ant/task.properties
+#
+#-keep,allowobfuscation class proguard.ant.*
+#-keepclassmembers public class proguard.ant.* {
+# <init>(org.apache.tools.ant.Project);
+# public void set*(***);
+# public void add*(***);
+#}
+
+# If you want to preserve the WTK obfuscation plug-in, you'll have to specify
+# the kenv.zip file.
+
+#-libraryjars /usr/local/java/wtk2.1/wtklib/kenv.zip
+#-keep public class proguard.wtk.ProGuardObfuscator
diff --git a/examples/proguardall.pro b/examples/proguardall.pro
new file mode 100644
index 0000000..8dc042e
--- /dev/null
+++ b/examples/proguardall.pro
@@ -0,0 +1,62 @@
+#
+# This ProGuard configuration file illustrates how to process ProGuard
+# (including its main application, its GUI, its Ant task, and its WTK plugin),
+# and the ReTrace tool, all in one go.
+# Configuration files for typical applications will be very similar.
+# Usage:
+# java -jar proguard.jar @proguardall.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+# We'll read all jars from the lib directory, process them, and write the
+# processed jars to a new out directory.
+
+-injars ../lib
+-outjars out
+
+# You may have to adapt the paths below.
+
+-libraryjars <java.home>/lib/rt.jar
+-libraryjars /usr/local/java/ant1.5.0/lib/ant.jar
+-libraryjars /usr/local/java/wtk2.1/wtklib/kenv.zip
+
+# Allow methods with the same signature, except for the return type,
+# to get the same obfuscation name.
+
+-overloadaggressively
+
+# Put all obfuscated classes into the nameless root package.
+
+-repackageclasses ''
+
+# Adapt the names and contents of the resource files.
+
+-adaptresourcefilenames **.properties,**.gif,**.jpg
+-adaptresourcefilecontents proguard/ant/task.properties
+
+# The main entry points.
+
+-keep public class proguard.ProGuard {
+ public static void main(java.lang.String[]);
+}
+
+-keep public class proguard.gui.ProGuardGUI {
+ public static void main(java.lang.String[]);
+}
+
+-keep public class proguard.retrace.ReTrace {
+ public static void main(java.lang.String[]);
+}
+
+# If we have ant.jar, we can properly process the Ant task.
+
+-keep,allowobfuscation class proguard.ant.*
+-keepclassmembers public class proguard.ant.* {
+ <init>(org.apache.tools.ant.Project);
+ public void set*(***);
+ public void add*(***);
+}
+
+# If we have kenv.zip, we can process the J2ME WTK plugin.
+
+-keep public class proguard.wtk.ProGuardObfuscator
diff --git a/examples/proguardgui.pro b/examples/proguardgui.pro
new file mode 100644
index 0000000..2cb83ed
--- /dev/null
+++ b/examples/proguardgui.pro
@@ -0,0 +1,55 @@
+#
+# This ProGuard configuration file illustrates how to process the ProGuard GUI.
+# Configuration files for typical applications will be very similar.
+# Usage:
+# java -jar proguard.jar @proguardgui.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+# The input jars will be merged in a single output jar.
+# We'll filter out the Ant and WTK classes.
+
+-injars ../lib/proguardgui.jar
+-injars ../lib/proguard.jar(!META-INF/**,!proguard/ant/**,!proguard/wtk/**)
+-injars ../lib/retrace.jar (!META-INF/**)
+-outjars proguardgui_out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+
+# In recent JREs, some public Swing classes depend on package visible classes,
+# so don't skip these package visible classes while parsing the library jar.
+
+-dontskipnonpubliclibraryclasses
+
+# If we wanted to reuse the previously obfuscated proguard_out.jar, we could
+# perform incremental obfuscation based on its mapping file, and only keep the
+# additional GUI files instead of all files.
+
+#-applymapping proguard.map
+#-injars ../lib/proguardgui.jar
+#-outjars proguardgui_out.jar
+#-libraryjars ../lib/proguard.jar(!proguard/ant/**,!proguard/wtk/**)
+#-libraryjars ../lib/retrace.jar
+#-libraryjars <java.home>/lib/rt.jar
+
+
+# Allow methods with the same signature, except for the return type,
+# to get the same obfuscation name.
+
+-overloadaggressively
+
+# Put all obfuscated classes into the nameless root package.
+
+-repackageclasses ''
+
+# Adapt the names of resource files, based on the corresponding obfuscated
+# class names. Notably, in this case, the GUI resource properties file will
+# have to be renamed.
+
+-adaptresourcefilenames **.properties,**.gif,**.jpg
+
+# The entry point: ProGuardGUI and its main method.
+
+-keep public class proguard.gui.ProGuardGUI {
+ public static void main(java.lang.String[]);
+}
diff --git a/examples/retrace.pro b/examples/retrace.pro
new file mode 100644
index 0000000..39f5a95
--- /dev/null
+++ b/examples/retrace.pro
@@ -0,0 +1,43 @@
+#
+# This ProGuard configuration file illustrates how to process the ReTrace tool.
+# Configuration files for typical applications will be very similar.
+# Usage:
+# java -jar proguard.jar @retrace.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+# The input jars will be merged in a single output jar.
+# We'll filter out the Ant and WTK classes.
+
+-injars ../lib/retrace.jar
+-injars ../lib/proguard.jar(!META-INF/MANIFEST.MF,
+ !proguard/ant/**,!proguard/wtk/**)
+-outjars retrace_out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+
+# If we wanted to reuse the previously obfuscated proguard_out.jar, we could
+# perform incremental obfuscation based on its mapping file, and only keep the
+# additional ReTrace files instead of all files.
+
+#-applymapping proguard.map
+#-outjars retrace_out.jar(proguard/retrace/**)
+
+# Allow methods with the same signature, except for the return type,
+# to get the same obfuscation name.
+
+-overloadaggressively
+
+# Put all obfuscated classes into the nameless root package.
+
+-repackageclasses ''
+
+# Allow classes and class members to be made public.
+
+-allowaccessmodification
+
+# The entry point: ReTrace and its main method.
+
+-keep public class proguard.retrace.ReTrace {
+ public static void main(java.lang.String[]);
+}
diff --git a/examples/servlets.pro b/examples/servlets.pro
new file mode 100644
index 0000000..fdc36b0
--- /dev/null
+++ b/examples/servlets.pro
@@ -0,0 +1,61 @@
+#
+# This ProGuard configuration file illustrates how to process servlets.
+# Usage:
+# java -jar proguard.jar @servlets.pro
+#
+
+# Specify the input jars, output jars, and library jars.
+
+-injars in.jar
+-outjars out.jar
+
+-libraryjars <java.home>/lib/rt.jar
+-libraryjars /usr/local/java/servlet/servlet.jar
+
+# Preserve all public servlets.
+
+-keep public class * implements javax.servlet.Servlet
+
+# Print out a list of what we're preserving.
+
+-printseeds
+
+# Preserve all annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# Preserve the special static methods that are required in all enumeration
+# classes.
+
+-keepclassmembers class * extends java.lang.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 library 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();
+}
+
+# Your application may contain more items that need to be preserved;
+# typically classes that are dynamically created using Class.forName:
+
+# -keep public class mypackage.MyClass
+# -keep public interface mypackage.MyInterface
+# -keep public class * implements mypackage.MyInterface