├── MODULE_LICENSE_GPL ├── Android.mk ├── src └── proguard │ ├── MANIFEST.MF │ ├── ant │ ├── package.html │ └── task.properties │ ├── gui │ ├── package.html │ ├── arrow.gif │ ├── vtitle.png │ ├── MANIFEST.MF │ ├── splash │ │ ├── package.html │ │ ├── VariableInt.java │ │ ├── Timing.java │ │ ├── VariableDouble.java │ │ ├── VariableString.java │ │ ├── VariableFont.java │ │ ├── VariableColor.java │ │ ├── ConstantFont.java │ │ ├── Sprite.java │ │ ├── ConstantInt.java │ │ ├── ConstantDouble.java │ │ ├── ConstantString.java │ │ ├── ConstantColor.java │ │ ├── ConstantTiming.java │ │ ├── SineTiming.java │ │ ├── SawToothTiming.java │ │ ├── CompositeSprite.java │ │ ├── LinearInt.java │ │ ├── LinearDouble.java │ │ └── LinearTiming.java │ └── GUIResources.java │ ├── classfile │ ├── editor │ │ ├── package.html │ │ ├── SubclassAdder.java │ │ └── SubclassToAdder.java │ ├── constant │ │ └── visitor │ │ │ ├── package.html │ │ │ └── AllConstantVisitor.java │ ├── instruction │ │ ├── visitor │ │ │ └── package.html │ │ └── package.html │ ├── io │ │ └── package.html │ ├── util │ │ └── package.html │ ├── attribute │ │ ├── visitor │ │ │ ├── package.html │ │ │ ├── ExceptionInfoVisitor.java │ │ │ ├── InnerClassesInfoVisitor.java │ │ │ ├── ParameterInfoVisitor.java │ │ │ ├── LineNumberInfoVisitor.java │ │ │ ├── BootstrapMethodInfoVisitor.java │ │ │ ├── LocalVariableInfoVisitor.java │ │ │ └── LocalVariableTypeInfoVisitor.java │ │ ├── package.html │ │ ├── annotation │ │ │ ├── visitor │ │ │ │ ├── package.html │ │ │ │ └── TypeAnnotationVisitor.java │ │ │ ├── package.html │ │ │ ├── TypePathInfo.java │ │ │ └── target │ │ │ │ ├── visitor │ │ │ │ └── LocalVariableTargetElementVisitor.java │ │ │ │ └── LocalVariableTargetElement.java │ │ ├── LineNumberInfo.java │ │ ├── SourceDirAttribute.java │ │ └── SourceFileAttribute.java │ ├── package.html │ ├── Field.java │ ├── Method.java │ ├── visitor │ │ ├── ClassVisitor.java │ │ ├── ClassPoolVisitor.java │ │ ├── AllClassVisitor.java │ │ ├── MemberVisitor.java │ │ ├── NamedClassVisitor.java │ │ ├── ClassCounter.java │ │ ├── ClassPoolFiller.java │ │ ├── ExceptionCounter.java │ │ ├── AllFieldVisitor.java │ │ ├── AllMethodVisitor.java │ │ ├── ClassCollector.java │ │ ├── AllMemberVisitor.java │ │ └── MemberCollector.java │ ├── VisitorAccepter.java │ └── Member.java │ ├── retrace │ ├── MANIFEST.MF │ └── package.html │ ├── shrink │ └── package.html │ ├── wtk │ └── package.html │ ├── obfuscate │ ├── package.html │ ├── NameFactory.java │ ├── NumericNameFactory.java │ ├── MapCleaner.java │ └── NameFactoryResetter.java │ ├── util │ ├── package.html │ ├── EmptyStringMatcher.java │ ├── StringParser.java │ ├── StringMatcher.java │ ├── NotMatcher.java │ ├── SettableMatcher.java │ ├── ConstantMatcher.java │ ├── AndMatcher.java │ ├── OrMatcher.java │ └── FixedStringMatcher.java │ ├── evaluation │ ├── value │ │ ├── package.html │ │ ├── Category1Value.java │ │ ├── Category2Value.java │ │ ├── ConvertedLongValue.java │ │ ├── ConvertedFloatValue.java │ │ ├── ConvertedDoubleValue.java │ │ ├── ConvertedByteValue.java │ │ ├── ConvertedIntegerValue.java │ │ ├── ConvertedShortValue.java │ │ ├── DetailedValueFactory.java │ │ └── ConvertedCharacterValue.java │ └── ClassConstantValueFactory.java │ ├── optimize │ ├── peephole │ │ └── package.html │ ├── package.html │ ├── evaluation │ │ └── package.html │ └── info │ │ ├── package.html │ │ └── ClassOptimizationInfoSetter.java │ ├── io │ ├── package.html │ ├── Finisher.java │ ├── DataEntryReader.java │ ├── DataEntryDirectoryFilter.java │ ├── DataEntryFilter.java │ ├── DataEntryPump.java │ ├── DataEntryParentFilter.java │ ├── DataEntryNameFilter.java │ ├── DirectoryFilter.java │ ├── DataEntry.java │ └── ClassFilter.java │ ├── package.html │ ├── ParseException.java │ ├── FileWordReader.java │ └── SubclassedClassFilter.java ├── docs ├── drop1.gif ├── drop2.gif ├── drop3.gif ├── steel.gif ├── title.gif ├── dexguard.png ├── favicon.ico ├── sflogo.png ├── checkmark.gif ├── saikoalogo.png ├── android_shades.png ├── screenshot_gui1.gif ├── screenshot_gui2.gif ├── screenshot_gui3.gif ├── screenshot_gui4.gif ├── screenshot_gui5.gif ├── screenshot_gui6.gif ├── screenshot_gui7.gif ├── screenshot_gui8.gif ├── manual │ ├── attention.gif │ ├── android_small.png │ ├── retrace │ │ └── index.html │ └── index.html ├── screenshot_console.gif ├── screenshots_gui_small.gif ├── screenshot_console_small.gif ├── title.html ├── proguard.appdata.xml └── sections.html ├── lib ├── proguard.jar ├── retrace.jar └── proguardgui.jar ├── README.version ├── examples ├── annotations │ ├── lib │ │ └── annotations.jar │ ├── src │ │ └── proguard │ │ │ └── annotation │ │ │ ├── KeepApplication.java │ │ │ ├── KeepImplementations.java │ │ │ ├── KeepClassMemberNames.java │ │ │ ├── KeepPublicImplementations.java │ │ │ ├── KeepClassMembers.java │ │ │ ├── Keep.java │ │ │ ├── KeepGettersSetters.java │ │ │ ├── KeepPublicClassMemberNames.java │ │ │ ├── KeepPublicClassMembers.java │ │ │ ├── KeepName.java │ │ │ ├── KeepPublicGettersSetters.java │ │ │ ├── KeepPublicProtectedClassMemberNames.java │ │ │ └── KeepPublicProtectedClassMembers.java │ ├── examples │ │ ├── Applet.java │ │ ├── Application.java │ │ ├── Bean.java │ │ └── NativeCallBack.java │ └── examples.pro ├── dictionaries │ ├── compact.txt │ ├── shakespeare.txt │ └── keywords.txt ├── ant │ ├── applications1.xml │ └── midlets.xml ├── retrace.pro ├── proguardgui.pro └── midlets.pro ├── bin ├── proguard.bat ├── proguardgui.bat ├── retrace.bat ├── retrace.sh ├── proguardgui.sh └── proguard.sh └── README /MODULE_LICENSE_GPL: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # We don't really build anything. 2 | -------------------------------------------------------------------------------- /src/proguard/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: proguard.ProGuard 3 | -------------------------------------------------------------------------------- /docs/drop1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/drop1.gif -------------------------------------------------------------------------------- /docs/drop2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/drop2.gif -------------------------------------------------------------------------------- /docs/drop3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/drop3.gif -------------------------------------------------------------------------------- /docs/steel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/steel.gif -------------------------------------------------------------------------------- /docs/title.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/title.gif -------------------------------------------------------------------------------- /docs/dexguard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/dexguard.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /docs/sflogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/sflogo.png -------------------------------------------------------------------------------- /lib/proguard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/lib/proguard.jar -------------------------------------------------------------------------------- /lib/retrace.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/lib/retrace.jar -------------------------------------------------------------------------------- /docs/checkmark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/checkmark.gif -------------------------------------------------------------------------------- /docs/saikoalogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/saikoalogo.png -------------------------------------------------------------------------------- /lib/proguardgui.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/lib/proguardgui.jar -------------------------------------------------------------------------------- /src/proguard/ant/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains the Ant task for ProGuard. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/gui/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains a GUI for ProGuard and ReTrace. 3 | 4 | -------------------------------------------------------------------------------- /docs/android_shades.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/android_shades.png -------------------------------------------------------------------------------- /docs/screenshot_gui1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui1.gif -------------------------------------------------------------------------------- /docs/screenshot_gui2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui2.gif -------------------------------------------------------------------------------- /docs/screenshot_gui3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui3.gif -------------------------------------------------------------------------------- /docs/screenshot_gui4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui4.gif -------------------------------------------------------------------------------- /docs/screenshot_gui5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui5.gif -------------------------------------------------------------------------------- /docs/screenshot_gui6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui6.gif -------------------------------------------------------------------------------- /docs/screenshot_gui7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui7.gif -------------------------------------------------------------------------------- /docs/screenshot_gui8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_gui8.gif -------------------------------------------------------------------------------- /docs/manual/attention.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/manual/attention.gif -------------------------------------------------------------------------------- /docs/screenshot_console.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_console.gif -------------------------------------------------------------------------------- /src/proguard/classfile/editor/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors to edit byte code. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/gui/arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/src/proguard/gui/arrow.gif -------------------------------------------------------------------------------- /src/proguard/gui/vtitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/src/proguard/gui/vtitle.png -------------------------------------------------------------------------------- /docs/manual/android_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/manual/android_small.png -------------------------------------------------------------------------------- /src/proguard/retrace/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: proguard.retrace.ReTrace 3 | Class-Path: proguard.jar 4 | -------------------------------------------------------------------------------- /src/proguard/shrink/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to perform shrinking of class files. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/wtk/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains the J2ME Wireless Toolkit plug-in for ProGuard. 3 | 4 | -------------------------------------------------------------------------------- /docs/screenshots_gui_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshots_gui_small.gif -------------------------------------------------------------------------------- /src/proguard/classfile/constant/visitor/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors for class constants. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/classfile/instruction/visitor/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors for instructions. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/classfile/io/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes for reading and writing class files. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/classfile/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains utility classes for processing class files. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/obfuscate/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to perform obfuscation of class files. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains utility classes for regular expression matching,... 3 | 4 | -------------------------------------------------------------------------------- /docs/screenshot_console_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/docs/screenshot_console_small.gif -------------------------------------------------------------------------------- /src/proguard/gui/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: proguard.gui.ProGuardGUI 3 | Class-Path: proguard.jar retrace.jar 4 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes that represent partial evaluation values. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/ant/task.properties: -------------------------------------------------------------------------------- 1 | proguard = proguard.ant.ProGuardTask 2 | proguardconfiguration = proguard.ant.ConfigurationTask 3 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors for attributes and their components. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/optimize/peephole/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors that perform various peephole optimizations. 3 | 4 | -------------------------------------------------------------------------------- /README.version: -------------------------------------------------------------------------------- 1 | URL: http://sourceforge.net/projects/proguard/files/proguard/5.1/proguard5.1.tar.gz/download 2 | Version: 5.1 3 | BugComponent: 99142 4 | -------------------------------------------------------------------------------- /examples/annotations/lib/annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_proguard/HEAD/examples/annotations/lib/annotations.jar -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to represent the attributes inside class files. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/optimize/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors that assist with various optimizations of byte 3 | code. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/visitor/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors for annotation attributes and their components. 3 | 4 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to represent the annotation attributes inside 3 | class files. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/io/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to read and write files, optionally wrapped in 3 | jars, wars, ears, zips, directories,... 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/retrace/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains the main ReTrace application. 3 | ReTrace can de-obfuscate stack traces of obfuscated programs. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/optimize/evaluation/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains visitors that perform partial evaluation and subsequent 3 | optimizations on byte code. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains a library for creating splash screens and animations 3 | with text, graphical elements, and some special effects. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/optimize/info/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to collect additional information about classes 3 | and class members, which can then be used for optimization. 4 | 5 | -------------------------------------------------------------------------------- /src/proguard/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains the main ProGuard application. 3 | ProGuard can read jar files, shrink and obfuscate them, and write out the 4 | resulting jar file. 5 | 6 | -------------------------------------------------------------------------------- /examples/dictionaries/compact.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This obfuscation dictionary contains strings that are already present 3 | # in many class files. Since these strings can be shared, the resulting 4 | # obfuscated class files will generally be a little bit more compact. 5 | # Usage: 6 | # java -jar proguard.jar ..... -obfuscationdictionary compact.txt 7 | # 8 | 9 | Code 10 | V 11 | I 12 | Z 13 | B 14 | C 15 | S 16 | F 17 | D 18 | L 19 | -------------------------------------------------------------------------------- /src/proguard/classfile/instruction/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to represent Java bytecode instructions. 3 |

