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 88422 Details for
Bug 216686
[1.5][compiler] Failures of inference and overload resolution
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
216686.txt (text/plain), 32.15 KB, created by
Philipe Mulet
on 2008-01-31 10:04:16 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-01-31 10:04:16 EST
Size:
32.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.686 >diff -u -r1.686 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 29 Jan 2008 10:15:16 -0000 1.686 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 31 Jan 2008 15:00:52 -0000 >@@ -42124,4 +42124,505 @@ > }, > ""); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 >+public void test1269() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1270() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#2#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1271() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 24)\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " ^^^\n" + >+ "The method put(Class<E>, X.TO<? super E>) in the type X is not applicable for the arguments (Class<Integer>, X.OO<String,Object>)\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1272() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.print(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " try {\n" + >+ " put(Integer.class, (TO<Object>)combine(FUNC2, FUNC1));\n" + >+ " } catch(ClassCastException e) {\n" + >+ " System.out.println(\"#CLASSCAST#\");\n" + >+ " }\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#3##CLASSCAST#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1273() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1274() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, X.<Object>combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1275() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1276() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, X.<Object>combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1277() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#2#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1278() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1279() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " // some functor and functor instances definitions\n" + >+ " static interface OO<T, E> { \n" + >+ " public T eval(E x);\n" + >+ " }\n" + >+ " static interface TO<T> extends OO<String, T> {\n" + >+ " public String eval(T x);\n" + >+ " }\n" + >+ " static interface TT extends TO<String> {\n" + >+ " public String eval(String x);\n" + >+ " }\n" + >+ " static final TO<Object> FUNC1 = null;\n" + >+ " static final TT FUNC2 = null;\n" + >+ "\n" + >+ " // some functor combinators\n" + >+ " static <E> TO<E> combine(final TT x, final TO<? super E> y) { // # 1\n" + >+ " System.out.println(\"#1#\");\n" + >+ " return new TO<E>() { public String eval(E o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { // # 2\n" + >+ " System.out.println(\"#2#\");\n" + >+ " return new TO<T>() { public String eval(T o) { return x.eval(y.eval(o)); } }; \n" + >+ " }\n" + >+ " static <E, T, V> OO<E, V> combine(final OO<E, ? super T> x, final OO<T, V> y) { // # 3\n" + >+ " System.out.println(\"#3#\");\n" + >+ " return new OO<E, V>() { public E eval(V o) { return x.eval(y.eval(o)); } };\n" + >+ " }\n" + >+ " // body of the test\n" + >+ " static <E> void put(Class<E> type, TO<? super E> func) {\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " put(Integer.class, X.<Object>combine(FUNC2, FUNC1));\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "#1#"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1280() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "interface OO<T,E> {}\n" + >+ "interface TO<T> extends OO<String,T> {}\n" + >+ "interface TT extends TO<String> {}\n" + >+ "\n" + >+ "public class X {\n" + >+ " <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T> y) { return null; }\n" + >+ " void foo(TT tt, TO<? super Object> too) {\n" + >+ " combine(tt, too);\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ ""); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1281() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "interface OO<T,E> {}\n" + >+ "interface TO<T> extends OO<String,T> {}\n" + >+ "interface TT extends TO<String> {}\n" + >+ "\n" + >+ "public class X {\n" + >+ " <E, T> TO<T> combine(final TO<? super E> x, final OO<E, T>[] y) { return null; }\n" + >+ " void foo(TT tt, TO<? super Object>[] too) {\n" + >+ " combine(tt, too);\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ ""); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1282() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static interface OO<T,E> {}\n" + >+ " static interface TO<T> extends OO<String,T> {}\n" + >+ " static interface TT extends TO<String> {}\n" + >+ " \n" + >+ " <E, T> TO<T> combine(TT x, TO<? super E> y) { return null; }\n" + >+ " void foo(TO<? super String> too, OO<String,Object> oo) {\n" + >+ " combine(too, oo);\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\r\n" + >+ " combine(too, oo);\r\n" + >+ " ^^^^^^^\n" + >+ "The method combine(X.TT, X.TO<? super E>) in the type X is not applicable for the arguments (X.TO<capture#1-of ? super String>, X.OO<String,Object>)\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216686 - variation >+public void test1283() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static interface OO<T,E> {}\n" + >+ " static interface TO<T> extends OO<String,T> {}\n" + >+ " static interface TT extends TO<String> {}\n" + >+ " \n" + >+ " <E, T> TO<T> combine(TT[] x, TO<? super E>[] y) { return null; }\n" + >+ " void foo(TO<? super String>[] too, OO<String,Object>[] oo) {\n" + >+ " combine(too, oo);\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\r\n" + >+ " combine(too, oo);\r\n" + >+ " ^^^^^^^\n" + >+ "The method combine(X.TT[], X.TO<? super E>[]) in the type X is not applicable for the arguments (X.TO<? super String>[], X.OO<String,Object>[])\n" + >+ "----------\n"); >+} > } >#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.61 >diff -u -r1.61 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 7 Jan 2008 14:16:20 -0000 1.61 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 31 Jan 2008 15:00:55 -0000 >@@ -470,7 +470,7 @@ > TypeBinding[] newArguments = new TypeBinding[length]; > for (int i = 0; i < length; i++) { > TypeVariableBinding originalVariable = originalVariables[i]; >- if (originalVariable.boundsCount() == 1) { >+ if (originalVariable.boundsCount() <= 1) { > newArguments[i] = this.environment.convertToRawType(originalVariable.upperBound(), false /*do not force conversion of enclosing types*/); > } else { > newArguments[i] = this.environment.convertToRawType( >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java,v >retrieving revision 1.92 >diff -u -r1.92 TypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 12 Oct 2007 09:37:00 -0000 1.92 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java 31 Jan 2008 15:00:55 -0000 >@@ -804,138 +804,149 @@ > if (this == otherType) > return true; > switch (otherType.kind()) { >- // allow wildcard containment >- case Binding.WILDCARD_TYPE: >- case Binding.INTERSECTION_TYPE: >- >- TypeBinding lowerBound = this; >- TypeBinding upperBound = this; >- switch (this.kind()) { >- case Binding.WILDCARD_TYPE: >- case Binding.INTERSECTION_TYPE: >- WildcardBinding wildcard = (WildcardBinding) this; >- switch (wildcard.boundKind) { >- case Wildcard.EXTENDS: >- if (wildcard.otherBounds != null) // intersection type >- break; >- upperBound = wildcard.bound; >- lowerBound = null; >+ // allow wildcard containment >+ case Binding.WILDCARD_TYPE: >+ case Binding.INTERSECTION_TYPE: >+ >+ TypeBinding lowerBound = this; >+ TypeBinding upperBound = this; >+ switch (this.kind()) { >+ case Binding.WILDCARD_TYPE: >+ case Binding.INTERSECTION_TYPE: >+ WildcardBinding wildcard = (WildcardBinding) this; >+ switch (wildcard.boundKind) { >+ case Wildcard.EXTENDS: >+ if (wildcard.otherBounds != null) // intersection type >+ break; >+ upperBound = wildcard.bound; >+ lowerBound = null; >+ break; >+ case Wildcard.SUPER: >+ upperBound = wildcard; >+ lowerBound = wildcard.bound; >+ break; >+ case Wildcard.UNBOUND: >+ upperBound = wildcard; >+ lowerBound = null; >+ } > break; >+ case Binding.TYPE_PARAMETER: >+ if (this.isCapture()) { >+ CaptureBinding capture = (CaptureBinding) this; >+ if (capture.lowerBound != null) >+ lowerBound = capture.lowerBound; >+ } >+ } >+ WildcardBinding otherWildcard = (WildcardBinding) otherType; >+ if (otherWildcard.otherBounds != null) >+ return false; // not a true wildcard (intersection type) >+ TypeBinding otherBound = otherWildcard.bound; >+ switch (otherWildcard.boundKind) { >+ case Wildcard.EXTENDS: >+ if (otherBound == this) >+ return true; // ? extends T <= ? extends ? extends T >+ if (upperBound == null) >+ return false; >+ TypeBinding match = upperBound.findSuperTypeOriginatingFrom(otherBound); >+ if (match != null && (match = match.leafComponentType()).isRawType()) { >+ return match == otherBound.leafComponentType(); // forbide: Collection <= ? extends Collection<?> >+ // forbide: Collection[] <= ? extends Collection<?>[] >+ } >+ return upperBound.isCompatibleWith(otherBound); >+ > case Wildcard.SUPER: >- upperBound = wildcard; >- lowerBound = wildcard.bound; >- break; >+ if (otherBound == this) >+ return true; // ? super T <= ? super ? super T >+ if (lowerBound == null) >+ return false; >+ match = otherBound.findSuperTypeOriginatingFrom(lowerBound); >+ if (match != null && (match = match.leafComponentType()).isRawType()) { >+ return match == lowerBound.leafComponentType(); // forbide: Collection <= ? super Collection<?> >+ // forbide: Collection[] <= ? super Collection<?>[] >+ } >+ return otherBound.isCompatibleWith(lowerBound); >+ > case Wildcard.UNBOUND: >- upperBound = wildcard; >- lowerBound = null; >- } >- break; >- case Binding.TYPE_PARAMETER: >- if (this.isCapture()) { >- CaptureBinding capture = (CaptureBinding) this; >- if (capture.lowerBound != null) >- lowerBound = capture.lowerBound; >- } >- } >- WildcardBinding otherWildcard = (WildcardBinding) otherType; >- if (otherWildcard.otherBounds != null) >- return false; // not a true wildcard (intersection type) >- TypeBinding otherBound = otherWildcard.bound; >- switch (otherWildcard.boundKind) { >- case Wildcard.EXTENDS: >- if (otherBound == this) >- return true; // ? extends T <= ? extends ? extends T >- if (upperBound == null) >- return false; >- TypeBinding match = upperBound.findSuperTypeOriginatingFrom(otherBound); >- if (match != null && (match = match.leafComponentType()).isRawType()) { >- return match == otherBound.leafComponentType(); // forbide: Collection <= ? extends Collection<?> >- // forbide: Collection[] <= ? extends Collection<?>[] >+ default: >+ return true; > } >- return upperBound.isCompatibleWith(otherBound); >- >- case Wildcard.SUPER: >- if (otherBound == this) >- return true; // ? super T <= ? super ? super T >- if (lowerBound == null) >+ // allow List<?> to match List<? extends Object> (and reciprocally) >+ case Binding.PARAMETERIZED_TYPE: >+ if (!this.isParameterizedType()) > return false; >- match = otherBound.findSuperTypeOriginatingFrom(lowerBound); >- if (match != null && (match = match.leafComponentType()).isRawType()) { >- return match == lowerBound.leafComponentType(); // forbide: Collection <= ? super Collection<?> >- // forbide: Collection[] <= ? super Collection<?>[] >- } >- return otherBound.isCompatibleWith(lowerBound); >- >- case Wildcard.UNBOUND: >- default: >- return true; >- } >- // allow List<?> to match List<? extends Object> (and reciprocally) >- case Binding.PARAMETERIZED_TYPE: >- if (!this.isParameterizedType()) >- return false; >- ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; >- ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType; >- if (paramType.actualType() != otherParamType.actualType()) >- return false; >- if (!paramType.isStatic()) { // static member types do not compare their enclosing >- ReferenceBinding enclosing = enclosingType(); >- if (enclosing != null) { >- ReferenceBinding otherEnclosing = otherParamType .enclosingType(); >- if (otherEnclosing == null) >- return false; >- if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) { >- if (enclosing != otherEnclosing) >- return false; >- } else { >- if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) >+ ParameterizedTypeBinding paramType = (ParameterizedTypeBinding) this; >+ ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType; >+ if (paramType.actualType() != otherParamType.actualType()) >+ return false; >+ if (!paramType.isStatic()) { // static member types do not compare their enclosing >+ ReferenceBinding enclosing = enclosingType(); >+ if (enclosing != null) { >+ ReferenceBinding otherEnclosing = otherParamType .enclosingType(); >+ if (otherEnclosing == null) > return false; >+ if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) { >+ if (enclosing != otherEnclosing) >+ return false; >+ } else { >+ if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) >+ return false; >+ } > } > } >- } >- int length = paramType.arguments == null ? 0 : paramType.arguments.length; >- TypeBinding[] otherArguments = otherParamType.arguments; >- int otherLength = otherArguments == null ? 0 : otherArguments.length; >- if (otherLength != length) >- return false; >- nextArgument: for (int i = 0; i < length; i++) { >- TypeBinding argument = paramType.arguments[i]; >- TypeBinding otherArgument = otherArguments[i]; >- if (argument == otherArgument) >- continue nextArgument; >- int kind = argument.kind(); >- if (otherArgument.kind() != kind) >+ int length = paramType.arguments == null ? 0 : paramType.arguments.length; >+ TypeBinding[] otherArguments = otherParamType.arguments; >+ int otherLength = otherArguments == null ? 0 : otherArguments.length; >+ if (otherLength != length) > return false; >- switch (kind) { >- case Binding.PARAMETERIZED_TYPE: >- if (argument.isTypeArgumentContainedBy(otherArgument)) // recurse >+ nextArgument: for (int i = 0; i < length; i++) { >+ TypeBinding argument = paramType.arguments[i]; >+ TypeBinding otherArgument = otherArguments[i]; >+ if (argument == otherArgument) > continue nextArgument; >- break; >+ int kind = argument.kind(); >+ if (otherArgument.kind() != kind) >+ return false; >+ switch (kind) { >+ case Binding.PARAMETERIZED_TYPE: >+ if (argument.isTypeArgumentContainedBy(otherArgument)) // recurse >+ continue nextArgument; >+ break; >+ case Binding.WILDCARD_TYPE: >+ case Binding.INTERSECTION_TYPE: >+ WildcardBinding wildcard = (WildcardBinding) argument; >+ otherWildcard = (WildcardBinding) otherArgument; >+ switch (wildcard.boundKind) { >+ case Wildcard.EXTENDS: >+ // match "? extends <upperBound>" with "?" >+ if (otherWildcard.boundKind == Wildcard.UNBOUND >+ && wildcard.bound == wildcard.typeVariable().upperBound()) >+ continue nextArgument; >+ break; >+ case Wildcard.SUPER: >+ break; >+ case Wildcard.UNBOUND: >+ // match "?" with "? extends <upperBound>" >+ if (otherWildcard.boundKind == Wildcard.EXTENDS >+ && otherWildcard.bound == otherWildcard.typeVariable().upperBound()) >+ continue nextArgument; >+ break; >+ } >+ break; >+ } >+ return false; >+ } >+ return true; >+ } >+ // (? super Object) <= Object >+ if (otherType.id == TypeIds.T_JavaLangObject) { >+ switch (this.kind()) { > case Binding.WILDCARD_TYPE: >- case Binding.INTERSECTION_TYPE: >- WildcardBinding wildcard = (WildcardBinding) argument; >- otherWildcard = (WildcardBinding) otherArgument; >- switch (wildcard.boundKind) { >- case Wildcard.EXTENDS: >- // match "? extends <upperBound>" with "?" >- if (otherWildcard.boundKind == Wildcard.UNBOUND >- && wildcard.bound == wildcard.typeVariable().upperBound()) >- continue nextArgument; >- break; >- case Wildcard.SUPER: >- break; >- case Wildcard.UNBOUND: >- // match "?" with "? extends <upperBound>" >- if (otherWildcard.boundKind == Wildcard.EXTENDS >- && otherWildcard.bound == otherWildcard.typeVariable().upperBound()) >- continue nextArgument; >- break; >+ WildcardBinding wildcard = (WildcardBinding) this; >+ if (wildcard.boundKind == Wildcard.SUPER && wildcard.bound.id == TypeIds.T_JavaLangObject) { >+ return true; > } > break; >- } >- return false; > } >- return true; > } > return false; > }
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 216686
:
87961
| 88422