/** Adds a synthetic method as part of the compilation process */ public MethodNode addSyntheticMethod( String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) { MethodNode answer = addMethod(name, modifiers | ACC_SYNTHETIC, returnType, parameters, exceptions, code); answer.setSynthetic(true); return answer; }
private MethodNode getOrAddStaticConstructorNode() { MethodNode method = null; List declaredMethods = getDeclaredMethods("<clinit>"); if (declaredMethods.isEmpty()) { method = addMethod( "<clinit>", ACC_STATIC, ClassHelper.VOID_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, new BlockStatement()); method.setSynthetic(true); } else { method = (MethodNode) declaredMethods.get(0); } return method; }