Lines 41119-41122
Link Here
|
41119 |
false, |
41119 |
false, |
41120 |
null); |
41120 |
null); |
41121 |
} |
41121 |
} |
|
|
41122 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=215843 |
41123 |
public void test1232() { |
41124 |
this.runConformTest( |
41125 |
new String[] { |
41126 |
"X.java", |
41127 |
"public class X {\n" + |
41128 |
" public static void testCovariant(SubInterface sub1, SubInterface sub2) {\n" + |
41129 |
" SubInterface sub3 = sub1.and(sub2);\n" + |
41130 |
" }\n" + |
41131 |
" public interface SuperInterface<E> {\n" + |
41132 |
" public Number getNumber();\n" + |
41133 |
" public SuperInterface<E> and(SuperInterface<E> a);\n" + |
41134 |
" }\n" + |
41135 |
" public interface SubInterface extends SuperInterface {\n" + |
41136 |
" public Integer getNumber();\n" + |
41137 |
" public SubInterface and(SuperInterface s);\n" + |
41138 |
" }\n" + |
41139 |
"}\n", |
41140 |
}, |
41141 |
""); |
41142 |
|
41143 |
} |
41144 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=215843 - variation |
41145 |
public void test1233() { |
41146 |
this.runConformTest( |
41147 |
new String[] { |
41148 |
"X.java", |
41149 |
"public class X {\n" + |
41150 |
" public static void testCovariant(SubInterface<String> sub1, SubInterface<String> sub2) {\n" + |
41151 |
" SubInterface<String> sub3 = sub1.and(sub2);\n" + |
41152 |
" }\n" + |
41153 |
" public interface SuperInterface<E> {\n" + |
41154 |
" public Number getNumber();\n" + |
41155 |
" public SuperInterface<E> and(SuperInterface<E> a);\n" + |
41156 |
" }\n" + |
41157 |
" public interface SubInterface<F> extends SuperInterface<F> {\n" + |
41158 |
" public Integer getNumber();\n" + |
41159 |
" public SubInterface<F> and(SuperInterface<F> s);\n" + |
41160 |
" }\n" + |
41161 |
"}\n", |
41162 |
}, |
41163 |
""); |
41164 |
} |
41165 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=215843 - variation |
41166 |
public void test1234() { |
41167 |
this.runNegativeTest( |
41168 |
new String[] { |
41169 |
"X.java", |
41170 |
"public class X { \n" + |
41171 |
" void a3(G x) {} \n" + |
41172 |
" <T extends F<X>> void a3(T x) {}\n" + |
41173 |
"\n" + |
41174 |
" public static void ambiguousCases() { \n" + |
41175 |
" H<X> hx = null;\n" + |
41176 |
" H hraw = null;\n" + |
41177 |
" new X().a3(hx);\n" + |
41178 |
" new X().a3(hraw);\n" + |
41179 |
" } \n" + |
41180 |
"}\n" + |
41181 |
"class F<T1> {} \n" + |
41182 |
"class G<T2> extends F<T2> {}\n" + |
41183 |
"class H<T3> extends G<T3> {}\n", |
41184 |
}, |
41185 |
"----------\n" + |
41186 |
"1. WARNING in X.java (at line 2)\n" + |
41187 |
" void a3(G x) {} \n" + |
41188 |
" ^\n" + |
41189 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
41190 |
"----------\n" + |
41191 |
"2. WARNING in X.java (at line 7)\n" + |
41192 |
" H hraw = null;\n" + |
41193 |
" ^\n" + |
41194 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
41195 |
"----------\n" + |
41196 |
"3. ERROR in X.java (at line 8)\n" + |
41197 |
" new X().a3(hx);\n" + |
41198 |
" ^^\n" + |
41199 |
"The method a3(G) is ambiguous for the type X\n" + |
41200 |
"----------\n" + |
41201 |
"4. ERROR in X.java (at line 9)\n" + |
41202 |
" new X().a3(hraw);\n" + |
41203 |
" ^^\n" + |
41204 |
"The method a3(G) is ambiguous for the type X\n" + |
41205 |
"----------\n"); |
41206 |
} |
41207 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=215843 - variation |
41208 |
public void test1235() { |
41209 |
this.runConformTest( |
41210 |
new String[] { |
41211 |
"X.java", |
41212 |
"public class X { \n" + |
41213 |
" <T extends G<X>> void a3(T x) {}\n" + |
41214 |
" <T extends F<X>> void a3(T x) {}\n" + |
41215 |
"\n" + |
41216 |
" public static void ambiguousCases() { \n" + |
41217 |
" H<X> hx = null;\n" + |
41218 |
" H hraw = null;\n" + |
41219 |
" new X().a3(hx);\n" + |
41220 |
" new X().a3(hraw);\n" + |
41221 |
" } \n" + |
41222 |
"}\n" + |
41223 |
"class F<T1> {} \n" + |
41224 |
"class G<T2> extends F<T2> {}\n" + |
41225 |
"class H<T3> extends G<T3> {}\n", |
41226 |
}, |
41227 |
""); |
41228 |
} |
41122 |
} |
41229 |
} |