Split datastream loading from classfile to prepare for tests
This commit is contained in:
@@ -16,7 +16,6 @@ public class ClassFile
|
|||||||
private static final int MAGIC = 0xcafebabe;
|
private static final int MAGIC = 0xcafebabe;
|
||||||
|
|
||||||
private ClassGroup group;
|
private ClassGroup group;
|
||||||
private DataInputStream is;
|
|
||||||
|
|
||||||
private ClassFile parent; // super class
|
private ClassFile parent; // super class
|
||||||
private List<ClassFile> children = new ArrayList<>(); // classes which inherit from this
|
private List<ClassFile> children = new ArrayList<>(); // classes which inherit from this
|
||||||
@@ -35,7 +34,6 @@ public class ClassFile
|
|||||||
public ClassFile(ClassGroup group, DataInputStream is) throws IOException
|
public ClassFile(ClassGroup group, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.is = is;
|
|
||||||
|
|
||||||
int magic = is.readInt();
|
int magic = is.readInt();
|
||||||
if (magic != MAGIC)
|
if (magic != MAGIC)
|
||||||
@@ -50,12 +48,21 @@ public class ClassFile
|
|||||||
name = pool.getClass(is.readUnsignedShort());
|
name = pool.getClass(is.readUnsignedShort());
|
||||||
super_class = pool.getClass(is.readUnsignedShort());
|
super_class = pool.getClass(is.readUnsignedShort());
|
||||||
|
|
||||||
interfaces = new Interfaces(this);
|
interfaces = new Interfaces(this, is);
|
||||||
|
|
||||||
|
fields = new Fields(this, is);
|
||||||
|
|
||||||
|
methods = new Methods(this, is);
|
||||||
|
|
||||||
|
attributes = new Attributes(this, is);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClassFile(ClassGroup group)
|
||||||
|
{
|
||||||
|
this.group = group;
|
||||||
|
|
||||||
fields = new Fields(this);
|
fields = new Fields(this);
|
||||||
|
|
||||||
methods = new Methods(this);
|
methods = new Methods(this);
|
||||||
|
|
||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,12 +100,7 @@ public class ClassFile
|
|||||||
{
|
{
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataInputStream getStream()
|
|
||||||
{
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConstantPool getPool()
|
public ConstantPool getPool()
|
||||||
{
|
{
|
||||||
return pool;
|
return pool;
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ public class ClassGroup
|
|||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addClass(ClassFile cf)
|
||||||
|
{
|
||||||
|
classes.add(cf);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeClass(ClassFile cf)
|
public void removeClass(ClassFile cf)
|
||||||
{
|
{
|
||||||
classes.remove(cf);
|
classes.remove(cf);
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class ConstantPool
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Constructor<? extends PoolEntry> con = type.getPoolClass().getConstructor(new Class[] { ConstantPool.class });
|
Constructor<? extends PoolEntry> con = type.getPoolClass().getConstructor(new Class[] { ConstantPool.class, DataInputStream.class });
|
||||||
PoolEntry entry = con.newInstance(this);
|
PoolEntry entry = con.newInstance(this, is);
|
||||||
entry.id = i;
|
entry.id = i;
|
||||||
|
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
|
|||||||
@@ -39,52 +39,52 @@ public class Deob
|
|||||||
|
|
||||||
ClassGroup group = loadJar(args[0]);
|
ClassGroup group = loadJar(args[0]);
|
||||||
|
|
||||||
// run(group, new RenameUnique());
|
//run(group, new RenameUnique());
|
||||||
|
|
||||||
// // remove except RuntimeException
|
// remove except RuntimeException
|
||||||
// run(group, new RuntimeExceptions());
|
run(group, new RuntimeExceptions());
|
||||||
//
|
|
||||||
// // remove unused methods
|
|
||||||
// run(group, new UnusedMethods());
|
|
||||||
//
|
|
||||||
// run(group, new UnreachedCode());
|
|
||||||
//
|
|
||||||
// // remove illegal state exceptions, frees up some parameters
|
|
||||||
// run(group, new IllegalStateExceptions());
|
|
||||||
//
|
|
||||||
// // remove constant logically dead parameters
|
|
||||||
// run(group, new ConstantParameter());
|
|
||||||
//
|
|
||||||
// // remove unhit blocks
|
|
||||||
// run(group, new UnreachedCode());
|
|
||||||
//
|
|
||||||
// // remove unused parameters
|
|
||||||
// run(group, new UnusedParameters());
|
|
||||||
//
|
|
||||||
// // remove jump obfuscation
|
|
||||||
// //new Jumps().run(group);
|
|
||||||
//
|
|
||||||
// // remove unused fields
|
|
||||||
// run(group, new UnusedFields());
|
|
||||||
//
|
|
||||||
// // remove unused methods, again?
|
|
||||||
// run(group, new UnusedMethods());
|
|
||||||
//
|
|
||||||
// run(group, new MethodInliner());
|
|
||||||
//
|
|
||||||
// run(group, new MethodMover());
|
|
||||||
//
|
|
||||||
// run(group, new FieldInliner());
|
|
||||||
//
|
|
||||||
// // XXX this is broken because when moving clinit around, some fields can depend on other fields
|
|
||||||
// // (like multianewarray)
|
|
||||||
// //new FieldMover().run(group);
|
|
||||||
//
|
|
||||||
// run(group, new UnusedClass());
|
|
||||||
|
|
||||||
//new ModArith().run(group);
|
// remove unused methods
|
||||||
|
run(group, new UnusedMethods());
|
||||||
|
|
||||||
new MultiplicationDeobfuscator().run(group);
|
run(group, new UnreachedCode());
|
||||||
|
|
||||||
|
// remove illegal state exceptions, frees up some parameters
|
||||||
|
run(group, new IllegalStateExceptions());
|
||||||
|
|
||||||
|
// remove constant logically dead parameters
|
||||||
|
run(group, new ConstantParameter());
|
||||||
|
|
||||||
|
// remove unhit blocks
|
||||||
|
run(group, new UnreachedCode());
|
||||||
|
|
||||||
|
// remove unused parameters
|
||||||
|
run(group, new UnusedParameters());
|
||||||
|
|
||||||
|
// remove jump obfuscation
|
||||||
|
//new Jumps().run(group);
|
||||||
|
|
||||||
|
// remove unused fields
|
||||||
|
run(group, new UnusedFields());
|
||||||
|
|
||||||
|
// remove unused methods, again?
|
||||||
|
run(group, new UnusedMethods());
|
||||||
|
|
||||||
|
run(group, new MethodInliner());
|
||||||
|
|
||||||
|
run(group, new MethodMover());
|
||||||
|
|
||||||
|
run(group, new FieldInliner());
|
||||||
|
|
||||||
|
// XXX this is broken because when moving clinit around, some fields can depend on other fields
|
||||||
|
// (like multianewarray)
|
||||||
|
//new FieldMover().run(group);
|
||||||
|
|
||||||
|
run(group, new UnusedClass());
|
||||||
|
|
||||||
|
new ModArith().run(group);
|
||||||
|
|
||||||
|
// new MultiplicationDeobfuscator().run(group);
|
||||||
|
|
||||||
// new MultiplyOneDeobfuscator().run(group);
|
// new MultiplyOneDeobfuscator().run(group);
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -29,17 +29,16 @@ public class Field
|
|||||||
private Type type;
|
private Type type;
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
|
|
||||||
Field(Fields fields) throws IOException
|
Field(Fields fields, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
|
|
||||||
DataInputStream is = fields.getClassFile().getStream();
|
|
||||||
ConstantPool pool = fields.getClassFile().getPool();
|
ConstantPool pool = fields.getClassFile().getPool();
|
||||||
|
|
||||||
accessFlags = is.readShort();
|
accessFlags = is.readShort();
|
||||||
name = pool.getUTF8(is.readUnsignedShort());
|
name = pool.getUTF8(is.readUnsignedShort());
|
||||||
type = new Type(pool.getUTF8(is.readUnsignedShort()));
|
type = new Type(pool.getUTF8(is.readUnsignedShort()));
|
||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this, is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(DataOutputStream out) throws IOException
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
|||||||
@@ -14,16 +14,19 @@ public class Fields
|
|||||||
|
|
||||||
private List<Field> fields = new ArrayList<>();
|
private List<Field> fields = new ArrayList<>();
|
||||||
|
|
||||||
Fields(ClassFile c) throws IOException
|
Fields(ClassFile c, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
classFile = c;
|
classFile = c;
|
||||||
|
|
||||||
DataInputStream is = c.getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
fields.add(new Field(this));
|
fields.add(new Field(this, is));
|
||||||
|
}
|
||||||
|
|
||||||
|
Fields(ClassFile c)
|
||||||
|
{
|
||||||
|
classFile = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(DataOutputStream out) throws IOException
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
|||||||
@@ -14,12 +14,10 @@ public class Interfaces
|
|||||||
|
|
||||||
private List<Class> interfaces = new ArrayList<Class>();
|
private List<Class> interfaces = new ArrayList<Class>();
|
||||||
|
|
||||||
Interfaces(ClassFile c) throws IOException
|
Interfaces(ClassFile c, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
classFile = c;
|
classFile = c;
|
||||||
|
|
||||||
DataInputStream is = c.getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
|
|||||||
@@ -27,18 +27,17 @@ public class Method
|
|||||||
public Signature arguments;
|
public Signature arguments;
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
|
|
||||||
Method(Methods methods) throws IOException
|
Method(Methods methods, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
this.methods = methods;
|
this.methods = methods;
|
||||||
|
|
||||||
DataInputStream is = methods.getClassFile().getStream();
|
|
||||||
ConstantPool pool = methods.getClassFile().getPool();
|
ConstantPool pool = methods.getClassFile().getPool();
|
||||||
|
|
||||||
accessFlags = is.readShort();
|
accessFlags = is.readShort();
|
||||||
name = pool.getUTF8(is.readUnsignedShort());
|
name = pool.getUTF8(is.readUnsignedShort());
|
||||||
arguments = new Signature(pool.getUTF8(is.readUnsignedShort()));
|
arguments = new Signature(pool.getUTF8(is.readUnsignedShort()));
|
||||||
attributes = new Attributes(this);
|
attributes = new Attributes(this);
|
||||||
attributes.load();
|
attributes.load(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method(Methods methods, String name, Signature signature)
|
public Method(Methods methods, String name, Signature signature)
|
||||||
|
|||||||
@@ -15,16 +15,19 @@ public class Methods
|
|||||||
|
|
||||||
private List<Method> methods = new ArrayList<>();
|
private List<Method> methods = new ArrayList<>();
|
||||||
|
|
||||||
Methods(ClassFile cf) throws IOException
|
Methods(ClassFile cf, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
classFile = cf;
|
classFile = cf;
|
||||||
|
|
||||||
DataInputStream is = cf.getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
methods.add(new Method(this));
|
methods.add(new Method(this, is));
|
||||||
|
}
|
||||||
|
|
||||||
|
Methods(ClassFile cf)
|
||||||
|
{
|
||||||
|
classFile = cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(DataOutputStream out) throws IOException
|
public void write(DataOutputStream out) throws IOException
|
||||||
|
|||||||
@@ -17,14 +17,13 @@ public abstract class Attribute
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void load() throws IOException
|
public final void load(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = attributes.getStream();
|
|
||||||
this.length = is.readInt();
|
this.length = is.readInt();
|
||||||
this.loadAttribute();
|
this.loadAttribute(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void loadAttribute() throws IOException;
|
public abstract void loadAttribute(DataInputStream is) throws IOException;
|
||||||
|
|
||||||
public final void write(DataOutputStream out) throws IOException
|
public final void write(DataOutputStream out) throws IOException
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,18 +19,23 @@ public class Attributes
|
|||||||
|
|
||||||
private List<Attribute> attributes = new ArrayList<>();
|
private List<Attribute> attributes = new ArrayList<>();
|
||||||
|
|
||||||
public Attributes(ClassFile cf) throws IOException
|
public Attributes(ClassFile cf, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
classFile = cf;
|
classFile = cf;
|
||||||
|
|
||||||
load();
|
load(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Attributes(ClassFile cf)
|
||||||
|
{
|
||||||
|
classFile = cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attributes(Field f) throws IOException
|
public Attributes(Field f, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
field = f;
|
field = f;
|
||||||
|
|
||||||
load();
|
load(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attributes(Method m)
|
public Attributes(Method m)
|
||||||
@@ -73,15 +78,8 @@ public class Attributes
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataInputStream getStream()
|
public void load(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
return getClassFile().getStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void load() throws IOException
|
|
||||||
{
|
|
||||||
DataInputStream is = getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
@@ -93,7 +91,7 @@ public class Attributes
|
|||||||
{
|
{
|
||||||
Constructor<? extends Attribute> con = type.getAttributeClass().getConstructor(new Class[] { Attributes.class });
|
Constructor<? extends Attribute> con = type.getAttributeClass().getConstructor(new Class[] { Attributes.class });
|
||||||
Attribute attr = con.newInstance(this);
|
Attribute attr = con.newInstance(this);
|
||||||
attr.load();
|
attr.load(is);
|
||||||
|
|
||||||
if (type != AttributeType.UNKNOWN)
|
if (type != AttributeType.UNKNOWN)
|
||||||
attributes.add(attr);
|
attributes.add(attr);
|
||||||
|
|||||||
@@ -26,21 +26,19 @@ public class Code extends Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttribute() throws IOException
|
public void loadAttribute(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = this.getAttributes().getStream();
|
|
||||||
|
|
||||||
maxStack = is.readUnsignedShort();
|
maxStack = is.readUnsignedShort();
|
||||||
is.skip(2); // max locals
|
is.skip(2); // max locals
|
||||||
|
|
||||||
instructions = new Instructions(this);
|
instructions = new Instructions(this);
|
||||||
instructions.load();
|
instructions.load(is);
|
||||||
|
|
||||||
exceptions = new Exceptions(this);
|
exceptions = new Exceptions(this);
|
||||||
exceptions.load();
|
exceptions.load(is);
|
||||||
|
|
||||||
this.attributes = new Attributes(this);
|
this.attributes = new Attributes(this);
|
||||||
this.attributes.load();
|
this.attributes.load(is);
|
||||||
|
|
||||||
instructions.buildBlocks();
|
instructions.buildBlocks();
|
||||||
instructions.buildJumpGraph();
|
instructions.buildJumpGraph();
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ public class ConstantValue extends Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttribute() throws IOException
|
public void loadAttribute(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = this.getAttributes().getStream();
|
|
||||||
value = this.getAttributes().getClassFile().getPool().getEntry(is.readUnsignedShort());
|
value = this.getAttributes().getClassFile().getPool().getEntry(is.readUnsignedShort());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,8 @@ public class Exceptions extends Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttribute() throws IOException
|
public void loadAttribute(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = this.getAttributes().getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ public class Unknown extends Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadAttribute() throws IOException
|
public void loadAttribute(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
int len = this.getLength();
|
int len = this.getLength();
|
||||||
DataInputStream is = this.getAttributes().getStream();
|
|
||||||
|
|
||||||
data = new byte[len];
|
data = new byte[len];
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ public class Exception
|
|||||||
private Instruction start, end, handler;
|
private Instruction start, end, handler;
|
||||||
private Class catchType;
|
private Class catchType;
|
||||||
|
|
||||||
public Exception(Exceptions exceptions) throws IOException
|
public Exception(Exceptions exceptions, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
this.exceptions = exceptions;
|
this.exceptions = exceptions;
|
||||||
|
|
||||||
DataInputStream is = exceptions.getCode().getAttributes().getStream();
|
|
||||||
ConstantPool pool = exceptions.getCode().getAttributes().getClassFile().getPool();
|
ConstantPool pool = exceptions.getCode().getAttributes().getClassFile().getPool();
|
||||||
|
|
||||||
int startPc = is.readUnsignedShort();
|
int startPc = is.readUnsignedShort();
|
||||||
|
|||||||
@@ -19,14 +19,12 @@ public class Exceptions
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() throws IOException
|
public void load(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = code.getAttributes().getStream();
|
|
||||||
|
|
||||||
int count = is.readUnsignedShort();
|
int count = is.readUnsignedShort();
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
exceptions.add(new Exception(this));
|
exceptions.add(new Exception(this, is));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Exception e)
|
public void add(Exception e)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.runelite.deob.attributes.code;
|
package net.runelite.deob.attributes.code;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
import net.runelite.deob.ClassFile;
|
import net.runelite.deob.ClassFile;
|
||||||
import net.runelite.deob.ConstantPool;
|
import net.runelite.deob.ConstantPool;
|
||||||
import net.runelite.deob.Field;
|
import net.runelite.deob.Field;
|
||||||
@@ -31,6 +32,10 @@ public abstract class Instruction
|
|||||||
this.pc = pc;
|
this.pc = pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected void remove()
|
protected void remove()
|
||||||
{
|
{
|
||||||
assert block == null;
|
assert block == null;
|
||||||
|
|||||||
@@ -26,10 +26,8 @@ public class Instructions
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() throws IOException
|
public void load(DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
DataInputStream is = code.getAttributes().getStream();
|
|
||||||
|
|
||||||
int length = is.readInt();
|
int length = is.readInt();
|
||||||
|
|
||||||
int pc;
|
int pc;
|
||||||
@@ -43,8 +41,9 @@ public class Instructions
|
|||||||
{
|
{
|
||||||
Constructor<? extends Instruction> con = type.getInstructionClass().getConstructor(Instructions.class, InstructionType.class, int.class);
|
Constructor<? extends Instruction> con = type.getInstructionClass().getConstructor(Instructions.class, InstructionType.class, int.class);
|
||||||
Instruction ins = con.newInstance(this, type, pc);
|
Instruction ins = con.newInstance(this, type, pc);
|
||||||
Instruction genericIns = ins.makeGeneric();
|
ins.load(is);
|
||||||
|
|
||||||
|
Instruction genericIns = ins.makeGeneric();
|
||||||
if (genericIns != ins)
|
if (genericIns != ins)
|
||||||
{
|
{
|
||||||
genericIns.setPc(ins.getPc());
|
genericIns.setPc(ins.getPc());
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.io.IOException;
|
|||||||
public class ALoad extends Instruction implements LVTInstruction, WideInstruction
|
public class ALoad extends Instruction implements LVTInstruction, WideInstruction
|
||||||
{
|
{
|
||||||
private int index;
|
private int index;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public ALoad(Instructions instructions, int index)
|
public ALoad(Instructions instructions, int index)
|
||||||
{
|
{
|
||||||
@@ -30,19 +31,27 @@ public class ALoad extends Instruction implements LVTInstruction, WideInstructio
|
|||||||
public ALoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
public ALoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
length += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ALoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public ALoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
length += 2;
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,11 +19,14 @@ public class ANewArray extends Instruction
|
|||||||
{
|
{
|
||||||
private Class clazz;
|
private Class clazz;
|
||||||
|
|
||||||
public ANewArray(Instructions instructions, InstructionType type, int pc) throws IOException
|
public ANewArray(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
clazz = this.getPool().getClass(is.readUnsignedShort());
|
clazz = this.getPool().getClass(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ public class AStore extends Instruction implements LVTInstruction, WideInstructi
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
public AStore(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
index = is.readByte();
|
index = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ public class BiPush extends Instruction implements PushConstantInstruction
|
|||||||
{
|
{
|
||||||
private byte b;
|
private byte b;
|
||||||
|
|
||||||
public BiPush(Instructions instructions, InstructionType type, int pc) throws IOException
|
public BiPush(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
b = is.readByte();
|
b = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,14 @@ public class CheckCast extends Instruction
|
|||||||
{
|
{
|
||||||
private Class clazz;
|
private Class clazz;
|
||||||
|
|
||||||
public CheckCast(Instructions instructions, InstructionType type, int pc) throws IOException
|
public CheckCast(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
clazz = this.getPool().getClass(is.readUnsignedShort());
|
clazz = this.getPool().getClass(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
public class DLoad extends Instruction implements LVTInstruction, WideInstruction
|
public class DLoad extends Instruction implements LVTInstruction, WideInstruction
|
||||||
{
|
{
|
||||||
private int index;
|
private int index;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public DLoad(Instructions instructions, int index)
|
public DLoad(Instructions instructions, int index)
|
||||||
{
|
{
|
||||||
@@ -28,22 +29,30 @@ public class DLoad extends Instruction implements LVTInstruction, WideInstructio
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
public DLoad(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
length += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public DLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
length += 2;
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ public class DStore extends Instruction implements LVTInstruction, WideInstructi
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
public DStore(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
index = is.readByte();
|
index = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
public class FLoad extends Instruction implements LVTInstruction, WideInstruction
|
public class FLoad extends Instruction implements LVTInstruction, WideInstruction
|
||||||
{
|
{
|
||||||
private int index;
|
private int index;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public FLoad(Instructions instructions, int index)
|
public FLoad(Instructions instructions, int index)
|
||||||
{
|
{
|
||||||
@@ -28,22 +29,30 @@ public class FLoad extends Instruction implements LVTInstruction, WideInstructio
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
public FLoad(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
length += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public FLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
length += 2;
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ public class FStore extends Instruction implements LVTInstruction, WideInstructi
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
public FStore(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
index = is.readByte();
|
index = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,14 @@ public class GetField extends Instruction implements GetFieldInstruction
|
|||||||
{
|
{
|
||||||
private Field field;
|
private Field field;
|
||||||
|
|
||||||
public GetField(Instructions instructions, InstructionType type, int pc) throws IOException
|
public GetField(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
field = this.getPool().getField(is.readUnsignedShort());
|
field = this.getPool().getField(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,14 @@ public class GetStatic extends Instruction implements GetFieldInstruction
|
|||||||
{
|
{
|
||||||
private Field field;
|
private Field field;
|
||||||
|
|
||||||
public GetStatic(Instructions instructions, InstructionType type, int pc) throws IOException
|
public GetStatic(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
field = this.getPool().getField(is.readUnsignedShort());
|
field = this.getPool().getField(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,9 @@ public class Goto extends Instruction implements JumpingInstruction
|
|||||||
private Instruction to;
|
private Instruction to;
|
||||||
private short offset;
|
private short offset;
|
||||||
|
|
||||||
public Goto(Instructions instructions, InstructionType type, int pc) throws IOException
|
public Goto(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
offset = is.readShort();
|
|
||||||
length += 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Goto(Instructions instructions, Instruction to)
|
public Goto(Instructions instructions, Instruction to)
|
||||||
@@ -34,6 +30,13 @@ public class Goto extends Instruction implements JumpingInstruction
|
|||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
offset = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ public class GotoW extends Instruction implements JumpingInstruction
|
|||||||
private Instruction to;
|
private Instruction to;
|
||||||
private int offset;
|
private int offset;
|
||||||
|
|
||||||
public GotoW(Instructions instructions, InstructionType type, int pc) throws IOException
|
public GotoW(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
offset = is.readInt();
|
offset = is.readInt();
|
||||||
length += 4;
|
length += 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,25 +19,34 @@ public class IInc extends Instruction implements LVTInstruction, WideInstruction
|
|||||||
{
|
{
|
||||||
private short index;
|
private short index;
|
||||||
private short inc;
|
private short inc;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public IInc(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IInc(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
inc = is.readByte();
|
|
||||||
length += 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInc(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public IInc(Instructions instructions, InstructionType type, Instruction instruction, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
inc = is.readShort();
|
@Override
|
||||||
length += 4;
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
inc = is.readShort();
|
||||||
|
length += 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
inc = is.readByte();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
public class ILoad extends Instruction implements LVTInstruction, WideInstruction
|
public class ILoad extends Instruction implements LVTInstruction, WideInstruction
|
||||||
{
|
{
|
||||||
private int index;
|
private int index;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public ILoad(Instructions instructions, int index)
|
public ILoad(Instructions instructions, int index)
|
||||||
{
|
{
|
||||||
@@ -28,22 +29,30 @@ public class ILoad extends Instruction implements LVTInstruction, WideInstructio
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
public ILoad(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
length += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ILoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public ILoad(Instructions instructions, InstructionType type, Instruction instruction, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
length += 2;
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,24 +28,18 @@ public class IStore extends Instruction implements LVTInstruction, WideInstructi
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
public IStore(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
index = is.readByte();
|
index = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public IStore(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
|
||||||
// {
|
|
||||||
// super(instructions, type, pc);
|
|
||||||
//
|
|
||||||
// DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
// index = is.readShort();
|
|
||||||
// length += 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream out) throws IOException
|
public void write(DataOutputStream out) throws IOException
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,11 +21,14 @@ public class If extends Instruction implements JumpingInstruction, ComparisonIns
|
|||||||
private Instruction to;
|
private Instruction to;
|
||||||
private short offset;
|
private short offset;
|
||||||
|
|
||||||
public If(Instructions instructions, InstructionType type, int pc) throws IOException
|
public If(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
offset = is.readShort();
|
offset = is.readShort();
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,14 @@ public class If0 extends Instruction implements JumpingInstruction, ComparisonIn
|
|||||||
private Instruction to;
|
private Instruction to;
|
||||||
private short offset;
|
private short offset;
|
||||||
|
|
||||||
public If0(Instructions instructions, InstructionType type, int pc) throws IOException
|
public If0(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
offset = is.readShort();
|
offset = is.readShort();
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ public class InstanceOf extends Instruction
|
|||||||
{
|
{
|
||||||
private Class clazz;
|
private Class clazz;
|
||||||
|
|
||||||
public InstanceOf(Instructions instructions, InstructionType type, int pc) throws IOException
|
public InstanceOf(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
clazz = this.getPool().getClass(is.readUnsignedShort());
|
clazz = this.getPool().getClass(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,14 @@ public class InvokeInterface extends Instruction implements InvokeInstruction
|
|||||||
private InterfaceMethod method;
|
private InterfaceMethod method;
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public InvokeInterface(Instructions instructions, InstructionType type, int pc) throws IOException
|
public InvokeInterface(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
method = this.getPool().getInterfaceMethod(is.readUnsignedShort());
|
method = this.getPool().getInterfaceMethod(is.readUnsignedShort());
|
||||||
count = is.readUnsignedByte();
|
count = is.readUnsignedByte();
|
||||||
is.skip(1);
|
is.skip(1);
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction
|
|||||||
{
|
{
|
||||||
private Method method;
|
private Method method;
|
||||||
|
|
||||||
public InvokeSpecial(Instructions instructions, InstructionType type, int pc) throws IOException
|
public InvokeSpecial(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
method = this.getPool().getMethod(is.readUnsignedShort());
|
method = this.getPool().getMethod(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ public class InvokeStatic extends Instruction implements InvokeInstruction
|
|||||||
{
|
{
|
||||||
private Method method;
|
private Method method;
|
||||||
|
|
||||||
public InvokeStatic(Instructions instructions, InstructionType type, int pc) throws IOException
|
public InvokeStatic(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
method = this.getPool().getMethod(is.readUnsignedShort());
|
method = this.getPool().getMethod(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ public class InvokeVirtual extends Instruction implements InvokeInstruction
|
|||||||
{
|
{
|
||||||
private Method method;
|
private Method method;
|
||||||
|
|
||||||
public InvokeVirtual(Instructions instructions, InstructionType type, int pc) throws IOException
|
public InvokeVirtual(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
method = this.getPool().getMethod(is.readUnsignedShort());
|
method = this.getPool().getMethod(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ public class LDC2_W extends Instruction implements PushConstantInstruction
|
|||||||
{
|
{
|
||||||
private PoolEntry value;
|
private PoolEntry value;
|
||||||
|
|
||||||
public LDC2_W(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LDC2_W(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
value = this.getPool().getEntry(is.readUnsignedShort());
|
value = this.getPool().getEntry(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,26 @@ public class LDC_W extends Instruction implements PushConstantInstruction
|
|||||||
{
|
{
|
||||||
private PoolEntry value;
|
private PoolEntry value;
|
||||||
|
|
||||||
public LDC_W(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LDC_W(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
assert type == InstructionType.LDC_W || type == InstructionType.LDC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LDC_W(Instructions instructions, PoolEntry value)
|
||||||
|
{
|
||||||
|
super(instructions, InstructionType.LDC_W, 0);
|
||||||
|
|
||||||
|
this.value = value;
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
InstructionType type = this.getType();
|
||||||
|
|
||||||
assert type == InstructionType.LDC_W || type == InstructionType.LDC;
|
assert type == InstructionType.LDC_W || type == InstructionType.LDC;
|
||||||
|
|
||||||
if (type == InstructionType.LDC_W)
|
if (type == InstructionType.LDC_W)
|
||||||
@@ -37,14 +52,6 @@ public class LDC_W extends Instruction implements PushConstantInstruction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LDC_W(Instructions instructions, PoolEntry value)
|
|
||||||
{
|
|
||||||
super(instructions, InstructionType.LDC_W, 0);
|
|
||||||
|
|
||||||
this.value = value;
|
|
||||||
length += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prime()
|
public void prime()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
|||||||
public class LLoad extends Instruction implements LVTInstruction, WideInstruction
|
public class LLoad extends Instruction implements LVTInstruction, WideInstruction
|
||||||
{
|
{
|
||||||
private int index;
|
private int index;
|
||||||
|
private boolean wide;
|
||||||
|
|
||||||
public LLoad(Instructions instructions, int index)
|
public LLoad(Instructions instructions, int index)
|
||||||
{
|
{
|
||||||
@@ -28,22 +29,30 @@ public class LLoad extends Instruction implements LVTInstruction, WideInstructio
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLoad(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LLoad(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
index = is.readByte();
|
|
||||||
length += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc) throws IOException
|
public LLoad(Instructions instructions, InstructionType type, Instruction instruction, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
wide = true;
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
}
|
||||||
index = is.readShort();
|
|
||||||
length += 2;
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
index = is.readShort();
|
||||||
|
length += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = is.readByte();
|
||||||
|
length += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -28,11 +28,14 @@ public class LStore extends Instruction implements LVTInstruction, WideInstructi
|
|||||||
++length;
|
++length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LStore(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LStore(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
index = is.readByte();
|
index = is.readByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,15 @@ public class LookupSwitch extends Instruction implements JumpingInstruction
|
|||||||
private int[] match;
|
private int[] match;
|
||||||
private int[] branch;
|
private int[] branch;
|
||||||
|
|
||||||
public LookupSwitch(Instructions instructions, InstructionType type, int pc) throws IOException
|
public LookupSwitch(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
int pc = this.getPc();
|
||||||
int tableSkip = 4 - (pc + 1) % 4;
|
int tableSkip = 4 - (pc + 1) % 4;
|
||||||
if (tableSkip == 4) tableSkip = 0;
|
if (tableSkip == 4) tableSkip = 0;
|
||||||
if (tableSkip > 0) is.skip(tableSkip);
|
if (tableSkip > 0) is.skip(tableSkip);
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ public class MultiANewArray extends Instruction
|
|||||||
public MultiANewArray(Instructions instructions, InstructionType type, int pc) throws IOException
|
public MultiANewArray(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
clazz = this.getPool().getClass(is.readUnsignedShort());
|
clazz = this.getPool().getClass(is.readUnsignedShort());
|
||||||
dimensions = is.readUnsignedByte();
|
dimensions = is.readUnsignedByte();
|
||||||
length += 3;
|
length += 3;
|
||||||
|
|||||||
@@ -19,11 +19,14 @@ public class New extends Instruction
|
|||||||
{
|
{
|
||||||
private Class clazz;
|
private Class clazz;
|
||||||
|
|
||||||
public New(Instructions instructions, InstructionType type, int pc) throws IOException
|
public New(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
clazz = this.getPool().getClass(is.readUnsignedShort());
|
clazz = this.getPool().getClass(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ public class NewArray extends Instruction
|
|||||||
{
|
{
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
public NewArray(Instructions instructions, InstructionType type, int pc) throws IOException
|
public NewArray(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
this.type = is.readUnsignedByte();
|
this.type = is.readUnsignedByte();
|
||||||
length += 1;
|
length += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ import net.runelite.deob.pool.NameAndType;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
|
||||||
import static net.runelite.deob.attributes.code.instructions.PutStatic.translate;
|
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
import net.runelite.deob.deobfuscators.arithmetic.Encryption;
|
||||||
import net.runelite.deob.deobfuscators.arithmetic.Pair;
|
import net.runelite.deob.deobfuscators.arithmetic.Pair;
|
||||||
|
|
||||||
@@ -30,8 +26,11 @@ public class PutField extends Instruction implements SetFieldInstruction
|
|||||||
public PutField(Instructions instructions, InstructionType type, int pc) throws IOException
|
public PutField(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
field = this.getPool().getField(is.readUnsignedShort());
|
field = this.getPool().getField(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import net.runelite.deob.pool.NameAndType;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.DupInstruction;
|
||||||
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
import net.runelite.deob.attributes.code.instruction.types.PushConstantInstruction;
|
||||||
@@ -31,8 +30,11 @@ public class PutStatic extends Instruction implements SetFieldInstruction
|
|||||||
public PutStatic(Instructions instructions, InstructionType type, int pc) throws IOException
|
public PutStatic(Instructions instructions, InstructionType type, int pc) throws IOException
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
field = this.getPool().getField(is.readUnsignedShort());
|
field = this.getPool().getField(is.readUnsignedShort());
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ public class SiPush extends Instruction implements PushConstantInstruction
|
|||||||
{
|
{
|
||||||
private short s;
|
private short s;
|
||||||
|
|
||||||
public SiPush(Instructions instructions, InstructionType type, int pc) throws IOException
|
public SiPush(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
s = is.readShort();
|
s = is.readShort();
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,15 @@ public class TableSwitch extends Instruction implements JumpingInstruction
|
|||||||
private int high;
|
private int high;
|
||||||
private int[] jumps;
|
private int[] jumps;
|
||||||
|
|
||||||
public TableSwitch(Instructions instructions, InstructionType type, int pc) throws IOException
|
public TableSwitch(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
|
int pc = this.getPc();
|
||||||
int tableSkip = 4 - (pc + 1) % 4;
|
int tableSkip = 4 - (pc + 1) % 4;
|
||||||
if (tableSkip == 4) tableSkip = 0;
|
if (tableSkip == 4) tableSkip = 0;
|
||||||
if (tableSkip > 0) is.skip(tableSkip);
|
if (tableSkip > 0) is.skip(tableSkip);
|
||||||
|
|||||||
@@ -17,19 +17,22 @@ public class Wide extends Instruction implements LVTInstruction
|
|||||||
{
|
{
|
||||||
private Instruction ins;
|
private Instruction ins;
|
||||||
|
|
||||||
public Wide(Instructions instructions, InstructionType type, int pc) throws IOException
|
public Wide(Instructions instructions, InstructionType type, int pc)
|
||||||
{
|
{
|
||||||
super(instructions, type, pc);
|
super(instructions, type, pc);
|
||||||
|
}
|
||||||
DataInputStream is = instructions.getCode().getAttributes().getStream();
|
|
||||||
|
@Override
|
||||||
|
public void load(DataInputStream is) throws IOException
|
||||||
|
{
|
||||||
byte opcode = is.readByte(); // this byte is already in the length of the new instruction (length is initialized to 1)
|
byte opcode = is.readByte(); // this byte is already in the length of the new instruction (length is initialized to 1)
|
||||||
InstructionType op = InstructionType.findInstructionFromCode(opcode);
|
InstructionType op = InstructionType.findInstructionFromCode(opcode);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Constructor<? extends Instruction> con = op.getInstructionClass().getConstructor(Instructions.class, InstructionType.class, Instruction.class, int.class);
|
Constructor<? extends Instruction> con = op.getInstructionClass().getConstructor(Instructions.class, InstructionType.class, Instruction.class, int.class);
|
||||||
ins = con.newInstance(instructions, op, this, pc);
|
ins = con.newInstance(this.getInstructions(), op, this, this.getPc());
|
||||||
|
ins.load(is);
|
||||||
length += ins.getLength();
|
length += ins.getLength();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class Stack
|
|||||||
|
|
||||||
public Stack(int sz)
|
public Stack(int sz)
|
||||||
{
|
{
|
||||||
stack = new StackContext[sz*2]; // XXX
|
stack = new StackContext[sz*2]; // XXX FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Stack(Stack other)
|
protected Stack(Stack other)
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ public class Class extends PoolEntry
|
|||||||
private int index;
|
private int index;
|
||||||
private java.lang.String name;
|
private java.lang.String name;
|
||||||
|
|
||||||
public Class(ConstantPool pool) throws IOException
|
public Class(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.CLASS);
|
super(ConstantType.CLASS);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
index = is.readUnsignedShort();
|
index = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ public class Double extends PoolEntry
|
|||||||
{
|
{
|
||||||
private double value;
|
private double value;
|
||||||
|
|
||||||
public Double(ConstantPool pool) throws IOException
|
public Double(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.DOUBLE);
|
super(ConstantType.DOUBLE);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
value = is.readDouble();
|
value = is.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,10 @@ public class Field extends PoolEntry
|
|||||||
private Class clazz;
|
private Class clazz;
|
||||||
private NameAndType nat;
|
private NameAndType nat;
|
||||||
|
|
||||||
public Field(ConstantPool pool) throws IOException
|
public Field(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.FIELDREF);
|
super(ConstantType.FIELDREF);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
classIndex = is.readUnsignedShort();
|
classIndex = is.readUnsignedShort();
|
||||||
natIndex = is.readUnsignedShort();
|
natIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ public class Float extends PoolEntry
|
|||||||
{
|
{
|
||||||
private float value;
|
private float value;
|
||||||
|
|
||||||
public Float(ConstantPool pool) throws IOException
|
public Float(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.FLOAT);
|
super(ConstantType.FLOAT);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
value = is.readFloat();
|
value = is.readFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ public class Integer extends PoolEntry
|
|||||||
{
|
{
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
public Integer(ConstantPool pool) throws IOException
|
public Integer(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.INTEGER);
|
super(ConstantType.INTEGER);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
value = is.readInt();
|
value = is.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ public class InterfaceMethod extends PoolEntry
|
|||||||
this.nat = nat;
|
this.nat = nat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InterfaceMethod(ConstantPool pool) throws IOException
|
public InterfaceMethod(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.INTERFACE_METHOD_REF);
|
super(ConstantType.INTERFACE_METHOD_REF);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
classIndex = is.readUnsignedShort();
|
classIndex = is.readUnsignedShort();
|
||||||
natIndex = is.readUnsignedShort();
|
natIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ public class Long extends PoolEntry
|
|||||||
{
|
{
|
||||||
private long value;
|
private long value;
|
||||||
|
|
||||||
public Long(ConstantPool pool) throws IOException
|
public Long(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.LONG);
|
super(ConstantType.LONG);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
value = is.readLong();
|
value = is.readLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ public class Method extends PoolEntry
|
|||||||
this.nat = nat;
|
this.nat = nat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method(ConstantPool pool) throws IOException
|
public Method(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.METHODREF);
|
super(ConstantType.METHODREF);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
classIndex = is.readUnsignedShort();
|
classIndex = is.readUnsignedShort();
|
||||||
natIndex = is.readUnsignedShort();
|
natIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ public class NameAndType extends PoolEntry
|
|||||||
/* type */
|
/* type */
|
||||||
private Type type;
|
private Type type;
|
||||||
|
|
||||||
public NameAndType(ConstantPool pool) throws IOException
|
public NameAndType(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.NAME_AND_TYPE);
|
super(ConstantType.NAME_AND_TYPE);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
nameIndex = is.readUnsignedShort();
|
nameIndex = is.readUnsignedShort();
|
||||||
descriptorIndex = is.readUnsignedShort();
|
descriptorIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,10 @@ public class String extends PoolEntry
|
|||||||
private int stringIndex;
|
private int stringIndex;
|
||||||
private java.lang.String string;
|
private java.lang.String string;
|
||||||
|
|
||||||
public String(ConstantPool pool) throws IOException
|
public String(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.STRING);
|
super(ConstantType.STRING);
|
||||||
|
|
||||||
DataInputStream is = pool.getClassFile().getStream();
|
|
||||||
|
|
||||||
stringIndex = is.readUnsignedShort();
|
stringIndex = is.readUnsignedShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ public class UTF8 extends PoolEntry
|
|||||||
{
|
{
|
||||||
private java.lang.String string;
|
private java.lang.String string;
|
||||||
|
|
||||||
public UTF8(ConstantPool pool) throws IOException
|
public UTF8(ConstantPool pool, DataInputStream is) throws IOException
|
||||||
{
|
{
|
||||||
super(ConstantType.UTF8);
|
super(ConstantType.UTF8);
|
||||||
|
|
||||||
DataInputStream ios = pool.getClassFile().getStream();
|
string = is.readUTF();
|
||||||
string = ios.readUTF();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UTF8(java.lang.String value)
|
public UTF8(java.lang.String value)
|
||||||
|
|||||||
Reference in New Issue
Block a user