|
|
@ -216,21 +216,10 @@ public class ClassIdentifier extends Identifier { |
|
|
|
preserveIdentifier("<init>", null); |
|
|
|
preserveIdentifier("<init>", null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void strip() { |
|
|
|
|
|
|
|
willStrip = true; |
|
|
|
|
|
|
|
if (Obfuscator.isDebugging) { |
|
|
|
|
|
|
|
for (int i=0; i < identifiers.length; i++) { |
|
|
|
|
|
|
|
if (!identifiers[i].isReachable()) |
|
|
|
|
|
|
|
Obfuscator.err.println(identifiers[i].toString() |
|
|
|
|
|
|
|
+ " is stripped"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void buildTable(int renameRule) { |
|
|
|
public void buildTable(int renameRule) { |
|
|
|
super.buildTable(renameRule); |
|
|
|
super.buildTable(renameRule); |
|
|
|
for (int i=0; i < identifiers.length; i++) |
|
|
|
for (int i=0; i < identifiers.length; i++) |
|
|
|
if (!willStrip || identifiers[i].isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
identifiers[i].buildTable(renameRule); |
|
|
|
identifiers[i].buildTable(renameRule); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -238,7 +227,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
if (getName() != getAlias()) |
|
|
|
if (getName() != getAlias()) |
|
|
|
out.println("" + getFullAlias() + " = " + getName()); |
|
|
|
out.println("" + getFullAlias() + " = " + getName()); |
|
|
|
for (int i=0; i < identifiers.length; i++) |
|
|
|
for (int i=0; i < identifiers.length; i++) |
|
|
|
if (!willStrip || identifiers[i].isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
identifiers[i].writeTable(out); |
|
|
|
identifiers[i].writeTable(out); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -295,7 +284,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) |
|
|
|
if (!willStrip || identifiers[i].isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
((MethodIdentifier)identifiers[i]).reserveSmallConstants(gcp); |
|
|
|
((MethodIdentifier)identifiers[i]).reserveSmallConstants(gcp); |
|
|
|
|
|
|
|
|
|
|
|
int[] hierarchyInts; |
|
|
|
int[] hierarchyInts; |
|
|
@ -316,13 +305,13 @@ public class ClassIdentifier extends Identifier { |
|
|
|
int methods = 0; |
|
|
|
int methods = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<fieldCount; i++) { |
|
|
|
for (int i=0; i<fieldCount; i++) { |
|
|
|
if (!willStrip || identifiers[i].isReachable()) { |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) { |
|
|
|
((FieldIdentifier)identifiers[i]).fillConstantPool(gcp); |
|
|
|
((FieldIdentifier)identifiers[i]).fillConstantPool(gcp); |
|
|
|
fields++; |
|
|
|
fields++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) { |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) { |
|
|
|
if (!willStrip || identifiers[i].isReachable()) { |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) { |
|
|
|
((MethodIdentifier)identifiers[i]).fillConstantPool(gcp); |
|
|
|
((MethodIdentifier)identifiers[i]).fillConstantPool(gcp); |
|
|
|
methods++; |
|
|
|
methods++; |
|
|
|
} |
|
|
|
} |
|
|
@ -341,13 +330,22 @@ public class ClassIdentifier extends Identifier { |
|
|
|
out.writeShort(hierarchyInts[i]); |
|
|
|
out.writeShort(hierarchyInts[i]); |
|
|
|
|
|
|
|
|
|
|
|
out.writeShort(fields); |
|
|
|
out.writeShort(fields); |
|
|
|
for (int i=0; i<fieldCount; i++) |
|
|
|
for (int i=0; i<fieldCount; i++) { |
|
|
|
if (!willStrip || identifiers[i].isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
((FieldIdentifier)identifiers[i]).write(out); |
|
|
|
((FieldIdentifier)identifiers[i]).write(out); |
|
|
|
|
|
|
|
else if (Obfuscator.isDebugging) |
|
|
|
|
|
|
|
Obfuscator.err.println(identifiers[i].toString() |
|
|
|
|
|
|
|
+ " is stripped"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
out.writeShort(methods); |
|
|
|
out.writeShort(methods); |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) |
|
|
|
for (int i=fieldCount; i < identifiers.length; i++) { |
|
|
|
if (!willStrip || identifiers[i].isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
((MethodIdentifier)identifiers[i]).write(out); |
|
|
|
((MethodIdentifier)identifiers[i]).write(out); |
|
|
|
|
|
|
|
else if (Obfuscator.isDebugging) |
|
|
|
|
|
|
|
Obfuscator.err.println(identifiers[i].toString() |
|
|
|
|
|
|
|
+ " is stripped"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
out.writeShort(0); // no attributes;
|
|
|
|
out.writeShort(0); // no attributes;
|
|
|
|
} |
|
|
|
} |
|
|
@ -439,7 +437,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public boolean containFieldAlias(String fieldName, String typeSig) { |
|
|
|
public boolean containFieldAlias(String fieldName, String typeSig) { |
|
|
|
for (int i=0; i < fieldCount; i++) { |
|
|
|
for (int i=0; i < fieldCount; i++) { |
|
|
|
if ((!willStrip || identifiers[i].isReachable()) |
|
|
|
if ((!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
&& identifiers[i].getAlias().equals(fieldName) |
|
|
|
&& identifiers[i].getAlias().equals(fieldName) |
|
|
|
&& identifiers[i].getType().startsWith(typeSig)) |
|
|
|
&& identifiers[i].getType().startsWith(typeSig)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -501,7 +499,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public Object getMethod(String methodName, String paramType) { |
|
|
|
public Object getMethod(String methodName, String paramType) { |
|
|
|
for (int i=fieldCount; i< identifiers.length; i++) { |
|
|
|
for (int i=fieldCount; i< identifiers.length; i++) { |
|
|
|
if ((!willStrip || identifiers[i].isReachable()) |
|
|
|
if ((!Obfuscator.shouldStrip || identifiers[i].isReachable()) |
|
|
|
&& identifiers[i].getAlias().equals(methodName) |
|
|
|
&& identifiers[i].getAlias().equals(methodName) |
|
|
|
&& identifiers[i].getType().startsWith(paramType)) |
|
|
|
&& identifiers[i].getType().startsWith(paramType)) |
|
|
|
return identifiers[i]; |
|
|
|
return identifiers[i]; |
|
|
@ -539,7 +537,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean conflicting(String newAlias) { |
|
|
|
public boolean conflicting(String newAlias, boolean strong) { |
|
|
|
return pack.contains(newAlias); |
|
|
|
return pack.contains(newAlias); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|