4 | Not every instruction currently has its own class. Only groups of instructions 5 | that refer to the constant pool get their own representations. 6 |

7 | While the package is sufficient for the current needs of the ProGuard 8 | application, it may very well be reorganised and extended in the future. 9 | 10 | -------------------------------------------------------------------------------- /bin/proguard.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Start-up script for ProGuard -- free class file shrinker, optimizer, 4 | REM obfuscator, and preverifier for Java bytecode. 5 | REM 6 | REM Note: when passing file names containing spaces to this script, 7 | REM you'll have to add escaped quotes around them, e.g. 8 | REM "\"C:/My Directory/My File.txt\"" 9 | 10 | IF EXIST "%PROGUARD_HOME%" GOTO home 11 | SET PROGUARD_HOME=%~dp0\.. 12 | :home 13 | 14 | java -jar "%PROGUARD_HOME%\lib\proguard.jar" %* 15 | -------------------------------------------------------------------------------- /bin/proguardgui.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Start-up script for the GUI of ProGuard -- free class file shrinker, 4 | REM optimizer, obfuscator, and preverifier for Java bytecode. 5 | REM 6 | REM Note: when passing file names containing spaces to this script, 7 | REM you'll have to add escaped quotes around them, e.g. 8 | REM "\"C:/My Directory/My File.txt\"" 9 | 10 | IF EXIST "%PROGUARD_HOME%" GOTO home 11 | SET PROGUARD_HOME=%~dp0\.. 12 | :home 13 | 14 | java -jar "%PROGUARD_HOME%\lib\proguardgui.jar" %* 15 | -------------------------------------------------------------------------------- /examples/ant/applications1.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bin/retrace.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Start-up script for Retrace -- companion tool for ProGuard, free class file 4 | REM shrinker, optimizer, obfuscator, and preverifier for Java bytecode. 5 | REM 6 | REM Note: when passing file names containing spaces to this script, 7 | REM you'll have to add escaped quotes around them, e.g. 8 | REM "\"C:/My Directory/My File.txt\"" 9 | 10 | IF EXIST "%PROGUARD_HOME%" GOTO home 11 | SET PROGUARD_HOME=%~dp0\.. 12 | :home 13 | 14 | java -jar "%PROGUARD_HOME%\lib\retrace.jar" %* 15 | -------------------------------------------------------------------------------- /docs/title.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ProGuard 8 | 9 | 10 | 11 |

12 |

ProGuard

