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 52197 Details for
Bug 159711
[1.5][compiler] wrongly reports ambiguous method error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix + test case
org.eclipse.jdt.core_01.txt (text/plain), 4.37 KB, created by
Maxime Daniel
on 2006-10-18 04:37:00 EDT
(
hide
)
Description:
Fix + test case
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2006-10-18 04:37:00 EDT
Size:
4.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java,v >retrieving revision 1.50 >diff -u -r1.50 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 10 Jul 2006 17:22:13 -0000 1.50 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 18 Oct 2006 08:38:22 -0000 >@@ -450,23 +450,23 @@ > } > return originalVariable; > } >- /** >- * Returns the method to use during tiebreak (usually the method itself). >- * For generic method invocations, tiebreak needs to use generic method with erasure substitutes. >- */ > public MethodBinding tiebreakMethod() { > if (this.tiebreakMethod == null) { >-// if (this.isRaw) { >-// this.tiebreakMethod = this; >-// } else { >-// this.tiebreakMethod = new ParameterizedGenericMethodBinding(this.originalMethod, (RawTypeBinding)null, this.environment); >+ if (this.isStatic()) { >+ TypeVariableBinding[] originalVariables = originalMethod.typeVariables; >+ int length = originalVariables.length; >+ TypeBinding[] newArguments = new TypeBinding[length]; >+ for (int i = 0; i < length; i++) >+ newArguments[i] = originalVariables[i].upperBound(); // do not rawify >+ this.tiebreakMethod = this.environment.createParameterizedGenericMethod(this.originalMethod, newArguments); >+ } else { > TypeVariableBinding[] originalVariables = originalMethod.typeVariables; > int length = originalVariables.length; > TypeBinding[] rawArguments = new TypeBinding[length]; > for (int i = 0; i < length; i++) > rawArguments[i] = environment.convertToRawType(originalVariables[i].upperBound()); > this.tiebreakMethod = this.environment.createParameterizedGenericMethod(this.originalMethod, rawArguments); >-// } >+ } > } > return this.tiebreakMethod; > } >#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.13 >diff -u -r1.13 AmbiguousMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 16 Oct 2006 09:06:53 -0000 1.13 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 18 Oct 2006 08:38:24 -0000 >@@ -1025,28 +1025,42 @@ > "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=159711 >-public void _test023() { >+public void test023() { > this.runConformTest( > new String[] { > "X.java", > "import java.util.*;\n" + > "public class X {\n" + > " public static void foo(Collection<?> p) {\n" + >+ " System.out.println(1);\n" + > " }\n" + > " public static <T extends List<?>> void foo(T p) {\n" + >+ " System.out.println(2);\n" + > " }\n" + > " public static void main(String[] args) {\n" + > " foo(new ArrayList<String>(Arrays.asList(\"\")));\n" + > " }\n" + > "}" > }, >- ""); >+ "2"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=159711 > // self contained variant >-public void _test024() { >+public void test024() { > this.runConformTest( > new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void foo(L1<?> p) {\n" + >+ " System.out.println(1);\n" + >+ " }\n" + >+ " public static <T extends L2<?>> void foo(T p) {\n" + >+ " System.out.println(2);\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " foo(new L3<String>());\n" + >+ " }\n" + >+ "}", > "L1.java", > "public interface L1<T> {\n" + > "}", >@@ -1058,17 +1072,7 @@ > " public L3() {\n" + > " }\n" + > "}", >- "X.java", >- "public class X {\n" + >- " public static void foo(L1<?> p) {\n" + >- " }\n" + >- " public static <T extends L2<?>> void foo(T p) {\n" + >- " }\n" + >- " public static void main(String[] args) {\n" + >- " foo(new L3<String>());\n" + >- " }\n" + >- "}" > }, >- ""); >+ "2"); > } > }
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 159711
: 52197