Remove pool entry pool reference
This commit is contained in:
@@ -14,22 +14,22 @@ public class Class extends PoolEntry
|
||||
|
||||
public Class(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.CLASS);
|
||||
super(ConstantType.CLASS);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
index = is.readUnsignedShort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
name = this.getPool().getUTF8(index);
|
||||
name = pool.getUTF8(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
index = this.getPool().makeUTF8(name);
|
||||
index = pool.makeUTF8(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,16 +13,16 @@ public class Double extends PoolEntry
|
||||
|
||||
public Double(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.DOUBLE);
|
||||
super(ConstantType.DOUBLE);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
value = is.readDouble();
|
||||
}
|
||||
|
||||
public Double(ConstantPool pool, double d)
|
||||
public Double(double d)
|
||||
{
|
||||
super(pool, ConstantType.DOUBLE);
|
||||
super(ConstantType.DOUBLE);
|
||||
|
||||
value = d;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Field extends PoolEntry
|
||||
|
||||
public Field(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.FIELDREF);
|
||||
super(ConstantType.FIELDREF);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
@@ -23,17 +23,17 @@ public class Field extends PoolEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
clazz = this.getPool().getClass(classIndex);
|
||||
nat = this.getPool().getNameAndType(natIndex);
|
||||
clazz = pool.getClass(classIndex);
|
||||
nat = pool.getNameAndType(natIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
classIndex = this.getPool().make(clazz);
|
||||
natIndex = this.getPool().make(nat);
|
||||
classIndex = pool.make(clazz);
|
||||
natIndex = pool.make(nat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,16 +13,16 @@ public class Float extends PoolEntry
|
||||
|
||||
public Float(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.FLOAT);
|
||||
super(ConstantType.FLOAT);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
value = is.readFloat();
|
||||
}
|
||||
|
||||
public Float(ConstantPool pool, float f)
|
||||
public Float(float f)
|
||||
{
|
||||
super(pool, ConstantType.FLOAT);
|
||||
super(ConstantType.FLOAT);
|
||||
|
||||
value = f;
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ public class Integer extends PoolEntry
|
||||
|
||||
public Integer(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.INTEGER);
|
||||
super(ConstantType.INTEGER);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
value = is.readInt();
|
||||
}
|
||||
|
||||
public Integer(ConstantPool pool, int i)
|
||||
public Integer(int i)
|
||||
{
|
||||
super(pool, ConstantType.INTEGER);
|
||||
super(ConstantType.INTEGER);
|
||||
|
||||
value = i;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ public class InterfaceMethod extends PoolEntry
|
||||
private Class clazz;
|
||||
private NameAndType nat;
|
||||
|
||||
public InterfaceMethod(ConstantPool pool, Class clazz, NameAndType nat)
|
||||
public InterfaceMethod(Class clazz, NameAndType nat)
|
||||
{
|
||||
super(pool, ConstantType.INTERFACE_METHOD_REF);
|
||||
super(ConstantType.INTERFACE_METHOD_REF);
|
||||
|
||||
this.clazz = clazz;
|
||||
this.nat = nat;
|
||||
@@ -22,7 +22,7 @@ public class InterfaceMethod extends PoolEntry
|
||||
|
||||
public InterfaceMethod(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.INTERFACE_METHOD_REF);
|
||||
super(ConstantType.INTERFACE_METHOD_REF);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
@@ -31,17 +31,17 @@ public class InterfaceMethod extends PoolEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
clazz = this.getPool().getClass(classIndex);
|
||||
nat = this.getPool().getNameAndType(natIndex);
|
||||
clazz = pool.getClass(classIndex);
|
||||
nat = pool.getNameAndType(natIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
classIndex = this.getPool().make(clazz);
|
||||
natIndex = this.getPool().make(nat);
|
||||
classIndex = pool.make(clazz);
|
||||
natIndex = pool.make(nat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,16 +13,16 @@ public class Long extends PoolEntry
|
||||
|
||||
public Long(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.LONG);
|
||||
super(ConstantType.LONG);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
value = is.readLong();
|
||||
}
|
||||
|
||||
public Long(ConstantPool pool, long l)
|
||||
public Long(long l)
|
||||
{
|
||||
super(pool, ConstantType.LONG);
|
||||
super(ConstantType.LONG);
|
||||
|
||||
value = l;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ public class Method extends PoolEntry
|
||||
private Class clazz;
|
||||
private NameAndType nat;
|
||||
|
||||
public Method(ConstantPool pool, Class clazz, NameAndType nat)
|
||||
public Method(Class clazz, NameAndType nat)
|
||||
{
|
||||
super(pool, ConstantType.METHODREF);
|
||||
super(ConstantType.METHODREF);
|
||||
|
||||
this.clazz = clazz;
|
||||
this.nat = nat;
|
||||
@@ -22,7 +22,7 @@ public class Method extends PoolEntry
|
||||
|
||||
public Method(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.METHODREF);
|
||||
super(ConstantType.METHODREF);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
@@ -31,17 +31,17 @@ public class Method extends PoolEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
clazz = this.getPool().getClass(classIndex);
|
||||
nat = this.getPool().getNameAndType(natIndex);
|
||||
clazz = pool.getClass(classIndex);
|
||||
nat = pool.getNameAndType(natIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
classIndex = this.getPool().make(clazz);
|
||||
natIndex = this.getPool().make(nat);
|
||||
classIndex = pool.make(clazz);
|
||||
natIndex = pool.make(nat);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class NameAndType extends PoolEntry
|
||||
|
||||
public NameAndType(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.NAME_AND_TYPE);
|
||||
super(ConstantType.NAME_AND_TYPE);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
@@ -28,28 +28,20 @@ public class NameAndType extends PoolEntry
|
||||
descriptorIndex = is.readUnsignedShort();
|
||||
}
|
||||
|
||||
public NameAndType(ConstantPool pool, java.lang.String name, Signature sig)
|
||||
public NameAndType(java.lang.String name, Signature sig)
|
||||
{
|
||||
super(pool, ConstantType.NAME_AND_TYPE);
|
||||
super(ConstantType.NAME_AND_TYPE);
|
||||
|
||||
this.name = name;
|
||||
this.signature = sig;
|
||||
}
|
||||
|
||||
public NameAndType(java.lang.String name, Signature type)
|
||||
{
|
||||
super(null, ConstantType.NAME_AND_TYPE);
|
||||
|
||||
this.name = name;
|
||||
signature = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
name = this.getPool().getUTF8(nameIndex);
|
||||
name = pool.getUTF8(nameIndex);
|
||||
|
||||
java.lang.String sig = this.getPool().getUTF8(descriptorIndex);
|
||||
java.lang.String sig = pool.getUTF8(descriptorIndex);
|
||||
if (sig.startsWith("("))
|
||||
signature = new Signature(sig);
|
||||
else
|
||||
@@ -57,13 +49,13 @@ public class NameAndType extends PoolEntry
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
nameIndex = this.getPool().makeUTF8(name);
|
||||
nameIndex = pool.makeUTF8(name);
|
||||
if (signature != null)
|
||||
descriptorIndex = this.getPool().makeUTF8(signature.toString());
|
||||
descriptorIndex = pool.makeUTF8(signature.toString());
|
||||
else
|
||||
descriptorIndex = this.getPool().makeUTF8(type.toString());
|
||||
descriptorIndex = pool.makeUTF8(type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,23 +8,21 @@ import info.sigterm.deob.execution.Type;
|
||||
|
||||
public abstract class PoolEntry
|
||||
{
|
||||
public ConstantPool pool;
|
||||
private ConstantType type;
|
||||
public int id;
|
||||
|
||||
protected PoolEntry(ConstantPool pool, ConstantType type)
|
||||
protected PoolEntry(ConstantType type)
|
||||
{
|
||||
this.pool = pool;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// read objects from indexes
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
}
|
||||
|
||||
// make objects and prime indexes
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,11 +30,6 @@ public abstract class PoolEntry
|
||||
public abstract boolean equals(Object other);
|
||||
|
||||
public abstract void write(DataOutputStream out) throws IOException;
|
||||
|
||||
public ConstantPool getPool()
|
||||
{
|
||||
return pool;
|
||||
}
|
||||
|
||||
public ConstantType getType()
|
||||
{
|
||||
|
||||
@@ -14,30 +14,30 @@ public class String extends PoolEntry
|
||||
|
||||
public String(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.STRING);
|
||||
super(ConstantType.STRING);
|
||||
|
||||
DataInputStream is = pool.getClassFile().getStream();
|
||||
|
||||
stringIndex = is.readUnsignedShort();
|
||||
}
|
||||
|
||||
public String(ConstantPool pool, java.lang.String str)
|
||||
public String(java.lang.String str)
|
||||
{
|
||||
super(pool, ConstantType.STRING);
|
||||
super(ConstantType.STRING);
|
||||
|
||||
string = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve()
|
||||
public void resolve(ConstantPool pool)
|
||||
{
|
||||
string = this.getPool().getUTF8(stringIndex);
|
||||
string = pool.getUTF8(stringIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prime()
|
||||
public void prime(ConstantPool pool)
|
||||
{
|
||||
stringIndex = this.getPool().makeUTF8(string);
|
||||
stringIndex = pool.makeUTF8(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ public class UTF8 extends PoolEntry
|
||||
|
||||
public UTF8(ConstantPool pool) throws IOException
|
||||
{
|
||||
super(pool, ConstantType.UTF8);
|
||||
super(ConstantType.UTF8);
|
||||
|
||||
DataInputStream ios = pool.getClassFile().getStream();
|
||||
string = ios.readUTF();
|
||||
@@ -20,7 +20,7 @@ public class UTF8 extends PoolEntry
|
||||
|
||||
public UTF8(java.lang.String value)
|
||||
{
|
||||
super(null, ConstantType.UTF8);
|
||||
super(ConstantType.UTF8);
|
||||
|
||||
string = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user