|
|
@ -130,8 +130,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
if (superclass.getName().equals("java.lang.Serializable")) |
|
|
|
if (superclass.getName().equals("java.lang.Serializable")) |
|
|
|
preserveSerializable(); |
|
|
|
preserveSerializable(); |
|
|
|
|
|
|
|
|
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(superclass.getName()); |
|
|
|
= bundle.getClassIdentifier(superclass.getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
for (int i=superident.fieldCount; |
|
|
|
for (int i=superident.fieldCount; |
|
|
|
i < superident.identifiers.length; i++) { |
|
|
|
i < superident.identifiers.length; i++) { |
|
|
@ -150,7 +150,6 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// all methods and fields in superclass are preserved!
|
|
|
|
// all methods and fields in superclass are preserved!
|
|
|
|
MethodInfo[] topmethods = superclass.getMethods(); |
|
|
|
MethodInfo[] topmethods = superclass.getMethods(); |
|
|
|
FieldInfo[] topfields = superclass.getFields(); |
|
|
|
|
|
|
|
for (int i=0; i< topmethods.length; i++) { |
|
|
|
for (int i=0; i< topmethods.length; i++) { |
|
|
|
// all virtual methods in superclass may be
|
|
|
|
// all virtual methods in superclass may be
|
|
|
|
// virtually reachable
|
|
|
|
// virtually reachable
|
|
|
@ -181,7 +180,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void analyze() { |
|
|
|
public void analyze() { |
|
|
|
if (Obfuscator.isVerbose) |
|
|
|
if (Obfuscator.verboseLevel > 0) |
|
|
|
Obfuscator.err.println("Reachable: "+this); |
|
|
|
Obfuscator.err.println("Reachable: "+this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -234,8 +233,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
ClassIdentifier ifaceident = (ClassIdentifier) |
|
|
|
ClassIdentifier ifaceident |
|
|
|
bundle.getIdentifier(ifaces[i].getName()); |
|
|
|
= bundle.getClassIdentifier(ifaces[i].getName()); |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident != null) { |
|
|
|
ifaceident.addSubClass(this); |
|
|
|
ifaceident.addSubClass(this); |
|
|
|
} |
|
|
|
} |
|
|
@ -243,8 +242,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(info.getSuperclass().getName()); |
|
|
|
= bundle.getClassIdentifier(info.getSuperclass().getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
superident.addSubClass(this); |
|
|
|
superident.addSubClass(this); |
|
|
|
} |
|
|
|
} |
|
|
@ -275,8 +274,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
public void addIfaces(Vector result, ClassInfo[] ifaces) { |
|
|
|
public void addIfaces(Vector result, ClassInfo[] ifaces) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
ClassIdentifier ifaceident = (ClassIdentifier) |
|
|
|
ClassIdentifier ifaceident |
|
|
|
bundle.getIdentifier(ifaces[i].getName()); |
|
|
|
= bundle.getClassIdentifier(ifaces[i].getName()); |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident != null) { |
|
|
|
if (!Obfuscator.shouldStrip || ifaceident.isReachable()) |
|
|
|
if (!Obfuscator.shouldStrip || ifaceident.isReachable()) |
|
|
|
result.addElement(ifaceident.getFullAlias()); |
|
|
|
result.addElement(ifaceident.getFullAlias()); |
|
|
@ -301,8 +300,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
String superName = null; |
|
|
|
String superName = null; |
|
|
|
ClassInfo superClass = info.getSuperclass(); |
|
|
|
ClassInfo superClass = info.getSuperclass(); |
|
|
|
while (superClass != null) { |
|
|
|
while (superClass != null) { |
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(superClass.getName()); |
|
|
|
= bundle.getClassIdentifier(superClass.getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
if (!Obfuscator.shouldStrip || superident.isReachable()) { |
|
|
|
if (!Obfuscator.shouldStrip || superident.isReachable()) { |
|
|
|
superName = superident.getFullAlias(); |
|
|
|
superName = superident.getFullAlias(); |
|
|
@ -323,7 +322,7 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void storeClass(DataOutputStream out) throws IOException { |
|
|
|
public void storeClass(DataOutputStream out) throws IOException { |
|
|
|
if (Obfuscator.isVerbose) |
|
|
|
if (Obfuscator.verboseLevel > 0) |
|
|
|
Obfuscator.err.println("Writing "+this); |
|
|
|
Obfuscator.err.println("Writing "+this); |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
GrowableConstantPool gcp = new GrowableConstantPool(); |
|
|
|
|
|
|
|
|
|
|
@ -337,13 +336,13 @@ public class ClassIdentifier extends Identifier { |
|
|
|
hierarchyInts = new int[hierarchy.length]; |
|
|
|
hierarchyInts = new int[hierarchy.length]; |
|
|
|
for (int i=0; i< hierarchy.length; i++) { |
|
|
|
for (int i=0; i< hierarchy.length; i++) { |
|
|
|
if (hierarchy[i] != null) |
|
|
|
if (hierarchy[i] != null) |
|
|
|
hierarchyInts[i] = gcp.putClassRef(hierarchy[i]); |
|
|
|
hierarchyInts[i] = gcp.putClassName(hierarchy[i]); |
|
|
|
else |
|
|
|
else |
|
|
|
hierarchyInts[i] = 0; |
|
|
|
hierarchyInts[i] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
hierarchy = null; |
|
|
|
hierarchy = null; |
|
|
|
} |
|
|
|
} |
|
|
|
int nameIndex = gcp.putClassRef(getFullAlias()); |
|
|
|
int nameIndex = gcp.putClassName(getFullAlias()); |
|
|
|
|
|
|
|
|
|
|
|
int fields = 0; |
|
|
|
int fields = 0; |
|
|
|
int methods = 0; |
|
|
|
int methods = 0; |
|
|
@ -433,8 +432,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
ClassIdentifier ifaceident = (ClassIdentifier) |
|
|
|
ClassIdentifier ifaceident |
|
|
|
bundle.getIdentifier(ifaces[i].getName()); |
|
|
|
= bundle.getClassIdentifier(ifaces[i].getName()); |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident != null) { |
|
|
|
Identifier ident |
|
|
|
Identifier ident |
|
|
|
= ifaceident.getIdentifier(fieldName, typeSig); |
|
|
|
= ifaceident.getIdentifier(fieldName, typeSig); |
|
|
@ -444,8 +443,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(info.getSuperclass().getName()); |
|
|
|
= bundle.getClassIdentifier(info.getSuperclass().getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
Identifier ident |
|
|
|
Identifier ident |
|
|
|
= superident.getIdentifier(fieldName, typeSig); |
|
|
|
= superident.getIdentifier(fieldName, typeSig); |
|
|
@ -502,8 +501,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
|
|
|
|
|
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
ClassIdentifier ifaceident = (ClassIdentifier) |
|
|
|
ClassIdentifier ifaceident |
|
|
|
bundle.getIdentifier(ifaces[i].getName()); |
|
|
|
= bundle.getClassIdentifier(ifaces[i].getName()); |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident.containFieldAlias(fieldName, typeSig)) |
|
|
|
if (ifaceident.containFieldAlias(fieldName, typeSig)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -514,8 +513,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(info.getSuperclass().getName()); |
|
|
|
= bundle.getClassIdentifier(info.getSuperclass().getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
if (superident.containFieldAlias(fieldName, typeSig)) |
|
|
|
if (superident.containFieldAlias(fieldName, typeSig)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -573,8 +572,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
ClassInfo[] ifaces = info.getInterfaces(); |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
for (int i=0; i < ifaces.length; i++) { |
|
|
|
ClassIdentifier ifaceident = (ClassIdentifier) |
|
|
|
ClassIdentifier ifaceident |
|
|
|
bundle.getIdentifier(ifaces[i].getName()); |
|
|
|
= bundle.getClassIdentifier(ifaces[i].getName()); |
|
|
|
if (ifaceident != null) { |
|
|
|
if (ifaceident != null) { |
|
|
|
Object result = ifaceident.getMethod(methodName, paramType); |
|
|
|
Object result = ifaceident.getMethod(methodName, paramType); |
|
|
|
if (result != null) |
|
|
|
if (result != null) |
|
|
@ -587,8 +586,8 @@ public class ClassIdentifier extends Identifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
if (info.getSuperclass() != null) { |
|
|
|
ClassIdentifier superident = (ClassIdentifier) |
|
|
|
ClassIdentifier superident |
|
|
|
bundle.getIdentifier(info.getSuperclass().getName()); |
|
|
|
= bundle.getClassIdentifier(info.getSuperclass().getName()); |
|
|
|
if (superident != null) { |
|
|
|
if (superident != null) { |
|
|
|
Object result = superident.getMethod(methodName, paramType); |
|
|
|
Object result = superident.getMethod(methodName, paramType); |
|
|
|
if (result != null) |
|
|
|
if (result != null) |
|
|
|