Created ProGuard version 5.2.1.

This commit is contained in:
Eric Lafortune 2015-03-22 20:58:23 +01:00
Родитель 866c079b42
Коммит 1f82d67116
28 изменённых файлов: 91 добавлений и 64 удалений

12
README
Просмотреть файл

@ -3,12 +3,12 @@ ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier
This distribution contains the following directories:
- bin : simple wrapper scripts to run ProGuard, its GUI, and ReTrace
- lib : the main jars, compiled and ready to use with "java -jar ...."
- docs : the complete documentation, licenses, etc. in html format
- examples : some example configuration files
- src : the source code
- build : various alternative build scripts
- bin : simple wrapper scripts to run ProGuard, its GUI, and ReTrace
- lib : the main jars, compiled and ready to use with "java -jar ...."
- docs : the complete documentation, licenses, etc. in html format
- examples : some example configuration files
- src : the source code
- buildscripts : various alternative build scripts
The best place to start is docs/index.html

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -4,7 +4,7 @@ ANT_HOME = /usr/local/java/ant
GRADLE_HOME = /usr/local/java/gradle
WTK_HOME = /usr/local/java/wtk
PROGUARD_HOME := $(subst ./..,..,$(subst /build/..,/,$(dir $(MAKEFILE_LIST))..))
PROGUARD_HOME := $(subst ./..,..,$(subst /buildscripts/..,/,$(dir $(MAKEFILE_LIST))..))
SRC = $(PROGUARD_HOME)/src
CLASSES = $(PROGUARD_HOME)/classes
LIB = $(PROGUARD_HOME)/lib

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-anttask</artifactId>

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-base</artifactId>

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-gradle</artifactId>

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-gui</artifactId>

Просмотреть файл

@ -7,7 +7,7 @@
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<packaging>pom</packaging>
<name>[${project.groupId}] ${project.artifactId}</name>
<description>ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier.</description>

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-retrace</artifactId>

Просмотреть файл

@ -7,7 +7,7 @@
<parent>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-parent</artifactId>
<version>5.2</version>
<version>5.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>proguard-wtk-plugin</artifactId>

Просмотреть файл

@ -74,6 +74,11 @@ target="other">proguard-wtk-plugin</a>, and
<a href="http://search.maven.org/#search|ga|1|a:%22proguard-retrace%22"
target="other">proguard-retrace</a>.
<h3><div>In beta</div> Version 5.3</h3>
<ul>
<li>Fixed processing of wide branch instructions.
</ul>
<h3><div>Jan 2015</div> Version 5.2</h3>
<ul>
<li>Added encoding of optimized line numbers in ProGuard.

Двоичные данные
examples/annotations/lib/annotations.jar

Двоичный файл не отображается.

Просмотреть файл

