git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@287 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent ca4f3f9cae
commit dad8dc308d
  1. 20
      jode/jode/obfuscator/ClassIdentifier.java
  2. 14
      jode/jode/obfuscator/Identifier.java

@ -255,12 +255,18 @@ public class ClassIdentifier extends Identifier {
identifiers[i].buildTable(renameRule); identifiers[i].buildTable(renameRule);
} }
public void writeTable(PrintWriter out) throws IOException { public void readTable(Hashtable table) {
if (getName() != getAlias()) super.readTable(table);
out.println("" + getFullAlias() + " = " + getName());
for (int i=0; i < identifiers.length; i++) for (int i=0; i < identifiers.length; i++)
if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) 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) { public void addIfaces(Vector result, ClassInfo[] ifaces) {
@ -268,7 +274,7 @@ public class ClassIdentifier extends Identifier {
ClassIdentifier ifaceident = (ClassIdentifier) ClassIdentifier ifaceident = (ClassIdentifier)
bundle.getIdentifier(ifaces[i].getName()); bundle.getIdentifier(ifaces[i].getName());
if (ifaceident != null) { if (ifaceident != null) {
if (ifaceident.isReachable()) if (!Obfuscator.shouldStrip || ifaceident.isReachable())
result.addElement(ifaceident.getFullAlias()); result.addElement(ifaceident.getFullAlias());
else else
addIfaces(result, ifaceident.info.getInterfaces()); addIfaces(result, ifaceident.info.getInterfaces());
@ -294,7 +300,7 @@ public class ClassIdentifier extends Identifier {
ClassIdentifier superident = (ClassIdentifier) ClassIdentifier superident = (ClassIdentifier)
bundle.getIdentifier(superClass.getName()); bundle.getIdentifier(superClass.getName());
if (superident != null) { if (superident != null) {
if (superident.isReachable()) { if (!Obfuscator.shouldStrip || superident.isReachable()) {
superName = superident.getFullAlias(); superName = superident.getFullAlias();
break; break;
} else { } else {
@ -311,7 +317,7 @@ public class ClassIdentifier extends Identifier {
newSuperIfaces.copyInto(result); newSuperIfaces.copyInto(result);
return result; return result;
} }
public void storeClass(DataOutputStream out) throws IOException { public void storeClass(DataOutputStream out) throws IOException {
GrowableConstantPool gcp = new GrowableConstantPool(); GrowableConstantPool gcp = new GrowableConstantPool();

@ -19,6 +19,7 @@
package jode.obfuscator; package jode.obfuscator;
import jode.Obfuscator; import jode.Obfuscator;
import java.io.*; import java.io.*;
import java.util.Hashtable;
public abstract class Identifier { public abstract class Identifier {
/** /**
@ -115,7 +116,8 @@ public abstract class Identifier {
} }
public final void setAlias(String name) { public final void setAlias(String name) {
getRepresentative().alias = name; if (name != null)
getRepresentative().alias = name;
} }
public final String getAlias() { public final String getAlias() {
@ -207,9 +209,13 @@ public abstract class Identifier {
} }
} }
public void writeTable(PrintWriter out) throws IOException { public void writeTable(Hashtable table) {
if (getName() != getAlias()) table.put(getFullAlias(), getName());
out.println("" + getFullAlias() + " = " + getName()); }
public void readTable(Hashtable table) {
if (isRepresentative())
setAlias((String) table.get(getFullName()));
} }
public abstract Identifier getParent(); public abstract Identifier getParent();

Loading…
Cancel
Save