List of usage examples for org.eclipse.jdt.internal.compiler.lookup MethodBinding MethodBinding
public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass)
From source file:com.codenvy.ide.ext.java.server.internal.codeassist.SelectionEngine.java
License:Open Source License
private void selectLocalDeclaration(ASTNode node) { // the selected identifier is not identical to the parser one (equals but not identical), // for traversing the parse tree, the parser assist identifier is necessary for identitiy checks final char[] assistIdentifier = getParser().assistIdentifier(); if (assistIdentifier == null) return;/*from ww w. j a va 2 s .c om*/ class Visitor extends ASTVisitor { public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) { if (constructorDeclaration.selector == assistIdentifier) { if (constructorDeclaration.binding != null) { throw new SelectionNodeFound(constructorDeclaration.binding); } else { if (constructorDeclaration.scope != null) { throw new SelectionNodeFound(new MethodBinding(constructorDeclaration.modifiers, constructorDeclaration.selector, null, null, null, constructorDeclaration.scope.referenceType().binding)); } } } return true; } public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) { if (fieldDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(fieldDeclaration.binding); } return true; } public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) { if (localTypeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(localTypeDeclaration.binding); } return true; } public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) { if (memberTypeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(memberTypeDeclaration.binding); } return true; } public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { if (methodDeclaration.selector == assistIdentifier) { if (methodDeclaration.binding != null) { throw new SelectionNodeFound(methodDeclaration.binding); } else { if (methodDeclaration.scope != null) { throw new SelectionNodeFound( new MethodBinding(methodDeclaration.modifiers, methodDeclaration.selector, null, null, null, methodDeclaration.scope.referenceType().binding)); } } } return true; } public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) { if (typeDeclaration.name == assistIdentifier) { throw new SelectionNodeFound(typeDeclaration.binding); } return true; } public boolean visit(TypeParameter typeParameter, BlockScope scope) { if (typeParameter.name == assistIdentifier) { throw new SelectionNodeFound(typeParameter.binding); } return true; } public boolean visit(TypeParameter typeParameter, ClassScope scope) { if (typeParameter.name == assistIdentifier) { throw new SelectionNodeFound(typeParameter.binding); } return true; } } if (node instanceof AbstractMethodDeclaration) { ((AbstractMethodDeclaration) node).traverse(new Visitor(), (ClassScope) null); } else { ((FieldDeclaration) node).traverse(new Visitor(), (MethodScope) null); } }
From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyClassScope.java
License:Open Source License
private void createMethod(String name, boolean isStatic, String signature, TypeBinding[] parameterTypes, TypeBinding returnType, List<MethodBinding> groovyMethods, MethodBinding[] existingMethods, GroovyTypeDeclaration typeDeclaration) { boolean found = false; for (MethodBinding existingMethod : existingMethods) { if (new String(existingMethod.selector).equals(name)) { // FIXASC safe to do this resolution so early? ((SourceTypeBinding) existingMethod.declaringClass).resolveTypesFor(existingMethod); boolean equalParameters = true; if (parameterTypes == null) { // not looking for parameters, if this has none, that is OK if (existingMethod.parameters.length != 0) { equalParameters = false; }/*from w ww .j ava 2 s . co m*/ } else if (existingMethod.parameters.length == parameterTypes.length) { TypeBinding[] existingParams = existingMethod.parameters; for (int p = 0, max = parameterTypes.length; p < max; p++) { if (!CharOperation.equals(parameterTypes[p].signature(), existingParams[p].signature())) { equalParameters = false; break; } } } // FIXASC consider return type? if (equalParameters) { found = true; break; } // FIXASC what about inherited methods - what if the supertype // provides an implementation, does the subtype get a new method? } } if (!found) { int modifiers = ClassFileConstants.AccPublic; if (isStatic) { modifiers |= ClassFileConstants.AccStatic; } if (this.referenceContext.binding.isInterface()) { modifiers |= ClassFileConstants.AccAbstract; } char[] methodName = name.toCharArray(); /* * if (typeDeclaration != null) { // check we are not attempting to override a final method MethodBinding[] * existingBindings = typeDeclaration.binding.getMethods(name.toCharArray()); int stop = 1; } */ MethodBinding mb = new MethodBinding(modifiers, methodName, returnType, parameterTypes, null, this.referenceContext.binding); // FIXASC parameter names - what value would it have to set them correctly? groovyMethods.add(mb); } }
From source file:org.codehaus.jdt.groovy.internal.compiler.ast.GroovyClassScope.java
License:Open Source License
@Override public MethodBinding[] getAnyExtraMethods(char[] selector) { if (true) {/*from w w w. j a v a 2 s . c o m*/ return null; } List<MethodNode> mns = ((GroovyTypeDeclaration) referenceContext).getClassNode() .getMethods(new String(selector)); MethodBinding[] newMethods = new MethodBinding[mns.size()]; int idx = 0; for (MethodNode methodNode : mns) { TypeBinding[] parameterTypes = null; TypeBinding returnType = compilationUnitScope().environment.getResolvedType( CharOperation.splitAndTrimOn('.', methodNode.getReturnType().getName().toCharArray()), this); newMethods[idx++] = new MethodBinding(methodNode.getModifiers(), selector, returnType, parameterTypes, null, this.referenceContext.binding); } // unitScope.environment.getResolvedType(JAVA_LANG_STRING, this); return newMethods; }
From source file:org.eclipse.ajdt.core.parserbridge.ITDInserter.java
License:Open Source License
/** * Adds all children field and methods to this ITIT * @param ititAST//from ww w. j a v a2s. c om * @param elt the AspectJ element that knows about children */ private void populateITIT(TypeDeclaration ititAST, IProgramElement elt) { List<FieldDeclaration> fields = new LinkedList<FieldDeclaration>(); List<FieldBinding> fieldBindings = new LinkedList<FieldBinding>(); List<AbstractMethodDeclaration> methods = new LinkedList<AbstractMethodDeclaration>(); List<MethodBinding> methodBindings = new LinkedList<MethodBinding>(); for (IProgramElement child : elt.getChildren()) { if (child.getKind() == IProgramElement.Kind.FIELD) { FieldDeclaration field = createField(child, ititAST); fields.add(field); fieldBindings.add(new FieldBinding(field, getReturnTypeBinding(child.getCorrespondingTypeSignature().toCharArray(), ititAST.binding), field.modifiers, ititAST.binding)); } else if (child.getKind() == IProgramElement.Kind.METHOD) { MethodDeclaration method = createMethod(child, ititAST, null); methods.add(method); methodBindings.add(new MethodBinding(method.modifiers, method.selector, getReturnTypeBinding(child.getCorrespondingTypeSignature().toCharArray(), ititAST.binding), getParameterBindings(elt, ititAST.binding), new ReferenceBinding[0], ititAST.binding)); } } ititAST.fields = (FieldDeclaration[]) fields.toArray(new FieldDeclaration[0]); ititAST.methods = (AbstractMethodDeclaration[]) methods.toArray(new MethodDeclaration[0]); // figure out how to make type bindings and figure out method bindings ititAST.binding.setFields(fieldBindings.toArray(new FieldBinding[0])); }
From source file:org.eclipse.jdt.internal.compiler.lookup.Scope.java
License:Open Source License
public MethodBinding getStaticFactory(ReferenceBinding allocationType, ReferenceBinding originalEnclosingType, TypeBinding[] argumentTypes, final InvocationSite allocationSite) { TypeVariableBinding[] classTypeVariables = allocationType.typeVariables(); int classTypeVariablesArity = classTypeVariables.length; MethodBinding[] methods = allocationType.getMethods(TypeConstants.INIT, argumentTypes.length); MethodBinding[] staticFactories = new MethodBinding[methods.length]; int sfi = 0;/* w w w . j a v a 2 s .co m*/ for (int i = 0, length = methods.length; i < length; i++) { MethodBinding method = methods[i]; int paramLength = method.parameters.length; boolean isVarArgs = method.isVarargs(); if (argumentTypes.length != paramLength) if (!isVarArgs || argumentTypes.length < paramLength - 1) continue; // incompatible TypeVariableBinding[] methodTypeVariables = method.typeVariables(); int methodTypeVariablesArity = methodTypeVariables.length; MethodBinding staticFactory = new MethodBinding(method.modifiers | ClassFileConstants.AccStatic, TypeConstants.SYNTHETIC_STATIC_FACTORY, null, null, null, method.declaringClass); staticFactory.typeVariables = new TypeVariableBinding[classTypeVariablesArity + methodTypeVariablesArity]; final SimpleLookupTable map = new SimpleLookupTable(classTypeVariablesArity + methodTypeVariablesArity); // Rename each type variable T of the type to T' final LookupEnvironment environment = environment(); for (int j = 0; j < classTypeVariablesArity; j++) { map.put(classTypeVariables[j], staticFactory.typeVariables[j] = new TypeVariableBinding( CharOperation.concat(classTypeVariables[j].sourceName, "'".toCharArray()), //$NON-NLS-1$ staticFactory, j, environment)); } // Rename each type variable U of method U to U''. for (int j = classTypeVariablesArity, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) { map.put(methodTypeVariables[j - classTypeVariablesArity], (staticFactory.typeVariables[j] = new TypeVariableBinding( CharOperation.concat(methodTypeVariables[j - classTypeVariablesArity].sourceName, "''".toCharArray()), //$NON-NLS-1$ staticFactory, j, environment))); } ReferenceBinding enclosingType = originalEnclosingType; while (enclosingType != null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=345968 if (enclosingType.kind() == Binding.PARAMETERIZED_TYPE) { final ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) enclosingType; final ReferenceBinding genericType = parameterizedType.genericType(); TypeVariableBinding[] enclosingClassTypeVariables = genericType.typeVariables(); int enclosingClassTypeVariablesArity = enclosingClassTypeVariables.length; for (int j = 0; j < enclosingClassTypeVariablesArity; j++) { map.put(enclosingClassTypeVariables[j], parameterizedType.arguments[j]); } } enclosingType = enclosingType.enclosingType(); } final Scope scope = this; Substitution substitution = new Substitution() { public LookupEnvironment environment() { return scope.environment(); } public boolean isRawSubstitution() { return false; } public TypeBinding substitute(TypeVariableBinding typeVariable) { TypeBinding retVal = (TypeBinding) map.get(typeVariable); return retVal != null ? retVal : typeVariable; } }; // initialize new variable bounds for (int j = 0, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) { TypeVariableBinding originalVariable = j < classTypeVariablesArity ? classTypeVariables[j] : methodTypeVariables[j - classTypeVariablesArity]; TypeBinding substitutedType = (TypeBinding) map.get(originalVariable); if (substitutedType instanceof TypeVariableBinding) { TypeVariableBinding substitutedVariable = (TypeVariableBinding) substitutedType; TypeBinding substitutedSuperclass = Scope.substitute(substitution, originalVariable.superclass); ReferenceBinding[] substitutedInterfaces = Scope.substitute(substitution, originalVariable.superInterfaces); if (originalVariable.firstBound != null) { substitutedVariable.firstBound = originalVariable.firstBound == originalVariable.superclass ? substitutedSuperclass // could be array type or interface : substitutedInterfaces[0]; } switch (substitutedSuperclass.kind()) { case Binding.ARRAY_TYPE: substitutedVariable.superclass = environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); substitutedVariable.superInterfaces = substitutedInterfaces; break; default: if (substitutedSuperclass.isInterface()) { substitutedVariable.superclass = environment .getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); int interfaceCount = substitutedInterfaces.length; System.arraycopy(substitutedInterfaces, 0, substitutedInterfaces = new ReferenceBinding[interfaceCount + 1], 1, interfaceCount); substitutedInterfaces[0] = (ReferenceBinding) substitutedSuperclass; substitutedVariable.superInterfaces = substitutedInterfaces; } else { substitutedVariable.superclass = (ReferenceBinding) substitutedSuperclass; // typeVar was extending other typeVar which got substituted with interface substitutedVariable.superInterfaces = substitutedInterfaces; } } } } TypeVariableBinding[] returnTypeParameters = new TypeVariableBinding[classTypeVariablesArity]; for (int j = 0; j < classTypeVariablesArity; j++) { returnTypeParameters[j] = (TypeVariableBinding) map.get(classTypeVariables[j]); } staticFactory.returnType = environment.createParameterizedType(allocationType, returnTypeParameters, allocationType.enclosingType()); staticFactory.parameters = Scope.substitute(substitution, method.parameters); staticFactory.thrownExceptions = Scope.substitute(substitution, method.thrownExceptions); if (staticFactory.thrownExceptions == null) { staticFactory.thrownExceptions = Binding.NO_EXCEPTIONS; } staticFactories[sfi++] = new ParameterizedMethodBinding( (ParameterizedTypeBinding) environment.convertToParameterizedType(staticFactory.declaringClass), staticFactory); } if (sfi == 0) return null; if (sfi != methods.length) { System.arraycopy(staticFactories, 0, staticFactories = new MethodBinding[sfi], 0, sfi); } MethodBinding[] compatible = new MethodBinding[sfi]; int compatibleIndex = 0; for (int i = 0; i < sfi; i++) { MethodBinding compatibleMethod = computeCompatibleMethod(staticFactories[i], argumentTypes, allocationSite); if (compatibleMethod != null) { if (compatibleMethod.isValidBinding()) compatible[compatibleIndex++] = compatibleMethod; } } if (compatibleIndex == 0) { return null; } MethodBinding[] visible = new MethodBinding[compatibleIndex]; int visibleIndex = 0; for (int i = 0; i < compatibleIndex; i++) { MethodBinding method = compatible[i]; if (method.canBeSeenBy(allocationSite, this)) visible[visibleIndex++] = method; } if (visibleIndex == 0) { return null; } return visibleIndex == 1 ? visible[0] : mostSpecificMethodBinding(visible, visibleIndex, argumentTypes, allocationSite, allocationType); }
From source file:org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.java
License:Open Source License
private void addDefaultAbstractMethods() { if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;/*from ww w. j a va 2 s.co m*/ this.tagBits |= TagBits.KnowsDefaultAbstractMethods; if (isClass() && isAbstract()) { if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2) return; // no longer added for post 1.2 targets ReferenceBinding[] itsInterfaces = superInterfaces(); if (itsInterfaces != Binding.NO_SUPERINTERFACES) { MethodBinding[] defaultAbstracts = null; int defaultAbstractsCount = 0; ReferenceBinding[] interfacesToVisit = itsInterfaces; int nextPosition = interfacesToVisit.length; for (int i = 0; i < nextPosition; i++) { ReferenceBinding superType = interfacesToVisit[i]; if (superType.isValidBinding()) { MethodBinding[] superMethods = superType.methods(); nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) { MethodBinding method = superMethods[m]; // explicitly implemented ? if (implementsMethod(method)) continue nextAbstractMethod; if (defaultAbstractsCount == 0) { defaultAbstracts = new MethodBinding[5]; } else { // already added as default abstract ? for (int k = 0; k < defaultAbstractsCount; k++) { MethodBinding alreadyAdded = defaultAbstracts[k]; if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method)) continue nextAbstractMethod; } } MethodBinding defaultAbstract = new MethodBinding( method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic, method.selector, method.returnType, method.parameters, method.thrownExceptions, this); if (defaultAbstractsCount == defaultAbstracts.length) System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount); defaultAbstracts[defaultAbstractsCount++] = defaultAbstract; } if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface: for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (next == interfacesToVisit[b]) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } } if (defaultAbstractsCount > 0) { int length = this.methods.length; System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length); System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount); // re-sort methods length = length + defaultAbstractsCount; if (length > 1) ReferenceBinding.sortMethods(this.methods, 0, length); // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods() } } } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.FieldAccessSpec.java
License:Open Source License
/** * Create a faked method binding representing the access method to be generated by OTRE. *//*from w w w . j a v a 2 s. c o m*/ private MethodBinding createMethod(Scope scope, ReferenceBinding baseType, char[] accessorSelector) { if (baseType.isRoleType()) baseType = baseType.getRealClass(); if (this.calloutModifier == TerminalTokens.TokenNameget) { // Use the actual field type rather than the expected type (role view) // because several callouts to the same field could exist. // RoleTypeCreator.maybeWrapQualifiedRoleType(MessageSend,BlockScope) // will wrap the type using a faked _OT$base receiver. return FieldModel.getDecapsulatingFieldAccessor(scope, baseType, this.resolvedField, true, this.implementationStrategy); } else { TypeBinding declaredFieldType = this.hasSignature ? this.parameters[0] : this.fieldType; int access; TypeBinding[] argTypes; if (this.implementationStrategy == ImplementationStrategy.DYN_ACCESS) { access = ClassFileConstants.AccPublic; argTypes = new TypeBinding[] { declaredFieldType }; } else { access = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic; argTypes = this.resolvedField.isStatic() ? new TypeBinding[] { declaredFieldType } : new TypeBinding[] { baseType, declaredFieldType }; } MethodBinding result = new MethodBinding(access, accessorSelector, TypeBinding.VOID, argTypes, Binding.NO_EXCEPTIONS, baseType); baseType.addMethod(result); return result; } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.ConstantPoolObjectReader.java
License:Open Source License
private MethodBinding getMethodRef(int index) { int start = getConstantPoolStartPosition(index); assert (u1At(start) == MethodRefTag); int class_index = u2At(start + 1); int name_index = u2At(start + 3); ReferenceBinding class_rb = getClassBinding(class_index); // deactivated, see below. ReferenceBinding actualReceiver = class_rb; if (class_rb == null) return null; char[][] nameandtype = getNameAndType(name_index); char[] name = nameandtype[0]; char[] type = nameandtype[1]; MethodBinding mb = findMethodBinding(class_rb, name, type); // Note: donot revert to actual receiver, because the linkage of // copyInheritanceSrc will otherwise be broken! if (mb == null && CharOperation.endsWith(name, IOTConstants._OT_TAG)) { // This method is faked within the compiler, will be added by the OTRE. return new MethodBinding(ClassFileConstants.AccPublic, name, TypeBinding.SHORT, Binding.NO_PARAMETERS, Binding.NO_EXCEPTIONS, class_rb); }//from www .ja va 2 s . c om assert (mb != null); return mb; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.ConstantPoolObjectReader.java
License:Open Source License
/** Stolen mainly from BinaryTypeBinding.createMethod. */ private MethodBinding createMethodFromSignature(ReferenceBinding declaringClass, int methodModifiers, char[] methodSelector, char[] methodSignature) { int numOfParams = 0; char nextChar; int index = 0; // first character is always '(' so skip it while ((nextChar = methodSignature[++index]) != ')') { if (nextChar != '[') { numOfParams++;/*from www . jav a 2 s . c o m*/ if (nextChar == 'L') while ((nextChar = methodSignature[++index]) != ';') { /*empty*/} } } // Ignore synthetic argument for member types. int startIndex = 0; TypeBinding[] parameters = Binding.NO_PARAMETERS; int size = numOfParams - startIndex; if (size > 0) { parameters = new TypeBinding[size]; index = 1; int end = 0; // first character is always '(' so skip it for (int i = 0; i < numOfParams; i++) { while ((nextChar = methodSignature[++end]) == '[') { /*empty*/} if (nextChar == 'L') while ((nextChar = methodSignature[++end]) != ';') { /*empty*/} if (i >= startIndex) // skip the synthetic arg if necessary parameters[i - startIndex] = this._environment.getTypeFromSignature(methodSignature, index, end, false/*GENERIC*/, this._srcModel.getBinding(), null, TypeAnnotationWalker.EMPTY_ANNOTATION_WALKER); // no missing type info available index = end + 1; } } return new MethodBinding(methodModifiers, methodSelector, this._environment.getTypeFromSignature(methodSignature, index + 1, -1, false/*GENERIC*/, this._srcModel.getBinding(), // index is currently pointing at the ')' null, TypeAnnotationWalker.EMPTY_ANNOTATION_WALKER), parameters, Binding.NO_EXCEPTIONS, declaringClass); }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.SyntheticBaseCallSurrogate.java
License:Open Source License
/** * Retrieve or create a method binding representing the base call surrogate for a callin method. * The actual method will be created by the OTRE. * * PRE: callinMethod already has all signature enhancements * * @param callinMethod/*www . java 2s .co m*/ * @param environment needed for lookup of java/lang/Object (needed for return type generalization). * and for wrapping role types. * @return a MethodBinding (if it already exists or if role is binary) or a new SyntheticBaseCallSurrogate or null (if none is required) */ public static MethodBinding getBaseCallSurrogate(MethodBinding callinMethod, RoleModel clazz, LookupEnvironment environment) { try { if (TSuperHelper.isTSuper(callinMethod)) return null; if (SyntheticBaseCallSurrogate.isBindingForCallinMethodInherited(callinMethod)) return null; MethodBinding result = null; ReferenceBinding roleType = callinMethod.declaringClass; ReferenceBinding teamType = roleType.enclosingType(); ReferenceBinding declaringClass = callinMethod.isStatic() ? teamType : roleType; char[] roleName = roleType.sourceName(); char[] selector = genSurrogateName(callinMethod.selector, roleName, callinMethod.isStatic()); TypeBinding returnType = MethodSignatureEnhancer.getGeneralizedReturnType(callinMethod.returnType, environment); TypeBinding[] baseCallParameters = callinMethod.parameters; if (!callinMethod.isStatic()) baseCallParameters = addIsSuperAccessArg(baseCallParameters, environment.globalOptions.weavingScheme); // search existing surrogate: candidates: for (MethodBinding candidate : declaringClass.getMethods(selector)) { if (candidate.parameters.length != baseCallParameters.length) continue; for (int i = 0; i < baseCallParameters.length; i++) if (!areTypesEqual(baseCallParameters[i].erasure(), candidate.parameters[i])) continue candidates; result = candidate; break; } if (result == null) { if (declaringClass.isBinaryBinding()) result = new MethodBinding(ClassFileConstants.AccPublic, selector, returnType, baseCallParameters, null /*exceptions*/, declaringClass); else result = ((SourceTypeBinding) declaringClass).addSyntheticBaseCallSurrogate(callinMethod); MethodModel.getModel(result)._fakeKind = MethodModel.FakeKind.BASECALL_SURROGATE; RoleTypeCreator.wrapTypesInMethodBindingSignature(result, environment); result.modifiers &= ~ExtraCompilerModifiers.AccUnresolved; declaringClass.addMethod(result); } MethodModel.getModel(callinMethod).setBaseCallSurrogate(result); return result; } catch (RuntimeException ex) { // check if failure is due to incompatible class file version if (clazz != null && clazz.isIncompatibleCompilerVersion()) { String version; version = WordValueAttribute.getBytecodeVersionString(clazz._compilerVersion); // note: we have no source to report this error against, // so use whatever the current problem reporter is configured for. String errorMessage = "Byte code for class " + String.valueOf(clazz.getBinding().readableName()) //$NON-NLS-1$ + " has incompatible version " + version + ", original error was: " + ex.toString(); //$NON-NLS-1$ //$NON-NLS-2$ try { Config.getLookupEnvironment().problemReporter.abortDueToInternalError(errorMessage); } catch (NotConfiguredException e) { throw new AbortCompilation(false, e); } return null; } throw ex; // want to see all other exceptions } }