for (int i = 0, length = this.methods.length; i < length; i++) {
MethodBinding method = resolvedMethods[i];
if (method == null)
continue;
char[] selector = method.selector;
AbstractMethodDeclaration methodDecl = null;
nextSibling: for (int j = i + 1; j < length; j++) {
MethodBinding method2 = resolvedMethods[j];
if (method2 == null)
continue nextSibling;
if (!CharOperation.equals(selector, method2.selector))
break nextSibling; // methods with same selector are contiguous
if (complyTo15 ? !method.areParameterErasuresEqual(method2) : !method.areParametersEqual(method2))
continue nextSibling; // otherwise duplicates / name clash
boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
// report duplicate
boolean removeMethod2 = true;
if (methodDecl == null) {
methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
boolean removeMethod = method.returnType == null && method2.returnType != null;
if (isEnumSpecialMethod) {
this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
// remove user defined methods & keep the synthetic
removeMethod = true;
} else {
this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
}
if (removeMethod) {
removeMethod2 = false;
methodDecl.binding = null;
// do not alter original method array until resolution is over, due to reentrance (143259)
if (resolvedMethods == this.methods)
System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
resolvedMethods[i] = null;
failed++;
}
}
}
AbstractMethodDeclaration method2Decl = method2.sourceMethod();
if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
if (isEnumSpecialMethod) {
this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
removeMethod2 = true;
} else {