preserveRule

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@322 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 8ed9c73276
commit 0e8829443f
  1. 8
      jode/jode/obfuscator/FieldIdentifier.java
  2. 1
      jode/jode/obfuscator/Identifier.java
  3. 8
      jode/jode/obfuscator/MethodIdentifier.java
  4. 13
      jode/jode/obfuscator/PackageIdentifier.java

@ -17,6 +17,7 @@
* $Id$
*/
package jode.obfuscator;
import java.lang.reflect.Modifier;
import jode.bytecode.*;
import java.io.*;
@ -30,6 +31,13 @@ public class FieldIdentifier extends Identifier{
this.clazz = clazz;
}
public void applyPreserveRule(int preserveRule) {
if ((preserveRule & (info.getModifiers() ^ Modifier.PRIVATE)) != 0) {
setReachable();
setPreserved();
}
}
public void setSingleReachable() {
super.setSingleReachable();
String type = getType();

@ -218,6 +218,7 @@ public abstract class Identifier {
setAlias((String) table.get(getFullName()));
}
public abstract void applyPreserveRule(int preserveRule);
public abstract Identifier getParent();
public abstract String getName();
public abstract String getType();

@ -17,6 +17,7 @@
* $Id$
*/
package jode.obfuscator;
import java.lang.reflect.Modifier;
import jode.Obfuscator;
import jode.bytecode.*;
import java.io.*;
@ -55,6 +56,13 @@ public class MethodIdentifier extends Identifier implements Opcodes {
}
}
public void applyPreserveRule(int preserveRule) {
if ((preserveRule & (info.getModifiers() ^ Modifier.PRIVATE)) != 0) {
setReachable();
setPreserved();
}
}
/**
* Reads the opcodes out of the code info and determine its
* references

@ -46,8 +46,11 @@ public class PackageIdentifier extends Identifier {
}
public Identifier getIdentifier(String name) {
if (loadOnDemand)
return loadClass(name);
if (loadOnDemand) {
Identifier ident = loadClass(name);
if (bundle.preserveRule != -1)
ident.applyPreserveRule(bundle.preserveRule);
}
int index = name.indexOf('.');
if (index == -1)
@ -116,6 +119,12 @@ public class PackageIdentifier extends Identifier {
}
}
public void applyPreserveRule(int preserveRule) {
Enumeration enum = loadedClasses.elements();
while(enum.hasMoreElements())
((Identifier) enum.nextElement()).applyPreserveRule(preserveRule);
}
public void reachableIdentifier(String fqn, boolean isVirtual) {
int index = fqn.indexOf('.');
String component = index == -1 ? fqn : fqn.substring(0, index);

Loading…
Cancel
Save