made ClassFile(DataInput) public
[org.ibex.classgen.git] / src / org / ibex / classgen / ClassFile.java
index f70ed48..f598519 100644 (file)
@@ -13,7 +13,7 @@ public class ClassFile implements CGConst {
     final int flags;
     
     private final Vector fields = new Vector();
-    private final Vector methods = new Vector();
+    public final Vector methods = new Vector();
     
     private final AttrGen attributes;
 
@@ -86,7 +86,7 @@ public class ClassFile implements CGConst {
         @see CGConst
     */
     public final MethodGen addMethod(String name, Type ret, Type[] args, int flags) {
-        MethodGen mg = new MethodGen(this.getType(), name, ret, args, flags, (this.flags & INTERFACE) != 0);
+        MethodGen mg = new MethodGen(getType().method(name, ret, args), flags);
         methods.addElement(mg);
         return mg;
     }
@@ -199,7 +199,8 @@ public class ClassFile implements CGConst {
         }
     }
 
-    ClassFile(DataInput i) throws IOException {
+    public ClassFile(DataInput i) throws IOException { this(i, false); }
+    public ClassFile(DataInput i, boolean ssa) throws IOException {
         int magic = i.readInt();
         if (magic != 0xcafebabe) throw new ClassReadExn("invalid magic: " + Long.toString(0xffffffffL & magic, 16));
         minor = i.readShort();
@@ -215,7 +216,9 @@ public class ClassFile implements CGConst {
         int numFields = i.readShort();
         for(int j=0; j<numFields; j++) fields.addElement(new FieldGen(i, cp));
         int numMethods = i.readShort();
-        for(int j=0; j<numMethods; j++) methods.addElement(new MethodGen(this.getType(), i, cp, (this.flags & INTERFACE) != 0));
+        for(int j=0; j<numMethods; j++) methods.addElement(ssa 
+                                                           ? new JSSA(this.getType(), i, cp) 
+                                                           : new MethodGen(this.getType(), i, cp));
         attributes = new AttrGen(i, cp);
         
         // FEATURE: Support these