private JCTree makeCallMethod(List<JCStatement> body, int numParams) { MethodDefinitionBuilder callMethod = MethodDefinitionBuilder.callable(gen); callMethod.isOverride(true); callMethod.modifiers(Flags.PUBLIC); ProducedType returnType = gen.getReturnTypeOfCallable(typeModel); callMethod.resultType(gen.makeJavaType(returnType, JT_NO_PRIMITIVES), null); // Now append formal parameters switch (numParams) { case 3: callMethod.parameter(makeCallableCallParam(0, numParams - 3)); // fall through case 2: callMethod.parameter(makeCallableCallParam(0, numParams - 2)); // fall through case 1: callMethod.parameter(makeCallableCallParam(0, numParams - 1)); break; case 0: break; default: // use varargs callMethod.parameter(makeCallableCallParam(Flags.VARARGS, 0)); } // Return the call result, or null if a void method callMethod.body(body); return callMethod.build(); }
/** * Marks the getter/setter methods as not actual. In general <tt>actual</tt> is derived from the * model while creating this builder so it will be correct. You can only disable this computation. * Enabling <tt>actual</tt> would otherwise depend on the question of whether the getter is or not * actual which may be different for the setter if the refined decl is not variable so we'd need * two parameters. */ public AttributeDefinitionBuilder notActual() { getterBuilder.isOverride(false); setterBuilder.isOverride(false); return this; }