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 151069 Details for
Bug 293384
Eclipse erroneously reports method "is ambiguous for type"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Revised patch
patch.txt (text/plain), 3.30 KB, created by
Srikanth Sankaran
on 2009-11-02 09:13:19 EST
(
hide
)
Description:
Revised patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2009-11-02 09:13:19 EST
Size:
3.30 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.363 >diff -u -r1.363 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 Oct 2009 19:44:10 -0000 1.363 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2 Nov 2009 14:14:54 -0000 >@@ -1393,17 +1393,19 @@ > MethodBinding candidate = candidates[i]; > if (candidate instanceof ParameterizedGenericMethodBinding) > candidate = ((ParameterizedGenericMethodBinding) candidate).originalMethod; >- if (candidate instanceof ParameterizedMethodBinding) >+ if (candidate.hasSubstitutedParameters()) { > for (int j = i + 1; j < visiblesCount; j++) { > MethodBinding otherCandidate = candidates[j]; >- if (otherCandidate == candidate >- || (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) { >- return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); >+ if (otherCandidate.hasSubstitutedParameters()) { >+ if (otherCandidate == candidate >+ || (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) { >+ return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); >+ } > } > } >+ } > } > } >- > if (inStaticContext) { > MethodBinding[] staticCandidates = new MethodBinding[visiblesCount]; > int staticCount = 0; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java,v >retrieving revision 1.72 >diff -u -r1.72 AmbiguousMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 16 Oct 2009 19:44:11 -0000 1.72 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 2 Nov 2009 14:15:00 -0000 >@@ -3502,4 +3502,30 @@ > "" > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384 >+public void test080() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X<Tout extends Object> {\n" + >+ " static public abstract class BaseA {};\n" + >+ " static public abstract class BaseB extends BaseA {};\n" + >+ " static public class Real extends BaseB {};\n" + >+ " static BaseA ask(String prompt) {\n" + >+ " Real impl = new Real();\n" + >+ " return (BaseA) ask(prompt, impl);\n" + >+ " }\n" + >+ " static BaseA ask(String prompt, Real impl) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " static <T extends BaseA> T ask(String prompt, T impl) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " static public void main(String[] args) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "SUCCESS"); >+} > }
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 293384
:
150825
| 151069