X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FMethodRef.java;h=6dbb46feaf8463122979d052a97d77c827b6025c;hp=cb546bdbf9396824851b85914751936205e2c7b5;hb=20b36057bc5aee6e799cce02a3bf289916889fc1;hpb=bc9112573cba51be5e7d285ccd3e496be4278c63 diff --git a/src/org/ibex/classgen/MethodRef.java b/src/org/ibex/classgen/MethodRef.java index cb546bd..6dbb46f 100644 --- a/src/org/ibex/classgen/MethodRef.java +++ b/src/org/ibex/classgen/MethodRef.java @@ -1,24 +1,31 @@ package org.ibex.classgen; -public class MethodRef extends ClassGen.FieldMethodRef { - public MethodRef(Type.Object c, ClassGen.NameAndType t) { super(c,t); } - public MethodRef(Type.Object c, String name, String descriptor) { - this(c,new ClassGen.NameAndType(name,descriptor)); - } - public MethodRef(Type.Object c, String name, Type ret, Type[] args) { - this(c,name,getDescriptor(ret,args)); - } - public MethodRef(String s, String name, Type ret, Type[] args) { - this(new Type.Object(s),name,ret,args); +/** This class represents Method references. It is used as an argument to the + INVOKESTATIC, INVOKEVIRTUAL, INVOKESPEICAL, and INVOKEINTERFACE bytecodes + @see CGConst#INVOKESTATIC + @see CGConst#INVOKEVIRTUAL + @see CGConst#INVOKESPECIAL + @see CGConst#INVOKEINTERFACE +*/ +public class MethodRef extends MemberRef { + + final Type[] argTypes; + final Type returnType; + + /** Create a reference to method name of class c with the return type ret and the + arguments args */ + public MethodRef(Type.Class c, String name, Type returnType, Type[] argTypes) { + super(c, name); + this.argTypes = argTypes; + this.returnType = returnType; } - static String getDescriptor(Type ret, Type[] args) { - StringBuffer sb = new StringBuffer(args.length*4); + public String getDescriptor() { + StringBuffer sb = new StringBuffer(argTypes.length*4); sb.append("("); - for(int i=0;i