Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60024 Details for
Bug 174588
[compiler] Code in abstract class calls wrong overloaded method. Correct method is defined in the implemented interface.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Suggested change
patch.txt (text/plain), 5.05 KB, created by
Kent Johnson
on 2007-02-28 16:55:45 EST
(
hide
)
Description:
Suggested change
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-02-28 16:55:45 EST
Size:
5.05 KB
patch
obsolete
>Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.299 >diff -u -r1.299 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 29 Jan 2007 07:37:02 -0000 1.299 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 28 Feb 2007 21:48:08 -0000 >@@ -1114,6 +1114,7 @@ > MethodBinding[] candidates = null; > int candidatesCount = 0; > MethodBinding problemMethod = null; >+ boolean searchForDefaultAbstractMethod = isCompliant14 && !receiverType.isInterface() && (receiverType.isAbstract() || receiverType.isTypeVariable()); > if (foundSize > 0) { > // argument type compatibility check > for (int i = 0; i < foundSize; i++) { >@@ -1123,7 +1124,7 @@ > if (compatibleMethod.isValidBinding()) { > if (foundSize == 1 && compatibleMethod.canBeSeenBy(receiverType, invocationSite, this)) { > // return the single visible match now >- if (isCompliant14 && (receiverType.isAbstract() || receiverType.isTypeVariable())) >+ if (searchForDefaultAbstractMethod) > return findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, compatibleMethod); > unitScope.recordTypeReferences(compatibleMethod.thrownExceptions); > return compatibleMethod; >@@ -1186,27 +1187,35 @@ > > // tiebreak using visibility check > int visiblesCount = 0; >- for (int i = 0; i < candidatesCount; i++) { >- MethodBinding methodBinding = candidates[i]; >- if (methodBinding.canBeSeenBy(receiverType, invocationSite, this)) { >- if (visiblesCount != i) { >- candidates[i] = null; >- candidates[visiblesCount] = methodBinding; >- } >- visiblesCount++; >- } >- } >- if (visiblesCount == 1) { >- if (isCompliant14 && (receiverType.isAbstract() || receiverType.isTypeVariable())) >- return findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, candidates[0]); >- unitScope.recordTypeReferences(candidates[0].thrownExceptions); >- return candidates[0]; >- } >- if (visiblesCount == 0) { >- MethodBinding interfaceMethod = >- findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, null); >- if (interfaceMethod != null) return interfaceMethod; >- return new ProblemMethodBinding(candidates[0], candidates[0].selector, candidates[0].parameters, ProblemReasons.NotVisible); >+ if (receiverType.isInterface()) { >+ if (candidatesCount == 1) { >+ unitScope.recordTypeReferences(candidates[0].thrownExceptions); >+ return candidates[0]; >+ } >+ visiblesCount = candidatesCount; >+ } else { >+ for (int i = 0; i < candidatesCount; i++) { >+ MethodBinding methodBinding = candidates[i]; >+ if (methodBinding.canBeSeenBy(receiverType, invocationSite, this)) { >+ if (visiblesCount != i) { >+ candidates[i] = null; >+ candidates[visiblesCount] = methodBinding; >+ } >+ visiblesCount++; >+ } >+ } >+ if (visiblesCount == 1) { >+ if (searchForDefaultAbstractMethod) >+ return findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, candidates[0]); >+ unitScope.recordTypeReferences(candidates[0].thrownExceptions); >+ return candidates[0]; >+ } >+ if (visiblesCount == 0) { >+ MethodBinding interfaceMethod = >+ findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, null); >+ if (interfaceMethod != null) return interfaceMethod; >+ return new ProblemMethodBinding(candidates[0], candidates[0].selector, candidates[0].parameters, ProblemReasons.NotVisible); >+ } > } > > if (complianceLevel <= ClassFileConstants.JDK1_3) { >@@ -1230,11 +1239,14 @@ > } > > MethodBinding mostSpecificMethod = mostSpecificMethodBinding(candidates, visiblesCount, argumentTypes, invocationSite, receiverType); >- if (isCompliant15 >- && mostSpecificMethod.isValidBinding() >- && parameterCompatibilityLevel(mostSpecificMethod, argumentTypes) > COMPATIBLE) { >- // see if there is a better match in the interfaces - see AutoBoxingTest 99 >+ if (searchForDefaultAbstractMethod) { // search interfaces for a better match >+ if (mostSpecificMethod.isValidBinding()) >+ // see if there is a better match in the interfaces - see AutoBoxingTest 99, LookupTest#81 > return findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, mostSpecificMethod); >+ // see if there is a match in the interfaces - see LookupTest#84 >+ MethodBinding interfaceMethod = findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, found, null); >+ if (interfaceMethod != null && interfaceMethod.isValidBinding() /* else return the same error as before */) >+ return interfaceMethod; > } > return mostSpecificMethod; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 174588
:
59468
|
59545
|
59636
|
59643
| 60024 |
60148
|
60207
|
60210