@ -39,7 +39,7 @@ import java.io.*;
*/
public class ProGuard
{
public static final String VERSION = "ProGuard, version 5.2";
public static final String VERSION = "ProGuard, version 5.2.1";
private final Configuration configuration;
private ClassPool programClassPool = new ClassPool();

Просмотреть файл

@ -30,10 +30,12 @@ import proguard.classfile.visitor.*;
public class LibraryMethod extends LibraryMember implements Method
{
/**
* An extra field pointing to the Clazz objects referenced in the
* descriptor string. This field is filled out by the <code>{@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}</code>.
* References to primitive types are ignored.
* An extra field containing all the classes referenced in the
* descriptor string. This field is filled out by the {@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}.
* The size of the array is the number of classes in the descriptor.
* Primitive types and arrays of primitive types are ignored.
* Unknown classes are represented as null values.
*/
public Clazz[] referencedClasses;

Просмотреть файл

@ -32,10 +32,12 @@ import proguard.classfile.visitor.*;
public class ProgramMethod extends ProgramMember implements Method
{
/**
* An extra field pointing to the Clazz objects referenced in the
* descriptor string. This field is filled out by the <code>{@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}</code>.
* References to primitive types are ignored.
* An extra field containing all the classes referenced in the
* descriptor string. This field is filled out by the {@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}.
* The size of the array is the number of classes in the descriptor.
* Primitive types and arrays of primitive types are ignored.
* Unknown classes are represented as null values.
*/
public Clazz[] referencedClasses;

Просмотреть файл

@ -34,10 +34,12 @@ public class SignatureAttribute extends Attribute
public int u2signatureIndex;
/**
* An extra field pointing to the Clazz objects referenced in the
* signature string. This field is filled out by the <code>{@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}</code>.
* References to primitive types are ignored.
* An extra field containing all the classes referenced in the
* signature string. This field is filled out by the {@link
* proguard.classfile.util.ClassReferenceInitializer ClassReferenceInitializer}.
* The size of the array is the number of classes in the signature.
* Primitive types and arrays of primitive types are ignored.
* Unknown classes are represented as null values.
*/
public Clazz[] referencedClasses;

Просмотреть файл

@ -94,8 +94,9 @@ public class BranchInstruction extends Instruction
}
else
{
// Should we replace the ordinary branch by a wide branch?
if (opcode == InstructionConstants.OP_GOTO)
// Can we provide a wide branch?
if (opcode == InstructionConstants.OP_GOTO ||
opcode == InstructionConstants.OP_GOTO_W)
{
opcode = InstructionConstants.OP_GOTO_W;
}

Просмотреть файл

@ -105,10 +105,11 @@ implements InvocationUnit,
{
String type = internalTypeEnumeration.nextType();
Clazz referencedClass = referencedClasses != null &&
ClassUtil.isInternalClassType(type) ?
referencedClasses[referencedClassIndex++] :
null;
Clazz referencedClass =
referencedClasses != null &&
ClassUtil.isInternalClassType(type) ?
referencedClasses[referencedClassIndex++] :
null;
// Get the parameter value.
Value value = getMethodParameterValue(clazz,
@ -376,11 +377,14 @@ implements InvocationUnit,
// Try to figure out the class of the return type.
Clazz[] referencedClasses = invokeDynamicConstant.referencedClasses;
Clazz returnTypeClass = referencedClasses == null ? null :
referencedClasses[referencedClasses.length - 1];
Clazz referencedClass =
referencedClasses != null &&
ClassUtil.isInternalClassType(type) ?
referencedClasses[referencedClasses.length - 1] :
null;
return valueFactory.createValue(type,
returnTypeClass,
referencedClass,
true);
}
@ -396,7 +400,8 @@ implements InvocationUnit,
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
Clazz[] referencedClasses = programMethod.referencedClasses;
if (referencedClasses != null)
if (referencedClasses != null &&
ClassUtil.isInternalClassType(programMethod.getDescriptor(programClass)))
{
returnTypeClass = referencedClasses[referencedClasses.length - 1];
}
@ -409,10 +414,11 @@ implements InvocationUnit,
}
public void visitLibraryMethod(LibraryClass programClass, LibraryMethod programMethod)
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod)
{
Clazz[] referencedClasses = programMethod.referencedClasses;
if (referencedClasses != null)
Clazz[] referencedClasses = libraryMethod.referencedClasses;
if (referencedClasses != null &&
ClassUtil.isInternalClassType(libraryMethod.getDescriptor(libraryClass)))
{
returnTypeClass = referencedClasses[referencedClasses.length - 1];
}

Просмотреть файл

@ -25,7 +25,7 @@ preverification = Preverification
#
# Panel titles.
#
welcome = Welcome to ProGuard, version 5.2
welcome = Welcome to ProGuard, version 5.2.1
options = Options
keepAdditional = Keep additional classes and class members
keepNamesAdditional = Keep additional class names and class member names

Просмотреть файл

@ -226,7 +226,8 @@ implements ClassVisitor,
enclosingLineNumbers,
obfuscatedMethodName);
}
else
// TODO: There appear to be cases where the stack is empty at this point, so we've added a check.
else if (!enclosingLineNumbers.isEmpty())
{
// We're exiting an inlined block.
// Pop its enclosing line number.

Просмотреть файл

@ -635,12 +635,10 @@ implements ClassVisitor,
if (referencedClasses != null)
{
int returnedClassIndex =
new DescriptorClassEnumeration(descriptor).classCount() - 1;
Clazz referencedClass =
referencedClasses[referencedClasses.length - 1];
Clazz returnedClass = referencedClasses[returnedClassIndex];
return isSimpleEnum(returnedClass);
return isSimpleEnum(referencedClass);
}
}

Просмотреть файл

@ -483,10 +483,8 @@ implements AttributeVisitor,
if (referencedClasses != null)
{
int returnedClassIndex =
new DescriptorClassEnumeration(descriptor).classCount() - 1;
Clazz returnedClass = referencedClasses[returnedClassIndex];
Clazz returnedClass =
referencedClasses[referencedClasses.length - 1];
return isSimpleEnum(returnedClass);
}

Просмотреть файл

@ -177,6 +177,15 @@ implements ClassVisitor,
lineNumberInfo.u2lineNumber += currentLineNumberShift;
}
// TODO: There appear to be cases where the stack is empty at this point, so we've added a check.
else if (enclosingLineNumbers.isEmpty())
{
if (DEBUG)
{
System.err.println("Problem linearizing line numbers for optimized code ("+clazz.getName()+"."+method.getName(clazz)+")");
}
}
// Are we exiting an inlined block?
else
{
@ -197,7 +206,7 @@ implements ClassVisitor,
System.out.print(" (exit to shift "+currentLineNumberShift+")");
}
}
}
}
else
{
if (DEBUG)

Просмотреть файл

@ -49,8 +49,8 @@ implements AttributeVisitor,
MemberVisitor,
LineNumberInfoVisitor
{
static final int INLINED_METHOD_END_LINE_NUMBER = -1;
static final String INLINED_METHOD_END_SOURCE = "end";
static final int METHOD_DUMMY_START_LINE_NUMBER = 0;
static final int INLINED_METHOD_END_LINE_NUMBER = -1;
private static final int MAXIMUM_INLINED_CODE_LENGTH = Integer.parseInt(System.getProperty("maximum.inlined.code.length", "8"));
private static final int MAXIMUM_RESULTING_CODE_LENGTH_JSE = Integer.parseInt(System.getProperty("maximum.resulting.code.length", "7000"));
@ -395,8 +395,8 @@ implements AttributeVisitor,
minimumLineNumberIndex =
codeAttributeComposer.insertLineNumber(minimumLineNumberIndex,
new ExtendedLineNumberInfo(0,
0,
source));
METHOD_DUMMY_START_LINE_NUMBER,
source)) + 1;
}
// Add a marker at the end of an inlined method.
@ -407,14 +407,14 @@ implements AttributeVisitor,
String source =
clazz.getName() + '.' +
method.getName(clazz) +
method.getDescriptor(clazz) + ':' +
INLINED_METHOD_END_SOURCE;
method.getDescriptor(clazz) +
":0:0";
minimumLineNumberIndex =
codeAttributeComposer.insertLineNumber(minimumLineNumberIndex,
new ExtendedLineNumberInfo(codeAttribute.u4codeLength,
INLINED_METHOD_END_LINE_NUMBER,
source));
source)) + 1;
}
codeAttributeComposer.endCodeFragment();

