Add field references, only for getstatic currently

This commit is contained in:
Adam
2014-12-01 17:00:55 -05:00
parent 228f650b6c
commit 4a24560be5
15 changed files with 162 additions and 12 deletions

View File

@@ -17,8 +17,9 @@ public class Class extends PoolEntry
index = is.readUnsignedShort();
}
public int getIndex()
public java.lang.String getName()
{
return index;
UTF8 u = (UTF8) this.getPool().getEntry(index);
return u.getValue();
}
}

View File

@@ -19,4 +19,14 @@ public class Field extends PoolEntry
classIndex = is.readUnsignedShort();
nameAndTypeIndex = is.readUnsignedShort();
}
public Class getClassEntry()
{
return (Class) this.getPool().getEntry(classIndex);
}
public NameAndType getNameAndType()
{
return (NameAndType) this.getPool().getEntry(nameAndTypeIndex);
}
}

View File

@@ -19,4 +19,16 @@ public class NameAndType extends PoolEntry
nameIndex = is.readUnsignedShort();
descriptorIndex = is.readUnsignedShort();
}
public java.lang.String getName()
{
UTF8 u = (UTF8) this.getPool().getEntry(nameIndex);
return u.getValue();
}
public java.lang.String getDescriptor()
{
UTF8 u = (UTF8) this.getPool().getEntry(descriptorIndex);
return u.getValue();
}
}

View File

@@ -13,6 +13,11 @@ public abstract class PoolEntry
this.type = type;
}
public ConstantPool getPool()
{
return pool;
}
public int getSlots()
{
return 1;