Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
* bug 186342 - [compiler][null] Using annotations for null checking
* bug 367203 - [compiler][null] detect assigning null to nonnull argument
* bug 365519 - editorial cleanup after bug 186342 and bug 365387
* bug 365662 - [compiler][null] warn on contradictory and redundant null annotations
* bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
* bug 388281 - [compiler][null] inheritance of null annotations as an option
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 417295 - [1.8[[null] Massage type annotated null analysis to gel well with deep encoded type bindings.
* Bug 400874 - [1.8][compiler] Inference infrastructure should evolve to meet JLS8 18.x (Part G of JSR335 spec)
* Bug 425152 - [1.8] [compiler] Lambda Expression not resolved but flow analyzed leading to NPE.
* Bug 423505 - [1.8] Implement "18.5.4 More Specific Method Inference"
* Bug 429958 - [1.8][null] evaluate new DefaultLocation attribute of @NonNullByDefault
* Bug 438012 - [1.8][null] Bogus Warning: The nullness annotation is redundant with a default that applies to this location
* Bug 440759 - [1.8][null] @NonNullByDefault should never affect wildcards and uses of a type variable
* Bug 443347 - [1.8][null] @NonNullByDefault should not affect constructor arguments of an anonymous instantiation
* Bug 435805 - [1.8][compiler][null] Java 8 compiler does not recognize declaration style null annotations
* Bug 466713 - Null Annotations: NullPointerException using as Type Param
* Bug 456584 - [1.8][null] Bogus warning for return type variable's @NonNull annotation being 'redundant'
* Bug 471611 - Error on hover on call to generic method with null annotation
* Jesper Steen Moller - Contributions for
* Bug 412150 [1.8] [compiler] Enable reflected parameter names during annotation processing
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
import java.util.List;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.LambdaExpression;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.util.Util;
public class MethodBinding extends Binding {
public int modifiers;
public char[] selector;
public TypeBinding returnType;
public TypeBinding[] parameters;
public TypeBinding receiver; // JSR308 - explicit this parameter
public ReferenceBinding[] thrownExceptions;
public ReferenceBinding declaringClass;
public TypeVariableBinding[] typeVariables = Binding.NO_TYPE_VARIABLES;
char[] signature;
public long tagBits;
public int extendedTagBits = 0; // See values in the interface ExtendedTagBits
// Used only for constructors
protected AnnotationBinding [] typeAnnotations = Binding.NO_ANNOTATIONS;
public int defaultNullness; // for null *type* annotations
/** Store flow-related information from declaration annotations (nullness and owning) (incl. applicable default). */
public byte[] parameterFlowBits;
// bit constant per each cell of the above:
public static byte PARAM_NONNULL = 1;
public static byte PARAM_NULLABLE = 2;
public static byte PARAM_NULLITY = (byte) (PARAM_NONNULL | PARAM_NULLABLE);
public static byte PARAM_OWNING = 4;
public static byte PARAM_NOTOWNING = 8;
public static byte flowBitFromAnnotationTagBit(long tagBit) {
if (tagBit == TagBits.AnnotationNonNull)
return PARAM_NONNULL;
if (tagBit == TagBits.AnnotationNullable)
return PARAM_NULLABLE;
if (tagBit == TagBits.AnnotationOwning)
return PARAM_OWNING;
if (tagBit == TagBits.AnnotationNotOwning)
return PARAM_NOTOWNING;
return 0;
}
/** Store parameter names from MethodParameters attribute (incl. applicable default). */
public char[][] parameterNames = Binding.NO_PARAMETER_NAMES;
protected MethodBinding() {
// for creating problem or synthetic method
}
public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
this.modifiers = modifiers;
this.selector = selector;
this.returnType = returnType;
this.parameters = (parameters == null || parameters.length == 0) ? Binding.NO_PARAMETERS : parameters;
this.thrownExceptions = (thrownExceptions == null || thrownExceptions.length == 0) ? Binding.NO_EXCEPTIONS : thrownExceptions;
this.declaringClass = declaringClass;
// propagate the strictfp & deprecated modifiers
if (this.declaringClass != null) {
if (this.declaringClass.isStrictfp())
if (!(isNative() || isAbstract()))
this.modifiers |= ClassFileConstants.AccStrictfp;
}
}
public MethodBinding(int modifiers, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
this(modifiers, TypeConstants.INIT, TypeBinding.VOID, parameters, thrownExceptions, declaringClass);
}
// special API used to change method declaring class for runtime visibility check
public MethodBinding(MethodBinding initialMethodBinding, ReferenceBinding declaringClass) {
this.modifiers = initialMethodBinding.modifiers;
this.selector = initialMethodBinding.selector;
this.returnType = initialMethodBinding.returnType;
this.parameters = initialMethodBinding.parameters;
this.thrownExceptions = initialMethodBinding.thrownExceptions;
this.declaringClass = declaringClass;
declaringClass.storeAnnotationHolder(this, initialMethodBinding.declaringClass.retrieveAnnotationHolder(initialMethodBinding, true));
}
/* Answer true if the argument types & the receiver's parameters have the same erasure
*/
public final boolean areParameterErasuresEqual(MethodBinding method) {
TypeBinding[] args = method.parameters;
if (this.parameters == args)
return true;
int length = this.parameters.length;
if (length != args.length)
return false;
for (int i = 0; i < length; i++)
if (TypeBinding.notEquals(this.parameters[i], args[i]) && TypeBinding.notEquals(this.parameters[i].erasure(), args[i].erasure()))
return false;
return true;
}
/*
* Returns true if given parameters are compatible with this method parameters.
* Callers to this method should first check that the number of TypeBindings
* passed as argument matches this MethodBinding number of parameters
*/
public final boolean areParametersCompatibleWith(TypeBinding[] arguments) {
int paramLength = this.parameters.length;
int argLength = arguments.length;
int lastIndex = argLength;
if (isVarargs()) {
lastIndex = paramLength - 1;
if (paramLength == argLength) { // accept X[] but not X or X[][]
TypeBinding varArgType = this.parameters[lastIndex]; // is an ArrayBinding by definition
TypeBinding lastArgument = arguments[lastIndex];
if (TypeBinding.notEquals(varArgType, lastArgument) && !lastArgument.isCompatibleWith(varArgType))
return false;
} else if (paramLength < argLength) { // all remainig argument types must be compatible with the elementsType of varArgType
TypeBinding varArgType = ((ArrayBinding) this.parameters[lastIndex]).elementsType();
for (int i = lastIndex; i < argLength; i++)
if (TypeBinding.notEquals(varArgType, arguments[i]) && !arguments[i].isCompatibleWith(varArgType))
return false;
} else if (lastIndex != argLength) { // can call foo(int i, X ... x) with foo(1) but NOT foo();
return false;
}
// now compare standard arguments from 0 to lastIndex
}
for (int i = 0; i < lastIndex; i++)
if (TypeBinding.notEquals(this.parameters[i], arguments[i]) && !arguments[i].isCompatibleWith(this.parameters[i]))
return false;
return true;
}
/* Answer true if the argument types & the receiver's parameters are equal
*/
public final boolean areParametersEqual(MethodBinding method) {
TypeBinding[] args = method.parameters;
if (this.parameters == args)
return true;
int length = this.parameters.length;
if (length != args.length)
return false;
for (int i = 0; i < length; i++)
if (TypeBinding.notEquals(this.parameters[i], args[i]))
return false;
return true;
}
/* API
* Answer the receiver's binding type from Binding.BindingID.
*/
/* Answer true if the type variables have the same erasure
*/
public final boolean areTypeVariableErasuresEqual(MethodBinding method) {
TypeVariableBinding[] vars = method.typeVariables;
if (this.typeVariables == vars)
return true;
int length = this.typeVariables.length;
if (length != vars.length)
return false;
for (int i = 0; i < length; i++)
if (TypeBinding.notEquals(this.typeVariables[i], vars[i]) && TypeBinding.notEquals(this.typeVariables[i].erasure(), vars[i].erasure()))
return false;
return true;
}
public MethodBinding asRawMethod(LookupEnvironment env) {
if (this.typeVariables == Binding.NO_TYPE_VARIABLES) return this;
// substitute type arguments with raw types
int length = this.typeVariables.length;
TypeBinding[] arguments = new TypeBinding[length];
for (int i = 0; i < length; i++) {
arguments[i] = makeRawArgument(env, this.typeVariables[i]);
}
return env.createParameterizedGenericMethod(this, arguments);
}
private TypeBinding makeRawArgument(LookupEnvironment env, TypeVariableBinding var) {
if (var.boundsCount() <= 1) {
TypeBinding upperBound = var.upperBound();
if (upperBound.isTypeVariable())
return makeRawArgument(env, (TypeVariableBinding) upperBound);
return env.convertToRawType(upperBound, false /*do not force conversion of enclosing types*/);
} else {
// use an intersection type to retain full bound information if more than 1 bound
TypeBinding[] itsSuperinterfaces = var.superInterfaces();
int superLength = itsSuperinterfaces.length;
TypeBinding rawFirstBound = null;
TypeBinding[] rawOtherBounds = null;
if (var.boundsCount() == superLength) {
rawFirstBound = env.convertToRawType(itsSuperinterfaces[0], false);
rawOtherBounds = new TypeBinding[superLength - 1];
for (int s = 1; s < superLength; s++)
rawOtherBounds[s - 1] = env.convertToRawType(itsSuperinterfaces[s], false);
} else {
rawFirstBound = env.convertToRawType(var.superclass(), false);
rawOtherBounds = new TypeBinding[superLength];
for (int s = 0; s < superLength; s++)
rawOtherBounds[s] = env.convertToRawType(itsSuperinterfaces[s], false);
}
return env.createWildcard(null, 0, rawFirstBound, rawOtherBounds, org.eclipse.jdt.internal.compiler.ast.Wildcard.EXTENDS);
}
}
/* Answer true if the receiver is visible to the type provided by the scope.
* InvocationSite implements isSuperAccess() to provide additional information
* if the receiver is protected.
*
* NOTE: This method should ONLY be sent if the receiver is a constructor.
*
* NOTE: Cannot invoke this method with a compilation unit scope.
*/
public final boolean canBeSeenBy(InvocationSite invocationSite, Scope scope) {
if (isPublic()) return true;
SourceTypeBinding invocationType = scope.enclosingSourceType();
if (TypeBinding.equalsEquals(invocationType, this.declaringClass)) return true;
if (isProtected()) {
// answer true if the receiver is in the same package as the invocationType
if (invocationType.fPackage == this.declaringClass.fPackage) return true;
return invocationSite.isSuperAccess();
}
if (isPrivate()) {
// answer true if the invocationType and the declaringClass have a common enclosingType
// already know they are not the identical type
ReferenceBinding outerInvocationType = invocationType;
ReferenceBinding temp = outerInvocationType.enclosingType();
while (temp != null) {
outerInvocationType = temp;
temp = temp.enclosingType();
}
ReferenceBinding outerDeclaringClass = (ReferenceBinding)this.declaringClass.erasure();
temp = outerDeclaringClass.enclosingType();
while (temp != null) {
outerDeclaringClass = temp;
temp = temp.enclosingType();
}
return TypeBinding.equalsEquals(outerInvocationType, outerDeclaringClass);
}
// isDefault()
return invocationType.fPackage == this.declaringClass.fPackage;
}
public final boolean canBeSeenBy(PackageBinding invocationPackage) {
if (isPublic()) return true;
if (isPrivate()) return false;
// isProtected() or isDefault()
return invocationPackage == this.declaringClass.getPackage();
}
/* Answer true if the receiver is visible to the type provided by the scope.
* InvocationSite implements isSuperAccess() to provide additional information
* if the receiver is protected.
*
* NOTE: Cannot invoke this method with a compilation unit scope.
*/
public final boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invocationSite, Scope scope) {
SourceTypeBinding invocationType = scope.enclosingSourceType();
if (this.declaringClass.isInterface() && isStatic() && !isPrivate()) {
// Static interface methods can be explicitly invoked only through the type reference of the declaring interface or implicitly in the interface itself or via static import.
if (scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8)
return false;
if ((invocationSite.isTypeAccess() || invocationSite.receiverIsImplicitThis()) && TypeBinding.equalsEquals(receiverType, this.declaringClass))
return true;
return false;
}
if (isPublic()) return true;
if (TypeBinding.equalsEquals(invocationType, this.declaringClass) && TypeBinding.equalsEquals(invocationType, receiverType)) return true;
if (invocationType == null) // static import call
return !isPrivate() && scope.getCurrentPackage() == this.declaringClass.fPackage;
if (isProtected()) {
// answer true if the invocationType is the declaringClass or they are in the same package
// OR the invocationType is a subclass of the declaringClass
// AND the receiverType is the invocationType or its subclass
// OR the method is a static method accessed directly through a type
// OR previous assertions are true for one of the enclosing type
if (TypeBinding.equalsEquals(invocationType, this.declaringClass)) return true;
if (invocationType.fPackage == this.declaringClass.fPackage) return true;
ReferenceBinding currentType = invocationType;
TypeBinding receiverErasure = receiverType.erasure();
ReferenceBinding declaringErasure = (ReferenceBinding) this.declaringClass.erasure();
int depth = 0;
do {
if (currentType.findSuperTypeOriginatingFrom(declaringErasure) != null) {
if (invocationSite.isSuperAccess())
return true;
// receiverType can be an array binding in one case... see if you can change it
if (receiverType instanceof ArrayBinding)
return false;
if (isStatic()) {
if (depth > 0) invocationSite.setDepth(depth);
return true; // see 1FMEPDL - return invocationSite.isTypeAccess();
}
if (TypeBinding.equalsEquals(currentType, receiverErasure) || receiverErasure.findSuperTypeOriginatingFrom(currentType) != null) {
if (depth > 0) invocationSite.setDepth(depth);
return true;
}
}
depth++;
currentType = currentType.enclosingType();
} while (currentType != null);
return false;
}
if (isPrivate()) {
// answer true if the receiverType is the declaringClass
// AND the invocationType and the declaringClass have a common enclosingType
receiverCheck: {
if (TypeBinding.notEquals(receiverType, this.declaringClass)) {
// special tolerance for type variable direct bounds, but only if compliance <= 1.6, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=334622
if (scope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_6 && receiverType.isTypeVariable() && ((TypeVariableBinding) receiverType).isErasureBoundTo(this.declaringClass.erasure()))
break receiverCheck;
return false;
}
}
if (TypeBinding.notEquals(invocationType, this.declaringClass)) {
ReferenceBinding outerInvocationType = invocationType;
ReferenceBinding temp = outerInvocationType.enclosingType();
while (temp != null) {
outerInvocationType = temp;
temp = temp.enclosingType();
}
ReferenceBinding outerDeclaringClass = (ReferenceBinding)this.declaringClass.erasure();
temp = outerDeclaringClass.enclosingType();
while (temp != null) {
outerDeclaringClass = temp;
temp = temp.enclosingType();
}
if (TypeBinding.notEquals(outerInvocationType, outerDeclaringClass)) return false;
}
return true;
}
// isDefault()
PackageBinding declaringPackage = this.declaringClass.fPackage;
if (invocationType.fPackage != declaringPackage) return false;
// receiverType can be an array binding in one case... see if you can change it
if (receiverType instanceof ArrayBinding)
return false;
TypeBinding originalDeclaringClass = this.declaringClass.original();
ReferenceBinding currentType = (ReferenceBinding) (receiverType);
do {
if (currentType.isCapture()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002
if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.erasure().original())) return true;
} else {
if (TypeBinding.equalsEquals(originalDeclaringClass, currentType.original())) return true;
}
PackageBinding currentPackage = currentType.fPackage;
// package could be null for wildcards/intersection types, ignore and recurse in superclass
if (!currentType.isCapture() && currentPackage != null && currentPackage != declaringPackage) return false;
} while ((currentType = currentType.superclass()) != null);
return false;
}
public List collectMissingTypes(List missingTypes, boolean considerReturnType) {
if ((this.tagBits & TagBits.HasMissingType) != 0) {
if (considerReturnType) {
missingTypes = this.returnType.collectMissingTypes(missingTypes);
}
for (TypeBinding parameter : this.parameters) {
missingTypes = parameter.collectMissingTypes(missingTypes);
}
for (ReferenceBinding thrownException : this.thrownExceptions) {
missingTypes = thrownException.collectMissingTypes(missingTypes);
}
for (TypeVariableBinding variable : this.typeVariables) {
missingTypes = variable.superclass().collectMissingTypes(missingTypes);
ReferenceBinding[] interfaces = variable.superInterfaces();
for (ReferenceBinding binding : interfaces) {
missingTypes = binding.collectMissingTypes(missingTypes);
}
}
}
return missingTypes;
}
public MethodBinding computeSubstitutedMethod(MethodBinding method, LookupEnvironment env) {
int length = this.typeVariables.length;
TypeVariableBinding[] vars = method.typeVariables;
if (length != vars.length)
return null;
// must substitute to detect cases like:
// > void dup() {}
// > Object dup() {return null;}
ParameterizedGenericMethodBinding substitute =
env.createParameterizedGenericMethod(method, this.typeVariables);
for (int i = 0; i < length; i++)
if (!this.typeVariables[i].isInterchangeableWith(vars[i], substitute))
return null;
return substitute;
}
/*
* declaringUniqueKey dot selector genericSignature
* p.X { void bar(X t) } --> Lp/X;.bar(LX;)V
*/
@Override
public char[] computeUniqueKey(boolean isLeaf) {
// declaring class
char[] declaringKey = this.declaringClass.computeUniqueKey(false/*not a leaf*/);
int declaringLength = declaringKey.length;
// selector
int selectorLength = this.selector == TypeConstants.INIT ? 0 : this.selector.length;
// generic signature
char[] sig = genericSignature();
boolean isGeneric = sig != null;
if (!isGeneric) sig = signature();
int signatureLength = sig.length;
// thrown exceptions
int thrownExceptionsLength = this.thrownExceptions.length;
int thrownExceptionsSignatureLength = 0;
char[][] thrownExceptionsSignatures = null;
boolean addThrownExceptions = thrownExceptionsLength > 0 && (!isGeneric || CharOperation.lastIndexOf('^', sig) < 0);
if (addThrownExceptions) {
thrownExceptionsSignatures = new char[thrownExceptionsLength][];
for (int i = 0; i < thrownExceptionsLength; i++) {
if (this.thrownExceptions[i] != null) {
thrownExceptionsSignatures[i] = this.thrownExceptions[i].signature();
thrownExceptionsSignatureLength += thrownExceptionsSignatures[i].length + 1; // add one char for separator
}
}
}
char[] uniqueKey = new char[declaringLength + 1 + selectorLength + signatureLength + thrownExceptionsSignatureLength];
int index = 0;
System.arraycopy(declaringKey, 0, uniqueKey, index, declaringLength);
index = declaringLength;
uniqueKey[index++] = '.';
System.arraycopy(this.selector, 0, uniqueKey, index, selectorLength);
index += selectorLength;
System.arraycopy(sig, 0, uniqueKey, index, signatureLength);
if (thrownExceptionsSignatureLength > 0) {
index += signatureLength;
for (int i = 0; i < thrownExceptionsLength; i++) {
char[] thrownExceptionSignature = thrownExceptionsSignatures[i];
if (thrownExceptionSignature != null) {
uniqueKey[index++] = '|';
int length = thrownExceptionSignature.length;
System.arraycopy(thrownExceptionSignature, 0, uniqueKey, index, length);
index += length;
}
}
}
return uniqueKey;
}
/* Answer the receiver's constant pool name.
*
* for constructors
* for clinit methods
* or the source name of the method
*/
public final char[] constantPoolName() {
return this.selector;
}
/**
* After method verifier has finished, fill in missing @NonNull specification from the applicable default.
*/
protected void fillInDefaultNonNullness(AbstractMethodDeclaration sourceMethod, boolean needToApplyReturnNonNullDefault, ParameterNonNullDefaultProvider needToApplyParameterNonNullDefault) {
if (this.parameterFlowBits == null)
this.parameterFlowBits = new byte[this.parameters.length];
boolean added = false;
int length = this.parameterFlowBits.length;
for (int i = 0; i < length; i++) {
if(!needToApplyParameterNonNullDefault.hasNonNullDefaultForParam(i)) {
continue;
}
if (this.parameters[i].isBaseType())
continue;
int nullity = this.parameterFlowBits[i] & PARAM_NULLITY;
if (nullity == 0) {
added = true;
this.parameterFlowBits[i] |= PARAM_NONNULL;
if (sourceMethod != null) {
sourceMethod.arguments[i].binding.tagBits |= TagBits.AnnotationNonNull;
}
} else if (sourceMethod != null && (this.parameterFlowBits[i] & PARAM_NONNULL) != 0) {
sourceMethod.scope.problemReporter().nullAnnotationIsRedundant(sourceMethod, i);
}
}
if (added)
this.tagBits |= TagBits.HasParameterAnnotations;
if(!needToApplyReturnNonNullDefault)
return;
if ( this.returnType != null
&& !this.returnType.isBaseType()
&& (this.tagBits & TagBits.AnnotationNullMASK) == 0)
{
this.tagBits |= TagBits.AnnotationNonNull;
} else if (sourceMethod != null && (this.tagBits & TagBits.AnnotationNonNull) != 0) {
sourceMethod.scope.problemReporter().nullAnnotationIsRedundant(sourceMethod, -1/*signifies method return*/);
}
}
//pre: null annotation analysis is enabled
protected void fillInDefaultNonNullness18(AbstractMethodDeclaration sourceMethod, LookupEnvironment env) {
MethodBinding original = original();
if(original == null) {
return;
}
ParameterNonNullDefaultProvider hasNonNullDefaultForParameter = hasNonNullDefaultForParameter(sourceMethod);
if (hasNonNullDefaultForParameter.hasAnyNonNullDefault()) {
boolean added = false;
int length = this.parameters.length;
for (int i = 0; i < length; i++) {
if (!hasNonNullDefaultForParameter.hasNonNullDefaultForParam(i))
continue;
TypeBinding parameter = this.parameters[i];
if (!original.parameters[i].acceptsNonNullDefault())
continue;
long existing = parameter.tagBits & TagBits.AnnotationNullMASK;
if (existing == 0L) {
added = true;
if (!parameter.isBaseType()) {
this.parameters[i] = env.createNonNullAnnotatedType(parameter);
if (sourceMethod != null)
sourceMethod.arguments[i].binding.type = this.parameters[i];
}
}
}
if (added)
this.tagBits |= TagBits.HasParameterAnnotations;
}
if (original.returnType != null && hasNonNullDefaultForReturnType(sourceMethod) && original.returnType.acceptsNonNullDefault()) {
if ((this.returnType.tagBits & TagBits.AnnotationNullMASK) == 0) {
this.returnType = env.createAnnotatedType(this.returnType, new AnnotationBinding[]{env.getNonNullAnnotation()});
} else if (sourceMethod instanceof MethodDeclaration && (this.returnType.tagBits & TagBits.AnnotationNonNull) != 0
&& ((MethodDeclaration)sourceMethod).hasNullTypeAnnotation(AnnotationPosition.MAIN_TYPE)) {
sourceMethod.scope.problemReporter().nullAnnotationIsRedundant(sourceMethod, -1/*signifies method return*/);
}
}
}
public MethodBinding findOriginalInheritedMethod(MethodBinding inheritedMethod) {
MethodBinding inheritedOriginal = inheritedMethod.original();
TypeBinding superType = this.declaringClass.findSuperTypeOriginatingFrom(inheritedOriginal.declaringClass);
if (superType == null || !(superType instanceof ReferenceBinding)) return null;
if (TypeBinding.notEquals(inheritedOriginal.declaringClass, superType)) {
// must find inherited method with the same substituted variables
MethodBinding[] superMethods = ((ReferenceBinding) superType).getMethods(inheritedOriginal.selector, inheritedOriginal.parameters.length);
for (MethodBinding superMethod : superMethods)
if (superMethod.original() == inheritedOriginal)
return superMethod;
}
return inheritedOriginal;
}
/**
*