sourceTypes.put(key, type);
}
JMethod createConstructor(SourceInfo info, MethodBinding b) {
JDeclaredType enclosingType = (JDeclaredType) get(b.declaringClass);
JMethod method = new JConstructor(info, (JClassType) enclosingType);
enclosingType.addMethod(method);
/*
* Don't need to synthesize enum intrinsic args because enum ctors can only
* be called locally.
*/
int argPosition = 0;
ReferenceBinding declaringClass = b.declaringClass;
if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
// add synthetic args for outer this
if (declaringClass.syntheticEnclosingInstanceTypes() != null) {
for (ReferenceBinding argType : declaringClass.syntheticEnclosingInstanceTypes()) {
createParameter(info, argType, method, argPosition++);
}
}
}
// User args.
argPosition = mapParameters(info, method, b, argPosition);
if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
// add synthetic args for locals
if (declaringClass.syntheticOuterLocalVariables() != null) {
for (SyntheticArgumentBinding arg : declaringClass.syntheticOuterLocalVariables()) {
createParameter(info, arg.type, method, argPosition++);
}
}
}
mapExceptions(method, b);
if (b.isSynthetic()) {
method.setSynthetic();
}
return method;
}