Fix for Bug 326689 - [compiler] inferred callout not working with overloads and same-named callin method.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 2fbb5de..7378da3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -661,6 +661,24 @@
if (problem.closestMatch != null)
bindingModifiers = problem.closestMatch.modifiers;
}
+ // can we infer a callout to implement the missing method?
+ if (this.binding.problemId() == ProblemReasons.NotFound) {
+ if (CharOperation.prefixEquals(IOTConstants.OT_DOLLAR_NAME, this.selector) && scope.referenceType().ignoreFurtherInvestigation)
+ return null; // type already reported error, this message send is obviously generated, don't bother any more
+ if (CalloutImplementor.inferMappingFromCall(scope.referenceType(), this, argumentTypes)) {
+ scope.problemReporter().usingInferredCalloutForMessageSend(this);
+ returnType = this.binding.returnType;
+ bindingModifiers = this.binding.modifiers;
+ }
+ } else {
+ CalloutMappingDeclaration callout = MethodModel.getImplementingInferredCallout(this.binding); // reusing previously inferred callout?
+ if (callout != null) {
+ if (callout.isCalloutToField())
+ scope.problemReporter().usingInferredCalloutToFieldForMessageSend(this); // error
+ else
+ scope.problemReporter().usingInferredCalloutForMessageSend(this); // warning
+ }
+ }
if ((bindingModifiers & ExtraCompilerModifiers.AccCallin) != 0) {
AbstractMethodDeclaration enclosingMethod = scope.methodScope().referenceMethod();
boolean callinAllowed;
@@ -676,23 +694,6 @@
return this.resolvedType = null;
}
}
- // can we infer a callout to implement the missing method?
- if (this.binding.problemId() == ProblemReasons.NotFound) {
- if (CharOperation.prefixEquals(IOTConstants.OT_DOLLAR_NAME, this.selector) && scope.referenceType().ignoreFurtherInvestigation)
- return null; // type already reported error, this message send is obviously generated, don't bother any more
- if (CalloutImplementor.inferMappingFromCall(scope.referenceType(), this, argumentTypes)) {
- scope.problemReporter().usingInferredCalloutForMessageSend(this);
- returnType = this.binding.returnType;
- }
- } else {
- CalloutMappingDeclaration callout = MethodModel.getImplementingInferredCallout(this.binding); // reusing previously inferred callout?
- if (callout != null) {
- if (callout.isCalloutToField())
- scope.problemReporter().usingInferredCalloutToFieldForMessageSend(this); // error
- else
- scope.problemReporter().usingInferredCalloutForMessageSend(this); // warning
- }
- }
// SH}
if (!this.binding.isValidBinding()) {
if (this.binding.declaringClass == null) {