13 |
Version 5.1
14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep the annotated class as an application, 13 | * together with its a main method. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepApplication {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepImplementations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all implementations or extensions of the 13 | * annotated class as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepImplementations {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepClassMemberNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all class members of the annotated class 13 | * from being optimized or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepClassMemberNames {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicImplementations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public implementations or extensions 13 | * of the annotated class as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepPublicImplementations {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepClassMembers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all class members of the annotated class 13 | * from being shrunk, optimized, or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepClassMembers {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/Keep.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies not to optimize or obfuscate the annotated class or 13 | * class member as an entry point. 14 | */ 15 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface Keep {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepGettersSetters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all getters and setters of the annotated 13 | * class from being shrunk, optimized, or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepGettersSetters {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicClassMemberNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public class members of the annotated 13 | * class from being optimized or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepPublicClassMemberNames {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicClassMembers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public class members of the annotated 13 | * class from being shrunk, optimized, or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepPublicClassMembers {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies not to optimize or obfuscate the annotated class or 13 | * class member as an entry point. 14 | */ 15 | @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepName {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicGettersSetters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public getters and setters of the 13 | * annotated class from being shrunk, optimized, or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepPublicGettersSetters {} 19 | -------------------------------------------------------------------------------- /examples/dictionaries/shakespeare.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This obfuscation dictionary contains quotes from plays by Shakespeare. 3 | # It illustrates that any text can be used, for whatever flippant reasons 4 | # one may have. 5 | # Usage: 6 | # java -jar proguard.jar ..... -obfuscationdictionary shakespeare.txt 7 | # 8 | 9 | 10 | "This thing of darkness I acknowledge mine." 11 | 12 | --From The Tempest (V, i, 275-276) 13 | 14 | 15 | "Though this be madness, yet there is method in 't." 16 | 17 | --From Hamlet (II, ii, 206) 18 | 19 | 20 | "What's in a name? That which we call a rose 21 | By any other word would smell as sweet." 22 | 23 | --From Romeo and Juliet (II, ii, 1-2) 24 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMemberNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public or protected class members of 13 | * the annotated class from being optimized or obfuscated as entry points. 14 | */ 15 | @Target({ ElementType.TYPE }) 16 | @Retention(RetentionPolicy.CLASS) 17 | @Documented 18 | public @interface KeepPublicProtectedClassMemberNames {} 19 | -------------------------------------------------------------------------------- /examples/annotations/src/proguard/annotation/KeepPublicProtectedClassMembers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu) 6 | */ 7 | package proguard.annotation; 8 | 9 | import java.lang.annotation.*; 10 | 11 | /** 12 | * This annotation specifies to keep all public or protected class members of 13 | * the annotated class from being shrunk, optimized, or obfuscated as entry 14 | * points. 15 | */ 16 | @Target({ ElementType.TYPE }) 17 | @Retention(RetentionPolicy.CLASS) 18 | @Documented 19 | public @interface KeepPublicProtectedClassMembers {} 20 | -------------------------------------------------------------------------------- /examples/annotations/examples/Applet.java: -------------------------------------------------------------------------------- 1 | import proguard.annotation.*; 2 | 3 | /** 4 | * This applet illustrates the use of annotations for configuring ProGuard. 5 | * 6 | * You can compile it with: 7 | * javac -classpath ../lib/annotations.jar Applet.java 8 | * You can then process it with: 9 | * java -jar ../../../lib/proguard.jar @ ../examples.pro 10 | * 11 | * The annotation will preserve the class and its essential methods, 12 | * as a result of the specifications in lib/annotations.pro. 13 | */ 14 | @Keep 15 | public class Applet extends java.applet.Applet 16 | { 17 | // Implementations for Applet. 18 | 19 | public void init() 20 | { 21 | // ... 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/annotations/examples/Application.java: -------------------------------------------------------------------------------- 1 | import proguard.annotation.KeepApplication; 2 | 3 | /** 4 | * This application illustrates the use of annotations for configuring ProGuard. 5 | * 6 | * You can compile it with: 7 | * javac -classpath ../lib/annotations.jar Application.java 8 | * You can then process it with: 9 | * java -jar ../../../lib/proguard.jar @ ../examples.pro 10 | * 11 | * The annotation will preserve the class and its main method, 12 | * as a result of the specifications in lib/annotations.pro. 13 | */ 14 | @KeepApplication 15 | public class Application 16 | { 17 | public static void main(String[] args) 18 | { 19 | System.out.println("The answer is 42"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/proguard/classfile/package.html: -------------------------------------------------------------------------------- 1 | 2 | This package contains classes to represent the various elements of class files. 3 |

4 | A class file is represented by the {@link proguard.classfile.ClassFile 5 | ClassFile} interface. This interface currently has two alternative 6 | representations: 7 |

15 | 16 | -------------------------------------------------------------------------------- /bin/retrace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Start-up script for Retrace -- companion tool for ProGuard, free class file 4 | # shrinker, optimizer, obfuscator, and preverifier for Java bytecode. 5 | # 6 | # Note: when passing file names containing spaces to this script, 7 | # you'll have to add escaped quotes around them, e.g. 8 | # "\"/My Directory/My File.txt\"" 9 | 10 | # Account for possibly missing/basic readlink. 11 | # POSIX conformant (dash/ksh/zsh/bash). 12 | PROGUARD=`readlink -f "$0" 2>/dev/null` 13 | if test "$PROGUARD" = '' 14 | then 15 | PROGUARD=`readlink "$0" 2>/dev/null` 16 | if test "$PROGUARD" = '' 17 | then 18 | PROGUARD="$0" 19 | fi 20 | fi 21 | 22 | PROGUARD_HOME=`dirname "$PROGUARD"`/.. 23 | 24 | java -jar "$PROGUARD_HOME/lib/retrace.jar" "$@" 25 | -------------------------------------------------------------------------------- /docs/manual/retrace/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ReTrace Manual 8 | 9 | 10 | 11 |

ReTrace

12 | 13 |
    14 |
  1. Introduction
  2. 15 |
  3. Usage
  4. 16 |
  5. Examples
  6. 17 |
18 | 19 |
20 | 21 |
22 | Copyright © 2002-2014 23 | Eric Lafortune @ Saikoa. 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /bin/proguardgui.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Start-up script for the GUI of ProGuard -- free class file shrinker, 4 | # optimizer, obfuscator, and preverifier for Java bytecode. 5 | # 6 | # Note: when passing file names containing spaces to this script, 7 | # you'll have to add escaped quotes around them, e.g. 8 | # "\"/My Directory/My File.txt\"" 9 | 10 | # Account for possibly missing/basic readlink. 11 | # POSIX conformant (dash/ksh/zsh/bash). 12 | PROGUARD=`readlink -f "$0" 2>/dev/null` 13 | if test "$PROGUARD" = '' 14 | then 15 | PROGUARD=`readlink "$0" 2>/dev/null` 16 | if test "$PROGUARD" = '' 17 | then 18 | PROGUARD="$0" 19 | fi 20 | fi 21 | 22 | PROGUARD_HOME=`dirname "$PROGUARD"`/.. 23 | 24 | # On Linux, Java 1.6.0_24 and higher hang when starting the GUI: 25 | # http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7027598 26 | # We're using the -D option as a workaround. 27 | java -DsuppressSwingDropSupport=true -jar "$PROGUARD_HOME/lib/proguardgui.jar" "$@" 28 | -------------------------------------------------------------------------------- /examples/dictionaries/keywords.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This obfuscation dictionary contains reserved Java keywords. They can't 3 | # be used in Java source files, but they can be used in compiled class files. 4 | # Note that this hardly improves the obfuscation. Decent decompilers can 5 | # automatically replace reserved keywords, and the effect can fairly simply be 6 | # undone by obfuscating again with simpler names. 7 | # Usage: 8 | # java -jar proguard.jar ..... -obfuscationdictionary keywords.txt 9 | # 10 | 11 | do 12 | if 13 | for 14 | int 15 | new 16 | try 17 | byte 18 | case 19 | char 20 | else 21 | goto 22 | long 23 | this 24 | void 25 | break 26 | catch 27 | class 28 | const 29 | final 30 | float 31 | short 32 | super 33 | throw 34 | while 35 | double 36 | import 37 | native 38 | public 39 | return 40 | static 41 | switch 42 | throws 43 | boolean 44 | default 45 | extends 46 | finally 47 | package 48 | private 49 | abstract 50 | continue 51 | strictfp 52 | volatile 53 | interface 54 | protected 55 | transient 56 | implements 57 | instanceof 58 | synchronized 59 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier 2 | ========================================================================== 3 | 4 | This distribution contains the following directories: 5 | 6 | - bin : simple wrapper scripts to run ProGuard, its GUI, and ReTrace 7 | - lib : the main jars, compiled and ready to use with "java -jar ...." 8 | - docs : the complete documentation, licenses, etc. in html format 9 | - examples : some example configuration files 10 | - src : the source code 11 | - build : various alternative build scripts 12 | 13 | 14 | The best place to start is docs/index.html 15 | 16 | 17 | Example 18 | ------- 19 | 20 | If you want to give ProGuard a spin right away, try processing the ProGuard 21 | jar itself: 22 | 23 | cd examples 24 | java -jar ../lib/proguard.jar @proguard.pro 25 | 26 | The resulting proguard_out.jar contains the same application, but it's a lot 27 | smaller. 28 | 29 | Enjoy! 30 | 31 | http://proguard.sourceforge.net/ 32 | 33 | Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 34 | -------------------------------------------------------------------------------- /src/proguard/classfile/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile; 22 | 23 | 24 | 25 | /** 26 | * Representation of a field from a class. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public interface Field extends Member 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /src/proguard/classfile/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile; 22 | 23 | 24 | 25 | /** 26 | * Representation of a method from a class. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public interface Method extends Member 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/VariableInt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This interface represents an integer that varies with time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | interface VariableInt 29 | { 30 | /** 31 | * Returns the integer for the given time. 32 | */ 33 | public int getInt(long time); 34 | } 35 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/Timing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This interface maps a time to a normalized timing between 0 and 1. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | interface Timing 29 | { 30 | /** 31 | * Returns the timing for the given time. 32 | */ 33 | public double getTiming(long time); 34 | } 35 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/VariableDouble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This interface represents a double that varies with time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | interface VariableDouble 29 | { 30 | /** 31 | * Returns the double for the given time. 32 | */ 33 | public double getDouble(long time); 34 | } 35 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/VariableString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This interface represents a String that varies with time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | interface VariableString 29 | { 30 | /** 31 | * Returns the String for the given time. 32 | */ 33 | public String getString(long time); 34 | } 35 | -------------------------------------------------------------------------------- /src/proguard/obfuscate/NameFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.obfuscate; 22 | 23 | /** 24 | * This interfaces provides methods to generate unique sequences of names. 25 | * The names must be valid Java identifiers. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public interface NameFactory 30 | { 31 | public void reset(); 32 | 33 | public String nextName(); 34 | } 35 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/VariableFont.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This interface represents a Font that varies with time. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | interface VariableFont 31 | { 32 | /** 33 | * Returns the Font for the given time. 34 | */ 35 | public Font getFont(long time); 36 | } 37 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/VariableColor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This interface represents a Color that varies with time. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | interface VariableColor 31 | { 32 | /** 33 | * Returns the Color for the given time. 34 | */ 35 | public Color getColor(long time); 36 | } 37 | -------------------------------------------------------------------------------- /src/proguard/util/EmptyStringMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher tests whether strings are empty. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class EmptyStringMatcher implements StringMatcher 29 | { 30 | // Implementations for StringMatcher. 31 | 32 | public boolean matches(String string) 33 | { 34 | return string.length() == 0; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/proguard/util/StringParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This interface provides a method to create a SringMatcher for a given 25 | * regular expression. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public interface StringParser 30 | { 31 | /** 32 | * Creates a StringMatcher for the given regular expression. 33 | */ 34 | public StringMatcher parse(String regularExpression); 35 | } 36 | -------------------------------------------------------------------------------- /src/proguard/io/Finisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import java.io.IOException; 24 | 25 | /** 26 | * This interface specifies a listener that is called to finish an output stream 27 | * before it is closed. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public interface Finisher 32 | { 33 | /** 34 | * Finishes an output stream right before it is closed. 35 | */ 36 | public void finish() throws IOException; 37 | } 38 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ClassVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | 26 | /** 27 | * This interface specifies the methods for a visitor of 28 | * Clazz objects. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public interface ClassVisitor 33 | { 34 | public void visitProgramClass(ProgramClass programClass); 35 | public void visitLibraryClass(LibraryClass libraryClass); 36 | } 37 | -------------------------------------------------------------------------------- /examples/annotations/examples/Bean.java: -------------------------------------------------------------------------------- 1 | import proguard.annotation.*; 2 | 3 | /** 4 | * This bean illustrates the use of annotations for configuring ProGuard. 5 | * 6 | * You can compile it with: 7 | * javac -classpath ../lib/annotations.jar Bean.java 8 | * You can then process it with: 9 | * java -jar ../../../lib/proguard.jar @ ../examples.pro 10 | * 11 | * The annotations will preserve the class and its public getters and setters, 12 | * as a result of the specifications in lib/annotations.pro. 13 | */ 14 | @Keep 15 | @KeepPublicGettersSetters 16 | public class Bean 17 | { 18 | public boolean booleanProperty; 19 | public int intProperty; 20 | public String stringProperty; 21 | 22 | 23 | public boolean isBooleanProperty() 24 | { 25 | return booleanProperty; 26 | } 27 | 28 | 29 | public void setBooleanProperty(boolean booleanProperty) 30 | { 31 | this.booleanProperty = booleanProperty; 32 | } 33 | 34 | 35 | public int getIntProperty() 36 | { 37 | return intProperty; 38 | } 39 | 40 | 41 | public void setIntProperty(int intProperty) 42 | { 43 | this.intProperty = intProperty; 44 | } 45 | 46 | 47 | public String getStringProperty() 48 | { 49 | return stringProperty; 50 | } 51 | 52 | 53 | public void setStringProperty(String stringProperty) 54 | { 55 | this.stringProperty = stringProperty; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import java.io.IOException; 24 | 25 | 26 | /** 27 | * This interface provides methods for reading data entries. The implementation 28 | * determines what to do with the read data, if anything. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public interface DataEntryReader 33 | { 34 | /** 35 | * Reads the given data entry. 36 | */ 37 | public void read(DataEntry dataEntry) throws IOException; 38 | } 39 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryDirectoryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | /** 24 | * This DataEntryFilter filters data entries based on whether they represent 25 | * directories. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class DataEntryDirectoryFilter 30 | implements DataEntryFilter 31 | { 32 | // Implementations for DataEntryFilter. 33 | 34 | public boolean accepts(DataEntry dataEntry) 35 | { 36 | return dataEntry != null && dataEntry.isDirectory(); 37 | } 38 | } -------------------------------------------------------------------------------- /examples/retrace.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This ProGuard configuration file illustrates how to process the ReTrace tool. 3 | # Configuration files for typical applications will be very similar. 4 | # Usage: 5 | # java -jar proguard.jar @retrace.pro 6 | # 7 | 8 | # Specify the input jars, output jars, and library jars. 9 | # The input jars will be merged in a single output jar. 10 | # We'll filter out the Ant and WTK classes. 11 | 12 | -injars ../lib/retrace.jar 13 | -injars ../lib/proguard.jar(!META-INF/MANIFEST.MF, 14 | !proguard/ant/**,!proguard/wtk/**) 15 | -outjars retrace_out.jar 16 | 17 | -libraryjars /lib/rt.jar 18 | 19 | # If we wanted to reuse the previously obfuscated proguard_out.jar, we could 20 | # perform incremental obfuscation based on its mapping file, and only keep the 21 | # additional ReTrace files instead of all files. 22 | 23 | #-applymapping proguard.map 24 | #-outjars retrace_out.jar(proguard/retrace/**) 25 | 26 | # Allow methods with the same signature, except for the return type, 27 | # to get the same obfuscation name. 28 | 29 | -overloadaggressively 30 | 31 | # Put all obfuscated classes into the nameless root package. 32 | 33 | -repackageclasses '' 34 | 35 | # Allow classes and class members to be made public. 36 | 37 | -allowaccessmodification 38 | 39 | # The entry point: ReTrace and its main method. 40 | 41 | -keep public class proguard.retrace.ReTrace { 42 | public static void main(java.lang.String[]); 43 | } 44 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/Category1Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This abstract class represents a partially evaluated Category 1 value. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public abstract class Category1Value extends Value 29 | { 30 | // Implementations for Value. 31 | 32 | public final Category1Value category1Value() 33 | { 34 | return this; 35 | } 36 | 37 | public final boolean isCategory2() 38 | { 39 | return false; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/Category2Value.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This abstract class represents a partially evaluated Category 2 value. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public abstract class Category2Value extends Value 29 | { 30 | // Implementations for Value. 31 | 32 | public final Category2Value category2Value() 33 | { 34 | return this; 35 | } 36 | 37 | public final boolean isCategory2() 38 | { 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | 24 | /** 25 | * This interface provides a method to filter data entries. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public interface DataEntryFilter 30 | { 31 | /** 32 | * Checks whether the filter accepts the given data entry. 33 | * @param dataEntry the data entry to filter. 34 | * @return a boolean indicating whether the filter accepts the given data 35 | * entry. 36 | */ 37 | public boolean accepts(DataEntry dataEntry); 38 | } 39 | -------------------------------------------------------------------------------- /docs/manual/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | ProGuard Manual 8 | 9 | 10 | 11 |

ProGuard

12 | 13 |
    14 |
  1. Introduction
  2. 15 |
  3. Usage
  4. 16 |
  5. Limitations
  6. 17 |
  7. Examples
  8. 18 |
  9. Troubleshooting
  10. 19 |
  11. Reference Card
  12. 20 |
  13. Graphical User Interface
  14. 21 |
  15. Ant Task
  16. 22 |
  17. Gradle Task
  18. 23 |
  19. JME Wireless Toolkit Integration
  20. 24 |
25 | 26 |

ReTrace

27 | 28 |
    29 |
  1. Introduction
  2. 30 |
  3. Usage
  4. 31 |
  5. Examples
  6. 32 |
33 | 34 |
35 | 36 |
37 | Copyright © 2002-2014 38 | Eric Lafortune @ Saikoa. 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantFont.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This VariableFont is constant over time. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public class ConstantFont implements VariableFont 31 | { 32 | private final Font value; 33 | 34 | public ConstantFont(Font value) 35 | { 36 | this.value = value; 37 | } 38 | 39 | 40 | // Implementation for VariableFont. 41 | 42 | public Font getFont(long time) 43 | { 44 | return value; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ClassPoolVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.ClassPool; 24 | 25 | 26 | /** 27 | * This interface specifies the methods for a visitor of 28 | * ClassPool objects. Note that there is only a single 29 | * implementation of ClassPool, such that this interface 30 | * is not strictly necessary as a visitor. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public interface ClassPoolVisitor 35 | { 36 | public void visitClassPool(ClassPool classPool); 37 | } 38 | -------------------------------------------------------------------------------- /src/proguard/obfuscate/NumericNameFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.obfuscate; 22 | 23 | /** 24 | * This NameFactory generates unique numeric names, starting at 25 | * "1". 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class NumericNameFactory implements NameFactory 30 | { 31 | private int index; 32 | 33 | 34 | // Implementations for NameFactory. 35 | 36 | public void reset() 37 | { 38 | index = 0; 39 | } 40 | 41 | 42 | public String nextName() 43 | { 44 | return Integer.toString(++index); 45 | } 46 | } -------------------------------------------------------------------------------- /src/proguard/util/StringMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | 24 | /** 25 | * This interface provides a method to determine whether strings match a given 26 | * criterion, which is specified by the implementation. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public interface StringMatcher 31 | { 32 | /** 33 | * Checks whether the given string matches. 34 | * @param string the string to match. 35 | * @return a boolean indicating whether the string matches the criterion. 36 | */ 37 | public boolean matches(String string); 38 | } 39 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/Sprite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This interface describes objects that can paint themselves, possibly varying 27 | * as a function of time. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public interface Sprite 32 | { 33 | /** 34 | * Paints the object. 35 | * 36 | * @param graphics the Graphics to paint on. 37 | * @param time the time since the start of the animation, expressed in 38 | * milliseconds. 39 | */ 40 | public void paint(Graphics graphics, long time); 41 | } 42 | -------------------------------------------------------------------------------- /src/proguard/util/NotMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher tests whether strings does not match the given 25 | * StringMatcher. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class NotMatcher implements StringMatcher 30 | { 31 | private final StringMatcher matcher; 32 | 33 | 34 | public NotMatcher(StringMatcher matcher) 35 | { 36 | this.matcher = matcher; 37 | } 38 | 39 | 40 | // Implementations for StringMatcher. 41 | 42 | public boolean matches(String string) 43 | { 44 | return !matcher.matches(string); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantInt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This VariableInt is constant over time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class ConstantInt implements VariableInt 29 | { 30 | private final int value; 31 | 32 | 33 | /** 34 | * Creates a new ConstantInt. 35 | * @param value the constant value. 36 | */ 37 | public ConstantInt(int value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementation for VariableInt. 44 | 45 | public int getInt(long time) 46 | { 47 | return value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/util/SettableMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher delegates to a another StringMatcher that can be set 25 | * after this StringMatcher has been constructed. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class SettableMatcher implements StringMatcher 30 | { 31 | private StringMatcher matcher; 32 | 33 | 34 | public void setMatcher(StringMatcher matcher) 35 | { 36 | this.matcher = matcher; 37 | } 38 | 39 | 40 | // Implementations for StringMatcher. 41 | 42 | public boolean matches(String string) 43 | { 44 | return matcher.matches(string); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantDouble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This VariableDouble is constant over time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class ConstantDouble implements VariableDouble 29 | { 30 | private final double value; 31 | 32 | 33 | /** 34 | * Creates a new ConstantDouble. 35 | * @param value the constant value. 36 | */ 37 | public ConstantDouble(double value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementation for VariableDouble. 44 | 45 | public double getDouble(long time) 46 | { 47 | return value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This VariableString is constant over time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class ConstantString implements VariableString 29 | { 30 | private final String value; 31 | 32 | 33 | /** 34 | * Creates a new ConstantString. 35 | * @param value the constant value. 36 | */ 37 | public ConstantString(String value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementation for VariableString. 44 | 45 | public String getString(long time) 46 | { 47 | return value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/util/ConstantMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher matches any string or no string at all. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class ConstantMatcher implements StringMatcher 29 | { 30 | private boolean matches; 31 | 32 | 33 | /** 34 | * Creates a new ConstantMatcher that always returns the given result. 35 | */ 36 | public ConstantMatcher(boolean matches) 37 | { 38 | this.matches = matches; 39 | } 40 | 41 | 42 | // Implementations for StringMatcher. 43 | 44 | public boolean matches(String string) 45 | { 46 | return matches; 47 | } 48 | } -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantColor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This VariableColor is constant over time. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public class ConstantColor implements VariableColor 31 | { 32 | private final Color value; 33 | 34 | 35 | /** 36 | * Creates a new ConstantColor. 37 | * @param value the constant value. 38 | */ 39 | public ConstantColor(Color value) 40 | { 41 | this.value = value; 42 | } 43 | 44 | 45 | // Implementation for VariableColor. 46 | 47 | public Color getColor(long time) 48 | { 49 | return value; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bin/proguard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Start-up script for ProGuard -- free class file shrinker, optimizer, 4 | # obfuscator, and preverifier for Java bytecode. 5 | # 6 | # Note: when passing file names containing spaces to this script, 7 | # you'll have to add escaped quotes around them, e.g. 8 | # "\"/My Directory/My File.txt\"" 9 | 10 | # Account for possibly missing/basic readlink. 11 | # POSIX conformant (dash/ksh/zsh/bash). 12 | PROGUARD=`readlink -f "$0" 2>/dev/null` 13 | if test "$PROGUARD" = '' 14 | then 15 | PROGUARD=`readlink "$0" 2>/dev/null` 16 | if test "$PROGUARD" = '' 17 | then 18 | PROGUARD="$0" 19 | fi 20 | fi 21 | 22 | PROGUARD_HOME=`dirname "$PROGUARD"`/.. 23 | 24 | # By default, give dx a max heap size of 2 gig. This can be overridden 25 | # by using a "-J" option (see below). 26 | defaultMx="-Xmx2G" 27 | 28 | # The following will extract any initial parameters of the form 29 | # "-J" from the command line and pass them to the Java 30 | # invocation (instead of to dx). This makes it possible for you to add 31 | # a command-line parameter such as "-JXmx256M" in your scripts, for 32 | # example. "java" (with no args) and "java -X" give a summary of 33 | # available options. 34 | 35 | javaOpts="" 36 | 37 | while expr "x$1" : 'x-J' >/dev/null; do 38 | opt=`expr "x$1" : 'x-J\(.*\)'` 39 | javaOpts="${javaOpts} -${opt}" 40 | if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then 41 | defaultMx="no" 42 | fi 43 | shift 44 | done 45 | 46 | if [ "${defaultMx}" != "no" ]; then 47 | javaOpts="${javaOpts} ${defaultMx}" 48 | fi 49 | 50 | exec java $javaOpts -jar "$PROGUARD_HOME/lib/proguard.jar" "$@" 51 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/ExceptionInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.*; 25 | 26 | /** 27 | * This interface specifies the methods for a visitor of 28 | * ExceptionInfo objects. Note that there is only a single 29 | * implementation of ExceptionInfo, such that this interface 30 | * is not strictly necessary as a visitor. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public interface ExceptionInfoVisitor 35 | { 36 | public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo); 37 | } 38 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/InnerClassesInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.attribute.InnerClassesInfo; 25 | 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * InnerClassesInfo objects. Note that there is only a single 30 | * implementation of InnerClassesInfo, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface InnerClassesInfoVisitor 36 | { 37 | public void visitInnerClassesInfo(Clazz clazz, InnerClassesInfo innerClassesInfo); 38 | } 39 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/ParameterInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.ParameterInfo; 25 | 26 | /** 27 | * This interface specifies the method for a visitor of 28 | * ParameterInfo objects. Note that there is only a single 29 | * implementation of ParameterInfo, such that this interface 30 | * is not strictly necessary as a visitor. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public interface ParameterInfoVisitor 35 | { 36 | public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo); 37 | } 38 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/LineNumberInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.*; 25 | 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * LineNumberInfo objects. Note that there is only a single 30 | * implementation of LineNumberInfo, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface LineNumberInfoVisitor 36 | { 37 | public void visitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo); 38 | } 39 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/LineNumberInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute; 22 | 23 | /** 24 | * Representation of an Line Number table entry. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class LineNumberInfo 29 | { 30 | public int u2startPC; 31 | public int u2lineNumber; 32 | 33 | 34 | /** 35 | * Creates an uninitialized LineNumberInfo. 36 | */ 37 | public LineNumberInfo() 38 | { 39 | } 40 | 41 | 42 | /** 43 | * Creates an initialized LineNumberInfo. 44 | */ 45 | public LineNumberInfo(int u2startPC, int u2lineNumber) 46 | { 47 | this.u2startPC = u2startPC; 48 | this.u2lineNumber = u2lineNumber; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/AllClassVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.ClassPool; 24 | 25 | 26 | /** 27 | * This ClassPoolVisitor lets a given ClassVisitor visit all Clazz 28 | * objects of the class pools it visits. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class AllClassVisitor implements ClassPoolVisitor 33 | { 34 | private final ClassVisitor classVisitor; 35 | 36 | 37 | public AllClassVisitor(ClassVisitor classVisitor) 38 | { 39 | this.classVisitor = classVisitor; 40 | } 41 | 42 | 43 | public void visitClassPool(ClassPool classPool) 44 | { 45 | classPool.classesAccept(classVisitor); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/BootstrapMethodInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.attribute.BootstrapMethodInfo; 25 | 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * BootstrapMethodInfo objects. Note that there is only a single 30 | * implementation of BootstrapMethodInfo, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface BootstrapMethodInfoVisitor 36 | { 37 | public void visitBootstrapMethodInfo(Clazz clazz, BootstrapMethodInfo bootstrapMethodInfo); 38 | } 39 | -------------------------------------------------------------------------------- /docs/proguard.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | proguard.desktop 5 | CC-BY-SA-3.0 6 | GPL-2.0 7 | ProGuard 8 | Java optimizer and obfuscator 9 | 10 |

11 | ProGuard is a free Java class file shrinker, optimizer, obfuscator, and 12 | preverifier. It detects and removes unused classes, fields, methods, and 13 | attributes. It optimizes bytecode and removes unused instructions. It 14 | renames the remaining classes, fields, and methods using short meaningless 15 | names. Finally, it preverifies the processed code for Java 6 or for Java 16 | Micro Edition. 17 |

18 |

19 | ProGuard is useful for making code more compact and more efficient, on the 20 | desktop, on tablets, on smartphones, and on embedded devices. It also 21 | makes code more difficult to reverse engineer.Power Statistics is a 22 | program used to view historical and current battery information and will 23 | show programs running on your computer using power. 24 |

25 |
26 | 27 | http://proguard.sourceforge.net/screenshot_gui1.gif 28 | http://proguard.sourceforge.net/screenshot_console.gif 29 | 30 | http://proguard.sourceforge.net/ 31 | eric@graphics.cornell.edu 32 |
-------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/LocalVariableInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.*; 25 | 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * LocalVariableInfo objects. Note that there is only a single 30 | * implementation of LocalVariableInfo, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface LocalVariableInfoVisitor 36 | { 37 | public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo); 38 | } 39 | -------------------------------------------------------------------------------- /examples/annotations/examples/NativeCallBack.java: -------------------------------------------------------------------------------- 1 | import proguard.annotation.*; 2 | 3 | /** 4 | * This application illustrates the use of annotations for configuring ProGuard. 5 | * 6 | * You can compile it with: 7 | * javac -classpath ../lib/annotations.jar NativeCallBack.java 8 | * You can then process it with: 9 | * java -jar ../../../lib/proguard.jar @ ../examples.pro 10 | * 11 | * The annotation will preserve the class and its main method, 12 | * as a result of the specifications in lib/annotations.pro. 13 | */ 14 | @KeepApplication 15 | public class NativeCallBack 16 | { 17 | /** 18 | * Suppose this is a native method that computes an answer. 19 | * 20 | * The -keep option for native methods in the regular ProGuard 21 | * configuration will make sure it is not removed or renamed when 22 | * processing this code. 23 | */ 24 | public native int computeAnswer(); 25 | 26 | 27 | /** 28 | * Suppose this method is called back from the above native method. 29 | * 30 | * ProGuard would remove it, because it is not referenced from java. 31 | * The annotation will make sure it is preserved anyhow. 32 | */ 33 | @Keep 34 | public int getAnswer() 35 | { 36 | return 42; 37 | } 38 | 39 | 40 | /** 41 | * The main entry point of the application. 42 | * 43 | * The @KeepApplication annotation of this class will make sure it is not 44 | * removed or renamed when processing this code. 45 | */ 46 | public static void main(String[] args) 47 | { 48 | int answer = new NativeCallBack().computeAnswer(); 49 | 50 | System.out.println("The answer is " + answer); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/visitor/LocalVariableTypeInfoVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.*; 25 | 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * LocalVariableTypeInfo objects. Note that there is only a single 30 | * implementation of LocalVariableTypeInfo, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface LocalVariableTypeInfoVisitor 36 | { 37 | public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo); 38 | } 39 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/MemberVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | 26 | /** 27 | * This interface specifies the methods for a visitor of 28 | * ProgramMember objects and LibraryMember 29 | * objects. 30 | * 31 | * @author Eric Lafortune 32 | */ 33 | public interface MemberVisitor 34 | { 35 | public void visitProgramField( ProgramClass programClass, ProgramField programField); 36 | public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod); 37 | 38 | public void visitLibraryField( LibraryClass libraryClass, LibraryField libraryField); 39 | public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod); 40 | } 41 | -------------------------------------------------------------------------------- /src/proguard/util/AndMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher tests whether strings matches both given StringMatcher 25 | * instances. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class AndMatcher implements StringMatcher 30 | { 31 | private final StringMatcher matcher1; 32 | private final StringMatcher matcher2; 33 | 34 | 35 | public AndMatcher(StringMatcher matcher1, StringMatcher matcher2) 36 | { 37 | this.matcher1 = matcher1; 38 | this.matcher2 = matcher2; 39 | } 40 | 41 | 42 | // Implementations for StringMatcher. 43 | 44 | public boolean matches(String string) 45 | { 46 | return matcher1.matches(string) && 47 | matcher2.matches(string); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/TypePathInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.annotation; 22 | 23 | /** 24 | * Representation of a path element in a type annotation. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class TypePathInfo 29 | { 30 | public int u1typePathKind; 31 | public int u1typeArgumentIndex; 32 | 33 | 34 | /** 35 | * Creates an uninitialized TypePathInfo. 36 | */ 37 | public TypePathInfo() 38 | { 39 | } 40 | 41 | 42 | /** 43 | * Creates an initialized TypePathInfo. 44 | */ 45 | public TypePathInfo(int u1typePathKind, int u1typeArgumentIndex) 46 | { 47 | this.u1typePathKind = u1typePathKind; 48 | this.u1typeArgumentIndex = u1typeArgumentIndex; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/proguard/util/OrMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher tests whether strings matches either of the given 25 | * StringMatcher instances. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class OrMatcher implements StringMatcher 30 | { 31 | private final StringMatcher matcher1; 32 | private final StringMatcher matcher2; 33 | 34 | 35 | public OrMatcher(StringMatcher matcher1, StringMatcher matcher2) 36 | { 37 | this.matcher1 = matcher1; 38 | this.matcher2 = matcher2; 39 | } 40 | 41 | 42 | // Implementations for StringMatcher. 43 | 44 | public boolean matches(String string) 45 | { 46 | return matcher1.matches(string) || 47 | matcher2.matches(string); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/NamedClassVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.ClassPool; 24 | 25 | 26 | /** 27 | * This class visits Clazz objects with the given name. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public class NamedClassVisitor implements ClassPoolVisitor 32 | { 33 | private final ClassVisitor classVisitor; 34 | private final String name; 35 | 36 | 37 | public NamedClassVisitor(ClassVisitor classVisitor, 38 | String name) 39 | { 40 | this.classVisitor = classVisitor; 41 | this.name = name; 42 | } 43 | 44 | 45 | public void visitClassPool(ClassPool classPool) 46 | { 47 | classPool.classAccept(name, classVisitor); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryPump.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import java.io.IOException; 24 | 25 | 26 | /** 27 | * This interface provides a method to pump data entries. The implementation 28 | * determines the source and the type of the data entries. Typical examples 29 | * are zip entries coming from a zip file of file entries coming from a 30 | * directory structure. The reader can for instance collect the classes, 31 | * or copy the resource files that are presented. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface DataEntryPump 36 | { 37 | /** 38 | * Applies the given DataEntryReader to all data entries that the 39 | * implementation can provide. 40 | */ 41 | public void pumpDataEntries(DataEntryReader dataEntryReader) 42 | throws IOException; 43 | } 44 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ClassCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | /** 26 | * This ClassVisitor counts the number of classes that has been visited. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public class ClassCounter implements ClassVisitor 31 | { 32 | private int count; 33 | 34 | 35 | /** 36 | * Returns the number of classes that has been visited so far. 37 | */ 38 | public int getCount() 39 | { 40 | return count; 41 | } 42 | 43 | 44 | // Implementations for ClassVisitor. 45 | 46 | public void visitLibraryClass(LibraryClass libraryClass) 47 | { 48 | count++; 49 | } 50 | 51 | 52 | public void visitProgramClass(ProgramClass programClass) 53 | { 54 | count++; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/proguard/classfile/VisitorAccepter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile; 22 | 23 | 24 | 25 | 26 | /** 27 | * This interface is a base interface for visitor accepters. It allows 28 | * visitors to set and get any temporary information they desire on the 29 | * objects they are visiting. Note that every visitor accepter has only one 30 | * such property, so visitors will have to take care not to overwrite each 31 | * other's information, if it is still required. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface VisitorAccepter 36 | { 37 | /** 38 | * Gets the visitor information of the visitor accepter. 39 | */ 40 | public Object getVisitorInfo(); 41 | 42 | 43 | /** 44 | * Sets the visitor information of the visitor accepter. 45 | */ 46 | public void setVisitorInfo(Object visitorInfo); 47 | } 48 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/ConstantTiming.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This Timing is constant over time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class ConstantTiming implements Timing 29 | { 30 | private final double timing; 31 | 32 | 33 | /** 34 | * Creates a new ConstantTiming with a value of 0. 35 | */ 36 | public ConstantTiming() 37 | { 38 | this(0.0); 39 | } 40 | 41 | /** 42 | * Creates a new ConstantTiming with a given value. 43 | * @param timing the constant value of the timing. 44 | */ 45 | public ConstantTiming(double timing) 46 | { 47 | this.timing = timing; 48 | } 49 | 50 | 51 | // Implementation for Timing. 52 | 53 | public double getTiming(long time) 54 | { 55 | return timing; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ClassPoolFiller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.util.SimplifiedVisitor; 25 | 26 | 27 | /** 28 | * This ClassVisitor collects all the classes it visits in a given 29 | * class pool. 30 | * 31 | * @author Eric Lafortune 32 | */ 33 | public class ClassPoolFiller 34 | extends SimplifiedVisitor 35 | implements ClassVisitor 36 | { 37 | private final ClassPool classPool; 38 | 39 | 40 | /** 41 | * Creates a new ClassPoolFiller. 42 | */ 43 | public ClassPoolFiller(ClassPool classPool) 44 | { 45 | this.classPool = classPool; 46 | } 47 | 48 | 49 | // Implementations for ClassVisitor. 50 | 51 | public void visitAnyClass(Clazz clazz) 52 | { 53 | classPool.addClass(clazz); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/target/visitor/LocalVariableTargetElementVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.annotation.target.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.CodeAttribute; 25 | import proguard.classfile.attribute.annotation.TypeAnnotation; 26 | import proguard.classfile.attribute.annotation.target.*; 27 | 28 | /** 29 | * This interface specifies the methods for a visitor of LocalVariableTargetElement 30 | * instances. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public interface LocalVariableTargetElementVisitor 35 | { 36 | public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement); 37 | } 38 | -------------------------------------------------------------------------------- /src/proguard/obfuscate/MapCleaner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.obfuscate; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.util.SimplifiedVisitor; 25 | import proguard.classfile.visitor.ClassVisitor; 26 | 27 | import java.util.Map; 28 | 29 | /** 30 | * This ClassVisitor clears a given map whenever it visits a class. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public class MapCleaner 35 | extends SimplifiedVisitor 36 | implements ClassVisitor 37 | { 38 | private final Map map; 39 | 40 | 41 | /** 42 | * Creates a new MapCleaner. 43 | * @param map the map to be cleared. 44 | */ 45 | public MapCleaner(Map map) 46 | { 47 | this.map = map; 48 | } 49 | 50 | 51 | // Implementations for ClassVisitor. 52 | 53 | public void visitAnyClass(Clazz clazz) 54 | { 55 | map.clear(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/optimize/info/ClassOptimizationInfoSetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.optimize.info; 22 | 23 | import proguard.classfile.ProgramClass; 24 | import proguard.classfile.util.SimplifiedVisitor; 25 | import proguard.classfile.visitor.ClassVisitor; 26 | import proguard.optimize.KeepMarker; 27 | 28 | /** 29 | * This ClassVisitor attaches a ClassOptimizationInfo instance to every class 30 | * that is not being kept that it visits. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public class ClassOptimizationInfoSetter 35 | extends SimplifiedVisitor 36 | implements ClassVisitor 37 | { 38 | // Implementations for MemberVisitor. 39 | 40 | public void visitProgramClass(ProgramClass programClass) 41 | { 42 | if (!KeepMarker.isKept(programClass)) 43 | { 44 | ClassOptimizationInfo.setClassOptimizationInfo(programClass); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /docs/sections.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Sections 9 | 10 | 11 | 12 | 26 | 27 |

28 |

29 | More Android code protection: 30 |

31 | 32 | Saikoa 33 | 34 |

35 | With support of 36 | 37 |

38 | 39 | DexGuard 40 | 41 |

42 | 43 | SourceForge 44 | 45 |

46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/proguard/ParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard; 22 | 23 | 24 | /** 25 | * This Exception signals that a parse exception of some 26 | * sort has occurred. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public class ParseException extends Exception { 31 | 32 | /** 33 | * Constructs a ParseException with null 34 | * as its error detail message. 35 | */ 36 | public ParseException() { 37 | super(); 38 | } 39 | 40 | /** 41 | * Constructs a ParseException with the specified detail 42 | * message. The error message string s can later be 43 | * retrieved by the {@link Throwable#getMessage} 44 | * method of class Throwable. 45 | * 46 | * @param s the detail message. 47 | */ 48 | public ParseException(String s) { 49 | super(s); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ExceptionCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.*; 25 | import proguard.classfile.attribute.visitor.ExceptionInfoVisitor; 26 | 27 | /** 28 | * This ExceptionInfoVisitor counts the number of exceptions that has been visited. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class ExceptionCounter implements ExceptionInfoVisitor 33 | { 34 | private int count; 35 | 36 | 37 | /** 38 | * Returns the number of exceptions that has been visited so far. 39 | */ 40 | public int getCount() 41 | { 42 | return count; 43 | } 44 | 45 | 46 | // Implementations for ExceptionInfoVisitor. 47 | 48 | public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo) 49 | { 50 | count++; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryParentFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | /** 24 | * This DataEntryFilter delegates filtering to a DataEntryFilter for its parent. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class DataEntryParentFilter 29 | implements DataEntryFilter 30 | { 31 | private final DataEntryFilter dataEntryFilter; 32 | 33 | 34 | /** 35 | * Creates a new ParentFilter. 36 | * @param dataEntryFilter the filter that will be applied to the data 37 | * entry's parent. 38 | */ 39 | public DataEntryParentFilter(DataEntryFilter dataEntryFilter) 40 | { 41 | this.dataEntryFilter = dataEntryFilter; 42 | } 43 | 44 | 45 | // Implementations for DataEntryFilter. 46 | 47 | public boolean accepts(DataEntry dataEntry) 48 | { 49 | return dataEntry != null && dataEntryFilter.accepts(dataEntry.getParent()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/AllFieldVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | 26 | /** 27 | * This ClassVisitor lets a given MemberVisitor visit all FieldMember 28 | * objects of the classes it visits. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class AllFieldVisitor implements ClassVisitor 33 | { 34 | private final MemberVisitor memberVisitor; 35 | 36 | 37 | public AllFieldVisitor(MemberVisitor memberVisitor) 38 | { 39 | this.memberVisitor = memberVisitor; 40 | } 41 | 42 | 43 | // Implementations for ClassVisitor. 44 | 45 | public void visitProgramClass(ProgramClass programClass) 46 | { 47 | programClass.fieldsAccept(memberVisitor); 48 | } 49 | 50 | 51 | public void visitLibraryClass(LibraryClass libraryClass) 52 | { 53 | libraryClass.fieldsAccept(memberVisitor); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/AllMethodVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | 26 | /** 27 | * This ClassVisitor lets a given MemberVisitor visit all MethodMember 28 | * objects of the classes it visits. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class AllMethodVisitor implements ClassVisitor 33 | { 34 | private final MemberVisitor memberVisitor; 35 | 36 | 37 | public AllMethodVisitor(MemberVisitor memberVisitor) 38 | { 39 | this.memberVisitor = memberVisitor; 40 | } 41 | 42 | 43 | // Implementations for ClassVisitor. 44 | 45 | public void visitProgramClass(ProgramClass programClass) 46 | { 47 | programClass.methodsAccept(memberVisitor); 48 | } 49 | 50 | 51 | public void visitLibraryClass(LibraryClass libraryClass) 52 | { 53 | libraryClass.methodsAccept(memberVisitor); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /examples/proguardgui.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This ProGuard configuration file illustrates how to process the ProGuard GUI. 3 | # Configuration files for typical applications will be very similar. 4 | # Usage: 5 | # java -jar proguard.jar @proguardgui.pro 6 | # 7 | 8 | # Specify the input jars, output jars, and library jars. 9 | # The input jars will be merged in a single output jar. 10 | # We'll filter out the Ant classes, Gradle classes, and WTK classes, keeping 11 | # everything else. 12 | 13 | -injars ../lib/proguardgui.jar 14 | -injars ../lib/proguard.jar(!META-INF/**,!proguard/ant/**,!proguard/gradle/**,!proguard/wtk/**) 15 | -injars ../lib/retrace.jar (!META-INF/**) 16 | -outjars proguardgui_out.jar 17 | 18 | -libraryjars /lib/rt.jar 19 | 20 | # If we wanted to reuse the previously obfuscated proguard_out.jar, we could 21 | # perform incremental obfuscation based on its mapping file, and only keep the 22 | # additional GUI files instead of all files. 23 | 24 | #-applymapping proguard.map 25 | #-injars ../lib/proguardgui.jar 26 | #-outjars proguardgui_out.jar 27 | #-libraryjars ../lib/proguard.jar(!proguard/ant/**,!proguard/wtk/**) 28 | #-libraryjars ../lib/retrace.jar 29 | #-libraryjars /lib/rt.jar 30 | 31 | 32 | # Allow methods with the same signature, except for the return type, 33 | # to get the same obfuscation name. 34 | 35 | -overloadaggressively 36 | 37 | # Put all obfuscated classes into the nameless root package. 38 | 39 | -repackageclasses '' 40 | 41 | # Adapt the names of resource files, based on the corresponding obfuscated 42 | # class names. Notably, in this case, the GUI resource properties file will 43 | # have to be renamed. 44 | 45 | -adaptresourcefilenames **.properties,**.gif,**.jpg 46 | 47 | # The entry point: ProGuardGUI and its main method. 48 | 49 | -keep public class proguard.gui.ProGuardGUI { 50 | public static void main(java.lang.String[]); 51 | } 52 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/SineTiming.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This Timing varies between 0 and 1, as a sine wave over time. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class SineTiming implements Timing 29 | { 30 | private final long period; 31 | private final long phase; 32 | 33 | 34 | /** 35 | * Creates a new SineTiming. 36 | * @param period the time period for a full cycle. 37 | * @param phase the phase of the cycle, which is added to the actual time. 38 | */ 39 | public SineTiming(long period, long phase) 40 | { 41 | this.period = period; 42 | this.phase = phase; 43 | } 44 | 45 | 46 | // Implementation for Timing. 47 | 48 | public double getTiming(long time) 49 | { 50 | // Compute the translated and scaled sine function. 51 | return 0.5 + 0.5 * Math.sin(2.0 * Math.PI * (time + phase) / period); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /examples/ant/midlets.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/ClassCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.util.SimplifiedVisitor; 25 | 26 | import java.util.Set; 27 | 28 | /** 29 | * This ClassVisitor collects the classes that it visits in the 30 | * given collection. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public class ClassCollector 35 | extends SimplifiedVisitor 36 | implements ClassVisitor 37 | { 38 | private final Set set; 39 | 40 | 41 | /** 42 | * Creates a new ClassCollector. 43 | * @param set the Set in which all class names will be 44 | * collected. 45 | */ 46 | public ClassCollector(Set set) 47 | { 48 | this.set = set; 49 | } 50 | 51 | 52 | // Implementations for ClassVisitor. 53 | 54 | public void visitAnyClass(Clazz clazz) 55 | { 56 | set.add(clazz); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/proguard/classfile/constant/visitor/AllConstantVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.constant.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.visitor.ClassVisitor; 25 | 26 | 27 | /** 28 | * This ClassVisitor lets a given ConstantVisitor visit all constant pool 29 | * entries of the program classes it visits. 30 | * 31 | * @author Eric Lafortune 32 | */ 33 | public class AllConstantVisitor implements ClassVisitor 34 | { 35 | private final ConstantVisitor constantVisitor; 36 | 37 | 38 | public AllConstantVisitor(ConstantVisitor constantVisitor) 39 | { 40 | this.constantVisitor = constantVisitor; 41 | } 42 | 43 | 44 | // Implementations for ClassVisitor. 45 | 46 | public void visitProgramClass(ProgramClass programClass) 47 | { 48 | programClass.constantPoolEntriesAccept(constantVisitor); 49 | } 50 | 51 | 52 | public void visitLibraryClass(LibraryClass libraryClass) {} 53 | } 54 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/target/LocalVariableTargetElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.annotation.target; 22 | 23 | /** 24 | * Representation of an local variable target table entry. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class LocalVariableTargetElement 29 | { 30 | public int u2startPC; 31 | public int u2length; 32 | public int u2index; 33 | 34 | /** 35 | * Creates an uninitialized LocalVariableTargetElement. 36 | */ 37 | public LocalVariableTargetElement() 38 | { 39 | } 40 | 41 | 42 | /** 43 | * Creates an initialized LocalVariableTargetElement. 44 | */ 45 | public LocalVariableTargetElement(int u2startPC, 46 | int u2length, 47 | int u2index) 48 | { 49 | this.u2startPC = u2startPC; 50 | this.u2length = u2length; 51 | this.u2index = u2index; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/SawToothTiming.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This Timing ramps up linearly from 0 to 1 in a given repeated time interval. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class SawToothTiming implements Timing 29 | { 30 | private final long period; 31 | private final long phase; 32 | 33 | 34 | /** 35 | * Creates a new SawToothTiming. 36 | * @param period the time period for a full cycle. 37 | * @param phase the phase of the cycle, which is added to the actual time. 38 | */ 39 | public SawToothTiming(long period, long phase) 40 | { 41 | this.period = period; 42 | this.phase = phase; 43 | } 44 | 45 | 46 | // Implementation for Timing. 47 | 48 | public double getTiming(long time) 49 | { 50 | // Compute the translated and scaled saw-tooth function. 51 | return (double)((time + phase) % period) / (double)period; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/CompositeSprite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | import java.awt.*; 24 | 25 | /** 26 | * This Sprite is the composition of a list of Sprite objects. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public class CompositeSprite implements Sprite 31 | { 32 | private final Sprite[] sprites; 33 | 34 | 35 | /** 36 | * Creates a new CompositeSprite. 37 | * @param sprites the array of Sprite objects to which the painting will 38 | * be delegated, starting with the first element. 39 | */ 40 | public CompositeSprite(Sprite[] sprites) 41 | { 42 | this.sprites = sprites; 43 | } 44 | 45 | 46 | // Implementation for Sprite. 47 | 48 | public void paint(Graphics graphics, long time) 49 | { 50 | // Draw the sprites. 51 | for (int index = 0; index < sprites.length; index++) 52 | { 53 | sprites[index].paint(graphics, time); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/proguard/classfile/Member.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile; 22 | 23 | import proguard.classfile.visitor.*; 24 | 25 | /** 26 | * Representation of a field or method from a class. 27 | * 28 | * @author Eric Lafortune 29 | */ 30 | public interface Member extends VisitorAccepter 31 | { 32 | /** 33 | * Returns the access flags. 34 | */ 35 | public int getAccessFlags(); 36 | 37 | /** 38 | * Returns the class member name. 39 | */ 40 | public String getName(Clazz clazz); 41 | 42 | /** 43 | * Returns the class member's descriptor. 44 | */ 45 | public String getDescriptor(Clazz clazz); 46 | 47 | /** 48 | * Accepts the given class visitor. 49 | */ 50 | public void accept(Clazz clazz, MemberVisitor memberVisitor); 51 | 52 | /** 53 | * Lets the Clazz objects referenced in the descriptor string 54 | * accept the given visitor. 55 | */ 56 | public void referencedClassesAccept(ClassVisitor classVisitor); 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/io/DataEntryNameFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import proguard.util.StringMatcher; 24 | 25 | /** 26 | * This DataEntryFilter filters data entries based on whether their names match 27 | * a given StringMatcher. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public class DataEntryNameFilter 32 | implements DataEntryFilter 33 | { 34 | private final StringMatcher stringMatcher; 35 | 36 | 37 | /** 38 | * Creates a new DataEntryNameFilter. 39 | * @param stringMatcher the string matcher that will be applied to the names 40 | * of the filtered data entries. 41 | */ 42 | public DataEntryNameFilter(StringMatcher stringMatcher) 43 | { 44 | this.stringMatcher = stringMatcher; 45 | } 46 | 47 | 48 | // Implementations for DataEntryFilter. 49 | 50 | public boolean accepts(DataEntry dataEntry) 51 | { 52 | return dataEntry != null && stringMatcher.matches(dataEntry.getName()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/proguard/io/DirectoryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | /** 24 | * This DataEntryReader delegates to one of two other DataEntryReader instances, 25 | * depending on whether the data entry represents a directory or not. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class DirectoryFilter extends FilteredDataEntryReader 30 | { 31 | /** 32 | * Creates a new ClassFilter that delegates reading directories to the 33 | * given reader. 34 | */ 35 | public DirectoryFilter(DataEntryReader directoryReader) 36 | { 37 | this (directoryReader, null); 38 | } 39 | 40 | 41 | /** 42 | * Creates a new ClassFilter that delegates to either of the two given 43 | * readers. 44 | */ 45 | public DirectoryFilter(DataEntryReader directoryReader, 46 | DataEntryReader otherReader) 47 | { 48 | super(new DataEntryDirectoryFilter(), 49 | directoryReader, 50 | otherReader); 51 | } 52 | } -------------------------------------------------------------------------------- /src/proguard/classfile/editor/SubclassAdder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.editor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.visitor.ClassVisitor; 25 | 26 | /** 27 | * This ClassVisitor adds the given class to the list of subclasses of the 28 | * classes that it visits. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class SubclassAdder 33 | implements ClassVisitor 34 | { 35 | private final Clazz subclass; 36 | 37 | 38 | /** 39 | * Creates a new SubclassAdder that will add the given subclass. 40 | */ 41 | public SubclassAdder(Clazz subclass) 42 | { 43 | this.subclass = subclass; 44 | } 45 | 46 | 47 | // Implementations for ClassVisitor. 48 | 49 | public void visitProgramClass(ProgramClass programClass) 50 | { 51 | programClass.addSubClass(subclass); 52 | } 53 | 54 | 55 | public void visitLibraryClass(LibraryClass libraryClass) 56 | { 57 | libraryClass.addSubClass(subclass); 58 | } 59 | } -------------------------------------------------------------------------------- /src/proguard/FileWordReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard; 22 | 23 | import java.io.*; 24 | import java.net.URL; 25 | 26 | 27 | /** 28 | * A WordReader that returns words from a file or a URL. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class FileWordReader extends LineWordReader 33 | { 34 | /** 35 | * Creates a new FileWordReader for the given file. 36 | */ 37 | public FileWordReader(File file) throws IOException 38 | { 39 | super(new LineNumberReader(new BufferedReader(new FileReader(file))), 40 | "file '" + file.getPath() + "'", 41 | file.getParentFile() 42 | ); 43 | } 44 | 45 | 46 | /** 47 | * Creates a new FileWordReader for the given URL. 48 | */ 49 | public FileWordReader(URL url) throws IOException 50 | { 51 | super(new LineNumberReader(new BufferedReader(new InputStreamReader(url.openStream()))), 52 | "file '" + url.toString() + "'", 53 | null); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/obfuscate/NameFactoryResetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.obfuscate; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.visitor.ClassVisitor; 25 | 26 | /** 27 | * This ClassVisitor resets a given name factory whenever it visits a class 28 | * file. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class NameFactoryResetter implements ClassVisitor 33 | { 34 | private final NameFactory nameFactory; 35 | 36 | 37 | /** 38 | * Creates a new NameFactoryResetter. 39 | * @param nameFactory the name factory to be reset. 40 | */ 41 | public NameFactoryResetter(NameFactory nameFactory) 42 | { 43 | this.nameFactory = nameFactory; 44 | } 45 | 46 | 47 | // Implementations for ClassVisitor. 48 | 49 | public void visitProgramClass(ProgramClass programClass) 50 | { 51 | nameFactory.reset(); 52 | } 53 | 54 | 55 | public void visitLibraryClass(LibraryClass libraryClass) 56 | { 57 | nameFactory.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/AllMemberVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | 25 | 26 | /** 27 | * This ClassVisitor lets a given MemberVisitor visit all Member 28 | * objects of the classes it visits. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class AllMemberVisitor implements ClassVisitor 33 | { 34 | private final MemberVisitor memberVisitor; 35 | 36 | 37 | public AllMemberVisitor(MemberVisitor memberVisitor) 38 | { 39 | this.memberVisitor = memberVisitor; 40 | } 41 | 42 | 43 | // Implementations for ClassVisitor. 44 | 45 | public void visitProgramClass(ProgramClass programClass) 46 | { 47 | programClass.fieldsAccept(memberVisitor); 48 | programClass.methodsAccept(memberVisitor); 49 | } 50 | 51 | 52 | public void visitLibraryClass(LibraryClass libraryClass) 53 | { 54 | libraryClass.fieldsAccept(memberVisitor); 55 | libraryClass.methodsAccept(memberVisitor); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/LinearInt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This VariableColor varies linearly with respect to its Timing. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class LinearInt implements VariableInt 29 | { 30 | private final int fromValue; 31 | private final int toValue; 32 | private final Timing timing; 33 | 34 | 35 | /** 36 | * Creates a new LinearInt. 37 | * @param fromValue the value that corresponds to a timing of 0. 38 | * @param toValue the value that corresponds to a timing of 1. 39 | * @param timing the applied timing. 40 | */ 41 | public LinearInt(int fromValue, int toValue, Timing timing) 42 | { 43 | this.fromValue = fromValue; 44 | this.toValue = toValue; 45 | this.timing = timing; 46 | } 47 | 48 | 49 | // Implementation for VariableInt. 50 | 51 | public int getInt(long time) 52 | { 53 | return (int) (fromValue + timing.getTiming(time) * (toValue - fromValue)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/classfile/visitor/MemberCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.util.SimplifiedVisitor; 25 | 26 | import java.util.Set; 27 | 28 | /** 29 | * This MemberVisitor collects the concatenated name/descriptor strings of 30 | * class members that have been visited. 31 | * 32 | * @author Eric Lafortune 33 | */ 34 | public class MemberCollector 35 | extends SimplifiedVisitor 36 | implements MemberVisitor 37 | { 38 | private final Set set; 39 | 40 | 41 | /** 42 | * Creates a new MemberCollector. 43 | * @param set the Set in which all method names/descriptor 44 | * strings will be collected. 45 | */ 46 | public MemberCollector(Set set) 47 | { 48 | this.set = set; 49 | } 50 | 51 | 52 | // Implementations for MemberVisitor. 53 | 54 | 55 | public void visitAnyMember(Clazz clazz, Member member) 56 | { 57 | set.add(member.getName(clazz) + member.getDescriptor(clazz)); 58 | } 59 | } -------------------------------------------------------------------------------- /src/proguard/classfile/editor/SubclassToAdder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.editor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.visitor.ClassVisitor; 25 | 26 | /** 27 | * This ClassVisitor adds all classes that it visits to the list of subclasses 28 | * of the given target class. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | public class SubclassToAdder 33 | implements ClassVisitor 34 | { 35 | private final Clazz targetClass; 36 | 37 | 38 | /** 39 | * Creates a new SubclassAdder that will add subclasses to the given 40 | * target class. 41 | */ 42 | public SubclassToAdder(Clazz targetClass) 43 | { 44 | this.targetClass = targetClass; 45 | } 46 | 47 | 48 | // Implementations for ClassVisitor. 49 | 50 | public void visitProgramClass(ProgramClass programClass) 51 | { 52 | targetClass.addSubClass(programClass); 53 | } 54 | 55 | 56 | public void visitLibraryClass(LibraryClass libraryClass) 57 | { 58 | targetClass.addSubClass(libraryClass); 59 | } 60 | } -------------------------------------------------------------------------------- /src/proguard/util/FixedStringMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.util; 22 | 23 | /** 24 | * This StringMatcher tests whether strings start with a given fixed string 25 | * and then match another optional given StringMatcher. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | public class FixedStringMatcher implements StringMatcher 30 | { 31 | private final String fixedString; 32 | private final StringMatcher nextMatcher; 33 | 34 | 35 | public FixedStringMatcher(String fixedString) 36 | { 37 | this(fixedString, null); 38 | } 39 | 40 | 41 | public FixedStringMatcher(String fixedString, StringMatcher nextMatcher) 42 | { 43 | this.fixedString = fixedString; 44 | this.nextMatcher = nextMatcher; 45 | } 46 | 47 | 48 | // Implementations for StringMatcher. 49 | 50 | public boolean matches(String string) 51 | { 52 | return string.startsWith(fixedString) && 53 | (nextMatcher == null || 54 | nextMatcher.matches(string.substring(fixedString.length()))); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/proguard/gui/splash/LinearDouble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This VariableDouble varies linearly with respect to its Timing. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class LinearDouble implements VariableDouble 29 | { 30 | private final double fromValue; 31 | private final double toValue; 32 | private final Timing timing; 33 | 34 | 35 | /** 36 | * Creates a new LinearDouble. 37 | * @param fromValue the value that corresponds to a timing of 0. 38 | * @param toValue the value that corresponds to a timing of 1. 39 | * @param timing the applied timing. 40 | */ 41 | public LinearDouble(double fromValue, double toValue, Timing timing) 42 | { 43 | this.fromValue = fromValue; 44 | this.toValue = toValue; 45 | this.timing = timing; 46 | } 47 | 48 | 49 | // Implementation for VariableDouble. 50 | 51 | public double getDouble(long time) 52 | { 53 | return fromValue + timing.getTiming(time) * (toValue - fromValue); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedLongValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This LongValue represents a long value that is converted from another 25 | * scalar value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedLongValue extends SpecificLongValue 30 | { 31 | private final Value value; 32 | 33 | 34 | /** 35 | * Creates a new converted long value of the given value. 36 | */ 37 | public ConvertedLongValue(Value value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedLongValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(long)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedFloatValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This FloatValue represents a float value that is converted from another 25 | * scalar value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedFloatValue extends SpecificFloatValue 30 | { 31 | private final Value value; 32 | 33 | 34 | /** 35 | * Creates a new converted float value of the given value. 36 | */ 37 | public ConvertedFloatValue(Value value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedFloatValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(float)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/gui/splash/LinearTiming.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui.splash; 22 | 23 | /** 24 | * This Timing ramps up linearly from 0 to 1 in a given time interval. 25 | * 26 | * @author Eric Lafortune 27 | */ 28 | public class LinearTiming implements Timing 29 | { 30 | private final long fromTime; 31 | private final long toTime; 32 | 33 | 34 | /** 35 | * Creates a new LinearTiming. 36 | * @param fromTime the time at which the timing starts ramping up from 0. 37 | * @param toTime the time at which the timing stops ramping up at 1. 38 | */ 39 | public LinearTiming(long fromTime, long toTime) 40 | { 41 | this.fromTime = fromTime; 42 | this.toTime = toTime; 43 | } 44 | 45 | 46 | // Implementation for Timing. 47 | 48 | public double getTiming(long time) 49 | { 50 | // Compute the clamped linear interpolation. 51 | return time <= fromTime ? 0.0 : 52 | time >= toTime ? 1.0 : 53 | (double)(time - fromTime) / (double)(toTime - fromTime); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedDoubleValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This DoubleValue represents a double value that is converted from another 25 | * scalar value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedDoubleValue extends SpecificDoubleValue 30 | { 31 | private final Value value; 32 | 33 | 34 | /** 35 | * Creates a new converted double value of the given value. 36 | */ 37 | public ConvertedDoubleValue(Value value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedDoubleValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(double)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/io/DataEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import java.io.*; 24 | 25 | /** 26 | * This interface describes a data entry, e.g. a ZIP entry, a file, or a 27 | * directory. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public interface DataEntry 32 | { 33 | /** 34 | * Returns the name of this data entry. 35 | */ 36 | public String getName(); 37 | 38 | /** 39 | * Returns whether the data entry represents a directory. 40 | */ 41 | public boolean isDirectory(); 42 | 43 | 44 | /** 45 | * Returns an input stream for reading the content of this data entry. 46 | * The data entry may not represent a directory. 47 | */ 48 | public InputStream getInputStream() throws IOException; 49 | 50 | 51 | /** 52 | * Closes the previously retrieved InputStream. 53 | */ 54 | public void closeInputStream() throws IOException; 55 | 56 | 57 | /** 58 | * Returns the parent of this data entry, or null if it doesn't 59 | * have one. 60 | */ 61 | public DataEntry getParent(); 62 | } 63 | -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedByteValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This IntegerValue represents a byte value that is converted from an 25 | * integer value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedByteValue extends SpecificIntegerValue 30 | { 31 | private final IntegerValue value; 32 | 33 | 34 | /** 35 | * Creates a new converted byte value of the given integer value. 36 | */ 37 | public ConvertedByteValue(IntegerValue value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedByteValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(byte)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedIntegerValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This IntegerValue represents a integer value that is converted from another 25 | * scalar value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedIntegerValue extends SpecificIntegerValue 30 | { 31 | private final Value value; 32 | 33 | 34 | /** 35 | * Creates a new converted integer value of the given value. 36 | */ 37 | public ConvertedIntegerValue(Value value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedIntegerValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(int)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /examples/annotations/examples.pro: -------------------------------------------------------------------------------- 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 | -outjars out 13 | 14 | -libraryjars /lib/rt.jar 15 | 16 | # Some important configuration is based on the annotations in the code. 17 | # We have to specify what the annotations mean to ProGuard. 18 | 19 | -include lib/annotations.pro 20 | 21 | # 22 | # We can then still add any other options that might be useful. 23 | # 24 | 25 | # Print out a list of what we're preserving. 26 | 27 | -printseeds 28 | 29 | # Preserve all annotations themselves. 30 | 31 | -keepattributes *Annotation* 32 | 33 | # Preserve all native method names and the names of their classes. 34 | 35 | -keepclasseswithmembernames,includedescriptorclasses class * { 36 | native ; 37 | } 38 | 39 | # Preserve the special static methods that are required in all enumeration 40 | # classes. 41 | 42 | -keepclassmembers,allowoptimization enum * { 43 | public static **[] values(); 44 | public static ** valueOf(java.lang.String); 45 | } 46 | 47 | # Explicitly preserve all serialization members. The Serializable interface 48 | # is only a marker interface, so it wouldn't save them. 49 | # You can comment this out if your application doesn't use serialization. 50 | # If your code contains serializable classes that have to be backward 51 | # compatible, please refer to the manual. 52 | 53 | -keepclassmembers class * implements java.io.Serializable { 54 | static final long serialVersionUID; 55 | static final java.io.ObjectStreamField[] serialPersistentFields; 56 | private void writeObject(java.io.ObjectOutputStream); 57 | private void readObject(java.io.ObjectInputStream); 58 | java.lang.Object writeReplace(); 59 | java.lang.Object readResolve(); 60 | } 61 | -------------------------------------------------------------------------------- /examples/midlets.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This ProGuard configuration file illustrates how to process J2ME midlets. 3 | # Usage: 4 | # java -jar proguard.jar @midlets.pro 5 | # 6 | 7 | # Specify the input jars, output jars, and library jars. 8 | 9 | -injars in.jar 10 | -outjars out.jar 11 | 12 | -libraryjars /usr/local/java/wtk2.5.2/lib/midpapi20.jar 13 | -libraryjars /usr/local/java/wtk2.5.2/lib/cldcapi11.jar 14 | 15 | # Preverify the code suitably for Java Micro Edition. 16 | 17 | -microedition 18 | 19 | # Allow methods with the same signature, except for the return type, 20 | # to get the same obfuscation name. 21 | 22 | -overloadaggressively 23 | 24 | # Put all obfuscated classes into the nameless root package. 25 | 26 | -repackageclasses '' 27 | 28 | # Allow classes and class members to be made public. 29 | 30 | -allowaccessmodification 31 | 32 | # On Windows, you can't use mixed case class names, 33 | # should you still want to use the preverify tool. 34 | # 35 | # -dontusemixedcaseclassnames 36 | 37 | # Save the obfuscation mapping to a file, so you can de-obfuscate any stack 38 | # traces later on. 39 | 40 | -printmapping out.map 41 | 42 | # You can keep a fixed source file attribute and all line number tables to 43 | # get stack traces with line numbers. 44 | 45 | #-renamesourcefileattribute SourceFile 46 | #-keepattributes SourceFile,LineNumberTable 47 | 48 | # You can print out the seeds that are matching the keep options below. 49 | 50 | #-printseeds out.seeds 51 | 52 | # Preserve all public midlets. 53 | 54 | -keep public class * extends javax.microedition.midlet.MIDlet 55 | 56 | # Preserve all native method names and the names of their classes. 57 | 58 | -keepclasseswithmembernames,includedescriptorclasses class * { 59 | native ; 60 | } 61 | 62 | # Your midlet may contain more items that need to be preserved; 63 | # typically classes that are dynamically created using Class.forName: 64 | 65 | # -keep public class mypackage.MyClass 66 | # -keep public interface mypackage.MyInterface 67 | # -keep public class * implements mypackage.MyInterface 68 | -------------------------------------------------------------------------------- /src/proguard/evaluation/ClassConstantValueFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.constant.ClassConstant; 25 | import proguard.evaluation.value.ValueFactory; 26 | 27 | /** 28 | * This class creates java.lang.Class ReferenceValue instances that correspond 29 | * to specified constant pool entries. 30 | * 31 | * @author Eric Lafortune 32 | */ 33 | public class ClassConstantValueFactory 34 | extends ConstantValueFactory 35 | { 36 | public ClassConstantValueFactory(ValueFactory valueFactory) 37 | { 38 | super(valueFactory); 39 | } 40 | 41 | 42 | // Implementations for ConstantVisitor. 43 | 44 | public void visitClassConstant(Clazz clazz, ClassConstant classConstant) 45 | { 46 | // Create a Class reference instead of a reference to the class. 47 | value = valueFactory.createReferenceValue(ClassConstants.NAME_JAVA_LANG_CLASS, 48 | classConstant.javaLangClassClass, 49 | false); 50 | } 51 | } -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedShortValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This IntegerValue represents a short value that is converted from an 25 | * integer value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedShortValue extends SpecificIntegerValue 30 | { 31 | private final IntegerValue value; 32 | 33 | 34 | /** 35 | * Creates a new converted short value of the given integer value. 36 | */ 37 | public ConvertedShortValue(IntegerValue value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedShortValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(short)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/evaluation/value/DetailedValueFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | import proguard.classfile.*; 24 | 25 | /** 26 | * This identified value factory creates array reference values that also 27 | * represent their elements, in as far as possible. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public class DetailedValueFactory 32 | extends IdentifiedValueFactory 33 | { 34 | // Implementations for ReferenceValue. 35 | 36 | public ReferenceValue createArrayReferenceValue(String type, 37 | Clazz referencedClass, 38 | IntegerValue arrayLength) 39 | { 40 | return type == null ? 41 | REFERENCE_VALUE_NULL : 42 | new DetailedArrayReferenceValue(ClassConstants.TYPE_ARRAY + type, 43 | referencedClass, 44 | arrayLength, 45 | this, 46 | referenceID++); 47 | } 48 | } -------------------------------------------------------------------------------- /src/proguard/evaluation/value/ConvertedCharacterValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.evaluation.value; 22 | 23 | /** 24 | * This IntegerValue represents a character value that is converted from an 25 | * integer value. 26 | * 27 | * @author Eric Lafortune 28 | */ 29 | final class ConvertedCharacterValue extends SpecificIntegerValue 30 | { 31 | private final IntegerValue value; 32 | 33 | 34 | /** 35 | * Creates a new converted character value of the given integer value. 36 | */ 37 | public ConvertedCharacterValue(IntegerValue value) 38 | { 39 | this.value = value; 40 | } 41 | 42 | 43 | // Implementations for Object. 44 | 45 | public boolean equals(Object object) 46 | { 47 | return this == object || 48 | super.equals(object) && 49 | this.value.equals(((ConvertedCharacterValue)object).value); 50 | } 51 | 52 | 53 | public int hashCode() 54 | { 55 | return super.hashCode() ^ 56 | value.hashCode(); 57 | } 58 | 59 | 60 | public String toString() 61 | { 62 | return "(char)("+value+")"; 63 | } 64 | } -------------------------------------------------------------------------------- /src/proguard/gui/GUIResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.gui; 22 | 23 | import java.text.MessageFormat; 24 | import java.util.ResourceBundle; 25 | 26 | 27 | /** 28 | * This class provides some utility methods for working with resource bundles. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | class GUIResources 33 | { 34 | private static final ResourceBundle messages = ResourceBundle.getBundle(GUIResources.class.getName()); 35 | private static final MessageFormat formatter = new MessageFormat(""); 36 | 37 | 38 | /** 39 | * Returns an internationalized message, based on its key. 40 | */ 41 | public static String getMessage(String messageKey) 42 | { 43 | return messages.getString(messageKey); 44 | } 45 | 46 | 47 | /** 48 | * Returns an internationalized, formatted message, based on its key, with 49 | * the given arguments. 50 | */ 51 | public static String getMessage(String messageKey, Object[] messageArguments) 52 | { 53 | formatter.applyPattern(messages.getString(messageKey)); 54 | return formatter.format(messageArguments); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/proguard/io/ClassFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.io; 22 | 23 | import proguard.classfile.ClassConstants; 24 | import proguard.util.ExtensionMatcher; 25 | 26 | 27 | /** 28 | * This DataEntryReader delegates to one of two other DataEntryReader instances, 29 | * depending on the extension of the data entry. 30 | * 31 | * @author Eric Lafortune 32 | */ 33 | public class ClassFilter extends FilteredDataEntryReader 34 | { 35 | /** 36 | * Creates a new ClassFilter that delegates reading classes to the 37 | * given reader. 38 | */ 39 | public ClassFilter(DataEntryReader classReader) 40 | { 41 | this(classReader, null); 42 | } 43 | 44 | 45 | /** 46 | * Creates a new ClassFilter that delegates to either of the two given 47 | * readers. 48 | */ 49 | public ClassFilter(DataEntryReader classReader, 50 | DataEntryReader dataEntryReader) 51 | { 52 | super(new DataEntryNameFilter( 53 | new ExtensionMatcher(ClassConstants.CLASS_FILE_EXTENSION)), 54 | classReader, 55 | dataEntryReader); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/SourceDirAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.attribute.visitor.AttributeVisitor; 25 | 26 | /** 27 | * This Attribute represents a source directory attribute. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public class SourceDirAttribute extends Attribute 32 | { 33 | public int u2sourceDirIndex; 34 | 35 | 36 | /** 37 | * Creates an uninitialized SourceDirAttribute. 38 | */ 39 | public SourceDirAttribute() 40 | { 41 | } 42 | 43 | 44 | /** 45 | * Creates an initialized SourceDirAttribute. 46 | */ 47 | public SourceDirAttribute(int u2attributeNameIndex, 48 | int u2sourceDirIndex) 49 | { 50 | super(u2attributeNameIndex); 51 | 52 | this.u2sourceDirIndex = u2sourceDirIndex; 53 | } 54 | 55 | 56 | // Implementations for Attribute. 57 | 58 | public void accept(Clazz clazz, AttributeVisitor attributeVisitor) 59 | { 60 | attributeVisitor.visitSourceDirAttribute(clazz, this); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/SourceFileAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute; 22 | 23 | import proguard.classfile.Clazz; 24 | import proguard.classfile.attribute.visitor.AttributeVisitor; 25 | 26 | /** 27 | * This Attribute represents a source file attribute. 28 | * 29 | * @author Eric Lafortune 30 | */ 31 | public class SourceFileAttribute extends Attribute 32 | { 33 | public int u2sourceFileIndex; 34 | 35 | 36 | /** 37 | * Creates an uninitialized SourceFileAttribute. 38 | */ 39 | public SourceFileAttribute() 40 | { 41 | } 42 | 43 | 44 | /** 45 | * Creates an initialized SourceFileAttribute. 46 | */ 47 | public SourceFileAttribute(int u2attributeNameIndex, 48 | int u2sourceFileIndex) 49 | { 50 | super(u2attributeNameIndex); 51 | 52 | this.u2sourceFileIndex = u2sourceFileIndex; 53 | } 54 | 55 | 56 | // Implementations for Attribute. 57 | 58 | public void accept(Clazz clazz, AttributeVisitor attributeVisitor) 59 | { 60 | attributeVisitor.visitSourceFileAttribute(clazz, this); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/proguard/SubclassedClassFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.visitor.ClassVisitor; 25 | 26 | /** 27 | * This ClassVisitor delegates all its method calls to another ClassVisitor, 28 | * but only for Clazz objects that are being subclassed. 29 | * 30 | * @author Eric Lafortune 31 | */ 32 | final class SubclassedClassFilter 33 | implements ClassVisitor 34 | { 35 | private final ClassVisitor classVisitor; 36 | 37 | 38 | public SubclassedClassFilter(ClassVisitor classVisitor) 39 | { 40 | this.classVisitor = classVisitor; 41 | } 42 | 43 | 44 | // Implementations for ClassVisitor. 45 | 46 | public void visitProgramClass(ProgramClass programClass) 47 | { 48 | if (programClass.subClasses != null) 49 | { 50 | classVisitor.visitProgramClass(programClass); 51 | } 52 | } 53 | 54 | 55 | public void visitLibraryClass(LibraryClass libraryClass) 56 | { 57 | if (libraryClass.subClasses != null) 58 | { 59 | classVisitor.visitLibraryClass(libraryClass); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/proguard/classfile/attribute/annotation/visitor/TypeAnnotationVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 | * of Java bytecode. 4 | * 5 | * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | * more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | package proguard.classfile.attribute.annotation.visitor; 22 | 23 | import proguard.classfile.*; 24 | import proguard.classfile.attribute.CodeAttribute; 25 | import proguard.classfile.attribute.annotation.*; 26 | 27 | /** 28 | * This interface specifies the methods for a visitor of 29 | * TypeAnnotation instances. Note that there is only a single 30 | * implementation of TypeAnnotation, such that this interface 31 | * is not strictly necessary as a visitor. 32 | * 33 | * @author Eric Lafortune 34 | */ 35 | public interface TypeAnnotationVisitor 36 | { 37 | public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation); 38 | public void visitTypeAnnotation(Clazz clazz, Field field, TypeAnnotation typeAnnotation); 39 | public void visitTypeAnnotation(Clazz clazz, Method method, TypeAnnotation typeAnnotation); 40 | public void visitTypeAnnotation(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation); 41 | } 42 | --------------------------------------------------------------------------------