use of com.jopdesign.common.type.Descriptor in project jop by jop-devel.
the class ClassInfo method createMethod.
/**
* Create a new non-static, package-visible method with the given name and descriptor.
*
* @param memberID the membername and descriptor of the method (classname is ignored).
* @param argNames the names of the parameters
* @param code an InstructionList to set to the method as code, or if null, create an abstract method.
* @return the new method or an existing method with that memberID.
*/
public MethodInfo createMethod(MemberID memberID, String[] argNames, InstructionList code) {
MethodInfo method = methods.get(memberID.getMethodSignature());
if (method != null) {
method.setAbstract(code == null);
if (code != null) {
method.getCode().setInstructionList(code);
}
return method;
}
Descriptor desc = memberID.getDescriptor();
int flags = (code == null) ? Constants.ACC_ABSTRACT : 0;
method = new MethodInfo(this, new MethodGen(flags, desc.getType(), desc.getArgumentTypes(), argNames, memberID.getMemberName(), classGen.getClassName(), code, cpg));
methods.put(memberID.getMethodSignature(), method);
classGen.addMethod(method.getMethod(false));
return method;
}
Aggregations