X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FClassFile.java;h=b926d856e849b59691b202b2d6ee07c161af6663;hp=788c0cb63454e8179288b425eb4f76281294014b;hb=83234d9a36beec5161709321fbe71b5b57b2f73f;hpb=ca1b3654e5d2e7bf09933b565fb118571ca61258 diff --git a/src/org/ibex/classgen/ClassFile.java b/src/org/ibex/classgen/ClassFile.java index 788c0cb..b926d85 100644 --- a/src/org/ibex/classgen/ClassFile.java +++ b/src/org/ibex/classgen/ClassFile.java @@ -15,7 +15,7 @@ public class ClassFile implements CGConst { private final Vector fields = new Vector(); private final Vector methods = new Vector(); - final CPGen cp; + final ConstantPool cp; private final AttrGen attributes; public static String flagsToString(int flags) { @@ -61,21 +61,7 @@ public class ClassFile implements CGConst { sb.append("}"); } - /** @see #ClassFile(Type.Class, Type.Class, int) */ - public ClassFile(String name, String superName, int flags) { - this(Type.instance(name).asClass(), Type.instance(superName).asClass(), flags); - } - - /** @see #ClassFile(Type.Class, Type.Class, int, Type.Class[]) */ - public ClassFile(Type.Class thisType, Type.Class superType, int flags) { - this(thisType, superType, flags, null); - } - - /** Creates a new ClassFile object - @param thisType The type of the class to generate - @param superType The superclass of the generated class (commonly Type.OBJECT) - @param flags The access flags for this class (ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, and ACC_ABSTRACT) - */ + public ClassFile(Type.Class thisType, Type.Class superType, int flags) { this(thisType, superType, flags, null); } public ClassFile(Type.Class thisType, Type.Class superType, int flags, Type.Class[] interfaces) { if((flags & ~(ACC_PUBLIC|ACC_FINAL|ACC_SUPER|ACC_INTERFACE|ACC_ABSTRACT)) != 0) throw new IllegalArgumentException("invalid flags"); @@ -86,7 +72,7 @@ public class ClassFile implements CGConst { this.minor = 3; this.major = 45; - cp = new CPGen(); + cp = new ConstantPool(); attributes = new AttrGen(cp); } @@ -218,7 +204,7 @@ public class ClassFile implements CGConst { //if (minor != 3) throw new ClassReadExn("invalid minor version: " + minor); major = i.readShort(); //if (major != 45 && major != 46) throw new ClassReadExn("invalid major version"); - cp = new CPGen(i); + cp = new ConstantPool(i); flags = i.readShort(); thisType = (Type.Class)cp.getType(i.readShort()); superType = (Type.Class)cp.getType(i.readShort()); @@ -242,17 +228,17 @@ public class ClassFile implements CGConst { } static class AttrGen { - private final CPGen cp; + private final ConstantPool cp; private final Hashtable ht = new Hashtable(); - public AttrGen(CPGen cp) { this.cp = cp; } - public AttrGen(CPGen cp, DataInput in) throws IOException { + public AttrGen(ConstantPool cp) { this.cp = cp; } + public AttrGen(ConstantPool cp, DataInput in) throws IOException { this(cp); int size = in.readShort(); for(int i=0; i