Lines 1163-1178
Link Here
|
1163 |
} else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case |
1163 |
} else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case |
1164 |
continue nextSibling; |
1164 |
continue nextSibling; |
1165 |
} |
1165 |
} |
1166 |
boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES)); |
|
|
1167 |
// report duplicate |
1166 |
// report duplicate |
1168 |
AbstractMethodDeclaration method2Decl = method2.sourceMethod(); |
1167 |
AbstractMethodDeclaration methodToBlame = method2.sourceMethod(); |
1169 |
if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method |
1168 |
if (methodToBlame == null) { // if method2 is synthetic (like enum#valueOf) blame it on first method instead |
|
|
1169 |
if (methodDecl == null) { |
1170 |
methodDecl = method.sourceMethod(); |
1171 |
} |
1172 |
methodToBlame = methodDecl; |
1173 |
} |
1174 |
if (methodToBlame != null && methodToBlame.binding != null) { // ensure its a valid user defined method |
1175 |
boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES)); |
1170 |
if (isEnumSpecialMethod) { |
1176 |
if (isEnumSpecialMethod) { |
1171 |
this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl); |
1177 |
this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodToBlame); |
1172 |
} else { |
1178 |
} else { |
1173 |
this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2)); |
1179 |
this.scope.problemReporter().duplicateMethodInType(this, methodToBlame, method.areParametersEqual(method2)); |
1174 |
} |
1180 |
} |
1175 |
method2Decl.binding = null; |
1181 |
methodToBlame.binding = null; |
1176 |
// do not alter original method array until resolution is over, due to reentrance (143259) |
1182 |
// do not alter original method array until resolution is over, due to reentrance (143259) |
1177 |
if (resolvedMethods == this.methods) |
1183 |
if (resolvedMethods == this.methods) |
1178 |
System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); |
1184 |
System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length); |