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 68657 Details for
Bug 188960
[1.5][compiler]Do not detect duplicate constructors in a ParameterizedType
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 3.20 KB, created by
Kent Johnson
on 2007-05-24 15:32:27 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-05-24 15:32:27 EDT
Size:
3.20 KB
patch
obsolete
>Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v >retrieving revision 1.94 >diff -u -r1.94 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 12 Apr 2007 10:32:24 -0000 1.94 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 24 May 2007 19:30:57 -0000 >@@ -399,6 +399,7 @@ > */ > public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) { > int argCount = argumentTypes.length; >+ MethodBinding match = null; > > if ((tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods > long range; >@@ -409,8 +410,9 @@ > TypeBinding[] toMatch = method.parameters; > for (int iarg = 0; iarg < argCount; iarg++) > if (toMatch[iarg] != argumentTypes[iarg]) >- continue nextMethod; >- return method; >+ continue nextMethod;; >+ if (match != null) return null; // collision case >+ match = method; > } > } > } >@@ -422,12 +424,13 @@ > if (toMatch.length == argCount) { > for (int p = 0; p < argCount; p++) > if (toMatch[p] != argumentTypes[p]) >- continue nextMethod; >- return method; >+ continue nextMethod;; >+ if (match != null) return null; // collision case >+ match = method; > } > } > } >- return null; >+ return match; > } > > /** >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.44 >diff -u -r1.44 AmbiguousMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 24 May 2007 14:29:36 -0000 1.44 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 24 May 2007 19:30:57 -0000 >@@ -2039,4 +2039,35 @@ > }, > ""); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=188960 >+public void test059() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "class X<T> {\n" + >+ " X() {}\n" + >+ " X(String s) {}\n" + >+ " X(T t) {}\n" + >+ "}\n" + >+ "class NoErrorSubclass extends X<String> {}\n" + >+ "class StringOnlySubClass extends X<String> {\n" + >+ " StringOnlySubClass(String s) { super(s); }\n" + >+ "}\n" + >+ "class Test {\n" + >+ " Object s = new X<String>(\"xyz\");\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " StringOnlySubClass(String s) { super(s); }\n" + >+ " ^^^^^^^^^\n" + >+ "The constructor X<String>(String) is ambiguous\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 11)\n" + >+ " Object s = new X<String>(\"xyz\");\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "The constructor X<String>(String) is ambiguous\n" + >+ "----------\n" >+ ); >+} > }
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 188960
: 68657