Просмотреть файл

@ -181,8 +181,8 @@ implements ClassVisitor,
/**
* This MemberVisitor marks ProgramField and ProgramMethod objects that
* have already been marked as possibly used.
* This MemberVisitor marks ProgramMethod objects of default
* implementations that may be present in interface classes.
*/
private class MyDefaultMethodUsageMarker
extends SimplifiedVisitor
@ -380,6 +380,8 @@ implements ClassVisitor,
*/
protected void markMethodHierarchy(Clazz clazz, Method method)
{
// Only visit the hierarchy if the method is not private, static, or
// an initializer.
int accessFlags = method.getAccessFlags();
if ((accessFlags &
(ClassConstants.ACC_PRIVATE |
@ -395,12 +397,13 @@ implements ClassVisitor,
((accessFlags & ClassConstants.ACC_PUBLIC) == 0 ? 0 :
ClassConstants.ACC_ABSTRACT);
// Mark default implementations in interfaces down the hierarchy.
// Mark default implementations in interfaces down the hierarchy,
// if this is an interface itself.
// TODO: This may be premature if there aren't any concrete implementing classes.
clazz.accept(new ClassAccessFilter(ClassConstants.ACC_ABSTRACT, 0,
clazz.accept(new ClassAccessFilter(ClassConstants.ACC_INTERFACE, 0,
new ClassHierarchyTraveler(false, false, false, true,
new ProgramClassFilter(
new ClassAccessFilter(ClassConstants.ACC_ABSTRACT, 0,
new ClassAccessFilter(ClassConstants.ACC_INTERFACE, 0,
new NamedMethodVisitor(method.getName(clazz),
method.getDescriptor(clazz),
new MemberAccessFilter(0, requiredUnsetAccessFlags,