diff --git a/jode/jode/obfuscator/ClassIdentifier.java b/jode/jode/obfuscator/ClassIdentifier.java index af12863..391bb50 100644 --- a/jode/jode/obfuscator/ClassIdentifier.java +++ b/jode/jode/obfuscator/ClassIdentifier.java @@ -255,12 +255,18 @@ public class ClassIdentifier extends Identifier { identifiers[i].buildTable(renameRule); } - public void writeTable(PrintWriter out) throws IOException { - if (getName() != getAlias()) - out.println("" + getFullAlias() + " = " + getName()); + public void readTable(Hashtable table) { + super.readTable(table); for (int i=0; i < identifiers.length; i++) if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) - identifiers[i].writeTable(out); + identifiers[i].readTable(table); + } + + public void writeTable(Hashtable table) { + super.writeTable(table); + for (int i=0; i < identifiers.length; i++) + if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) + identifiers[i].writeTable(table); } public void addIfaces(Vector result, ClassInfo[] ifaces) { @@ -268,7 +274,7 @@ public class ClassIdentifier extends Identifier { ClassIdentifier ifaceident = (ClassIdentifier) bundle.getIdentifier(ifaces[i].getName()); if (ifaceident != null) { - if (ifaceident.isReachable()) + if (!Obfuscator.shouldStrip || ifaceident.isReachable()) result.addElement(ifaceident.getFullAlias()); else addIfaces(result, ifaceident.info.getInterfaces()); @@ -294,7 +300,7 @@ public class ClassIdentifier extends Identifier { ClassIdentifier superident = (ClassIdentifier) bundle.getIdentifier(superClass.getName()); if (superident != null) { - if (superident.isReachable()) { + if (!Obfuscator.shouldStrip || superident.isReachable()) { superName = superident.getFullAlias(); break; } else { @@ -311,7 +317,7 @@ public class ClassIdentifier extends Identifier { newSuperIfaces.copyInto(result); return result; } - + public void storeClass(DataOutputStream out) throws IOException { GrowableConstantPool gcp = new GrowableConstantPool(); diff --git a/jode/jode/obfuscator/Identifier.java b/jode/jode/obfuscator/Identifier.java index 5967f61..35d4417 100644 --- a/jode/jode/obfuscator/Identifier.java +++ b/jode/jode/obfuscator/Identifier.java @@ -19,6 +19,7 @@ package jode.obfuscator; import jode.Obfuscator; import java.io.*; +import java.util.Hashtable; public abstract class Identifier { /** @@ -115,7 +116,8 @@ public abstract class Identifier { } public final void setAlias(String name) { - getRepresentative().alias = name; + if (name != null) + getRepresentative().alias = name; } public final String getAlias() { @@ -207,9 +209,13 @@ public abstract class Identifier { } } - public void writeTable(PrintWriter out) throws IOException { - if (getName() != getAlias()) - out.println("" + getFullAlias() + " = " + getName()); + public void writeTable(Hashtable table) { + table.put(getFullAlias(), getName()); + } + + public void readTable(Hashtable table) { + if (isRepresentative()) + setAlias((String) table.get(getFullName())); } public abstract Identifier getParent();