X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FType.java;h=2faa5903b99be279b0281395cbb37595d91c7f71;hp=067e6114b07eb045ddbcfb91b127e4f92511ebf8;hb=5a08820e18996e02dcf0ba12f502ba7f0bc781ea;hpb=f1822de91ca3a0ecb3f744766176d39dd166ea07 diff --git a/src/org/ibex/classgen/Type.java b/src/org/ibex/classgen/Type.java index 067e611..2faa590 100644 --- a/src/org/ibex/classgen/Type.java +++ b/src/org/ibex/classgen/Type.java @@ -105,11 +105,10 @@ public class Type implements CGConst { public Field field(String name, Type type) { return new Field(name, type); } public Method method(String name, Type returnType, Type[] argTypes) { return new Method(name, returnType, argTypes); } - public Method method(String signature) { + public Method method(String name, String typeDescriptor) { // FEATURE: This parser is ugly but it works (and shouldn't be a problem) might want to clean it up though - String s = signature; - String name = s.startsWith("(") ? "" : s.substring(0, s.indexOf('(')); - s = s.substring(s.indexOf('(')); + String s = typeDescriptor; + if(!s.startsWith("(")) throw new IllegalArgumentException("invalid method type descriptor"); int p = s.indexOf(')'); if(p == -1) throw new IllegalArgumentException("invalid method type descriptor"); String argsDesc = s.substring(1,p);