List of usage examples for org.eclipse.jdt.internal.compiler.lookup MethodBinding isSynthetic
public final boolean isSynthetic()
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleTypeCreator.java
License:Open Source License
/** * Wrap all role types in a method signature. Only treat unqualified * types here, explicit anchors are handled in QualifiedTypeReference. * * @param method binding to wrap/*ww w. j a v a 2 s . com*/ * @param decl AST */ public static void wrapTypesInMethodDeclSignature(MethodBinding method, @NonNull AbstractMethodDeclaration decl) { if (decl.ignoreFurtherInvestigation || method == null || method.isSynthetic()) // don't wrap role field accessors return; if ((method.tagBits & TagBits.HasWrappedSignature) != 0) // no double wrapping return; doingSignatures = true; method.tagBits |= TagBits.HasWrappedSignature; ReferenceBinding site = method.declaringClass; assert !(site instanceof BinaryTypeBinding); TypeReference typedExpr = null; if (decl instanceof MethodDeclaration) typedExpr = ((MethodDeclaration) decl).returnType; ITeamAnchor defaultAnchor = null; // for methods moved outside their role instance context if (method.model != null && method.model._thisSubstitution != null) { ReferenceBinding sourceDeclaringType = (ReferenceBinding) method.model._thisSubstitution.binding.type; if (sourceDeclaringType.getRealClass().isTeam()) { // only for nested teams method.model._thisSubstitution.bind(decl.scope, null, true); defaultAnchor = method.model._thisSubstitution.binding; // the original 'this' passed as first argument } } if (CopyInheritance.isCreator(method) || Lifting.isLiftToMethod(method)) { int dimensions = method.returnType.dimensions(); // get the most specific anchor: ReferenceBinding returnRef = (ReferenceBinding) method.returnType.leafComponentType(); VariableBinding anchor = method.declaringClass.getTeamModel().getTThis(); // get the wrapped role type: TypeBinding roleArrayType = anchor.getRoleTypeBinding(returnRef, dimensions); DependentTypeBinding roleType = (DependentTypeBinding) roleArrayType.leafComponentType(); // find least specific super-team containing this role: ReferenceBinding lastType = roleType; char[] typeName = CharOperation.subarray(decl.selector, IOTConstants.CREATOR_PREFIX_NAME.length, -1); while (site != null) { ReferenceBinding memberType = site.getMemberType(typeName); if (memberType == null) break; lastType = memberType; site = site.superclass(); } // if a tsuper was actually found, use a weakened type binding: if (WeakenedTypeBinding.requireWeakening(roleType, lastType)) method.returnType = WeakenedTypeBinding.makeWeakenedTypeBinding(roleType, lastType, dimensions); else method.returnType = roleArrayType; } else { method.returnType = maybeWrapSignatureType(method.returnType, decl.scope, typedExpr, defaultAnchor); checkArrayLoweringForReturn(method, decl.scope); } TypeBinding[] parameters = method.parameters; Argument[] arguments = decl.arguments; for (int i = 0; i < parameters.length; i++) { Argument argument = (arguments != null) ? arguments[i] : null; parameters[i] = maybeWrapSignatureType(parameters[i], decl.scope, argument, defaultAnchor); // in case resolveTypesFor already created the binding, // update its type: if (argument != null && argument.binding != null) argument.binding.type = parameters[i]; } doingSignatures = false; }