X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FType.java;h=a8a68d8d651e0e1e1ac9ff2e06e48fbf610c7228;hb=6c44a3470c1ae5c0e54153871805e24e394a96bb;hp=bc6160c932037f5a912dce43314965804c6bcb3d;hpb=313d0d7b61cbae37ba11f48b752aebd52be68b5c;p=org.ibex.classgen.git diff --git a/src/org/ibex/classgen/Type.java b/src/org/ibex/classgen/Type.java index bc6160c..a8a68d8 100644 --- a/src/org/ibex/classgen/Type.java +++ b/src/org/ibex/classgen/Type.java @@ -30,10 +30,10 @@ public class Type { public static final Type[] NO_ARGS = new Type[0]; /** guarantee: there will only be one instance of Type for a given descriptor ==> equals() and == are interchangeable */ - public static Type fromDescriptor(String d) { + public static Type instance(String d) { Type ret = (Type)instances.get(d); if (ret != null) return ret; - if (d.endsWith("[")) return new Type.Array(fromDescriptor(d.substring(d.length()-1))); + if (d.endsWith("[")) return new Type.Array(instance(d.substring(d.length()-1))); return new Type.Class(d); } @@ -42,7 +42,7 @@ public class Type { public int hashCode() { return descriptor.hashCode(); } public boolean equals(java.lang.Object o) { return this==o; } - public Type.Array makeArray() { return (Type.Array)fromDescriptor(descriptor+"["); } + public Type.Array makeArray() { return (Type.Array)instance(descriptor+"["); } public Type.Ref asRef() { throw new RuntimeException("attempted to use "+this+" as a Type.Ref, which it is not"); } public Type.Class asClass() { throw new RuntimeException("attempted to use "+this+" as a Type.Class, which it is not"); }