way more Arena functionality
[org.ibex.classgen.git] / src / org / ibex / classgen / ConstantPool.java
index bdfddf0..67f4245 100644 (file)
@@ -85,7 +85,9 @@ class ConstantPool implements CGConst {
         ClassEnt(String s) { this(); this.utf8 = (Utf8Ent) addUtf8(s); }
         void dump(DataOutput o) throws IOException { super.dump(o); o.writeShort(utf8.n); }
         Type.Class getTypeClass() { return  (Type.Class) key(); }
-        Object _key() { return Type.Class.instance(utf8.s); }
+        Object _key() {
+            return Type.fromDescriptor(utf8.s.startsWith("[") ? utf8.s : "L" + utf8.s + ";"); 
+        }
         void unref() { utf8.unref(); super.unref(); }
         public String toString() { return "[Class: " + utf8.s + "]"; }
     }
@@ -217,7 +219,7 @@ class ConstantPool implements CGConst {
             return ent;
         }
         
-        if (o instanceof Type.Class) { ent = new ClassEnt(((Type.Class)o).internalForm()); }
+        if (o instanceof Type.Ref) { ent = new ClassEnt(((Type.Ref)o).internalForm()); }
         else if (o instanceof String) { ent = new StringLitEnt((String)o); }
         else if (o instanceof Integer) { ent = new IntLitEnt(((Integer)o).intValue()); }
         else if (o instanceof Float) { ent = new FloatLitEnt(((Float)o).floatValue()); }
@@ -238,7 +240,7 @@ class ConstantPool implements CGConst {
             ent = new MemberEnt(tag, m.getDeclaringClass(), m.name, m.getTypeDescriptor());
         } 
         else {
-            throw new IllegalArgumentException("Unknown type passed to add");
+            throw new IllegalArgumentException("Unknown type " + o + " passed to add");
         }
         
         int spaces = ent.slots();