Lines 27-33
Link Here
|
27 |
|
27 |
|
28 |
public class MethodVerifyTest extends AbstractComparableTest { |
28 |
public class MethodVerifyTest extends AbstractComparableTest { |
29 |
static { |
29 |
static { |
30 |
// TESTS_NAMES = new String[] { "test339447" }; |
30 |
// TESTS_NAMES = new String[] { "test345949c" }; |
31 |
// TESTS_NUMBERS = new int[] { 213 }; |
31 |
// TESTS_NUMBERS = new int[] { 213 }; |
32 |
// TESTS_RANGE = new int[] { 190, -1}; |
32 |
// TESTS_RANGE = new int[] { 190, -1}; |
33 |
} |
33 |
} |
Lines 6055-6060
Link Here
|
6055 |
" @Override void instanceCase2(Collection c) {}\n" + |
6055 |
" @Override void instanceCase2(Collection c) {}\n" + |
6056 |
"}" |
6056 |
"}" |
6057 |
}, |
6057 |
}, |
|
|
6058 |
this.complianceLevel < ClassFileConstants.JDK1_7 ? |
6059 |
"----------\n" + |
6060 |
"1. WARNING in Parent.java (at line 3)\n" + |
6061 |
" static void staticCase1(Collection c) {}\n" + |
6062 |
" ^^^^^^^^^^\n" + |
6063 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6064 |
"----------\n" + |
6065 |
"2. WARNING in Parent.java (at line 5)\n" + |
6066 |
" void instanceCase1(Collection c) {}\n" + |
6067 |
" ^^^^^^^^^^\n" + |
6068 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6069 |
"----------\n" + |
6070 |
"3. WARNING in Parent.java (at line 10)\n" + |
6071 |
" static void staticCase2(Collection c) {}\n" + |
6072 |
" ^^^^^^^^^^\n" + |
6073 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6074 |
"----------\n" + |
6075 |
"4. ERROR in Parent.java (at line 11)\n" + |
6076 |
" void instanceCase1(Collection<String> c) {}\n" + |
6077 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6078 |
"Name clash: The method instanceCase1(Collection<String>) of type Child has the same erasure as instanceCase1(Collection) of type Parent but does not override it\n" + |
6079 |
"----------\n" + |
6080 |
"5. WARNING in Parent.java (at line 12)\n" + |
6081 |
" @Override void instanceCase2(Collection c) {}\n" + |
6082 |
" ^^^^^^^^^^\n" + |
6083 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6084 |
"----------\n": |
6058 |
"----------\n" + |
6085 |
"----------\n" + |
6059 |
"1. WARNING in Parent.java (at line 3)\n" + |
6086 |
"1. WARNING in Parent.java (at line 3)\n" + |
6060 |
" static void staticCase1(Collection c) {}\n" + |
6087 |
" static void staticCase1(Collection c) {}\n" + |
Lines 6066-6086
Link Here
|
6066 |
" ^^^^^^^^^^\n" + |
6093 |
" ^^^^^^^^^^\n" + |
6067 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6094 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6068 |
"----------\n" + |
6095 |
"----------\n" + |
6069 |
"3. WARNING in Parent.java (at line 10)\n" + |
6096 |
"3. ERROR in Parent.java (at line 9)\n" + |
|
|
6097 |
" static void staticCase1(Collection<String> c) {}\n" + |
6098 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6099 |
"Name clash: The method staticCase1(Collection<String>) of type Child has the same erasure as staticCase1(Collection) of type Parent but does not hide it\n" + |
6100 |
"----------\n" + |
6101 |
"4. WARNING in Parent.java (at line 10)\n" + |
6070 |
" static void staticCase2(Collection c) {}\n" + |
6102 |
" static void staticCase2(Collection c) {}\n" + |
6071 |
" ^^^^^^^^^^\n" + |
6103 |
" ^^^^^^^^^^\n" + |
6072 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6104 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6073 |
"----------\n" + |
6105 |
"----------\n" + |
6074 |
"4. ERROR in Parent.java (at line 11)\n" + |
6106 |
"5. ERROR in Parent.java (at line 11)\n" + |
6075 |
" void instanceCase1(Collection<String> c) {}\n" + |
6107 |
" void instanceCase1(Collection<String> c) {}\n" + |
6076 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6108 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6077 |
"Name clash: The method instanceCase1(Collection<String>) of type Child has the same erasure as instanceCase1(Collection) of type Parent but does not override it\n" + |
6109 |
"Name clash: The method instanceCase1(Collection<String>) of type Child has the same erasure as instanceCase1(Collection) of type Parent but does not override it\n" + |
6078 |
"----------\n" + |
6110 |
"----------\n" + |
6079 |
"5. WARNING in Parent.java (at line 12)\n" + |
6111 |
"6. WARNING in Parent.java (at line 12)\n" + |
6080 |
" @Override void instanceCase2(Collection c) {}\n" + |
6112 |
" @Override void instanceCase2(Collection c) {}\n" + |
6081 |
" ^^^^^^^^^^\n" + |
6113 |
" ^^^^^^^^^^\n" + |
6082 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6114 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6083 |
"----------\n" |
6115 |
"----------\n" |
|
|
6116 |
|
6084 |
// @Override is an error for instanceCase1 |
6117 |
// @Override is an error for instanceCase1 |
6085 |
// name clash: instanceCase1(Collection<String>) in Child and instanceCase1(Collection) in Parent have the same erasure, yet neither overrides the other |
6118 |
// name clash: instanceCase1(Collection<String>) in Child and instanceCase1(Collection) in Parent have the same erasure, yet neither overrides the other |
6086 |
); |
6119 |
); |
Lines 8828-8867
Link Here
|
8828 |
"class X {}\n" + |
8861 |
"class X {}\n" + |
8829 |
"class Y<T> {}" |
8862 |
"class Y<T> {}" |
8830 |
}, |
8863 |
}, |
8831 |
"----------\n" + |
8864 |
this.complianceLevel < ClassFileConstants.JDK1_7 ? |
8832 |
"1. ERROR in B.java (at line 2)\n" + |
8865 |
"----------\n" + |
8833 |
" static void a(X x) {}\n" + |
8866 |
"1. ERROR in B.java (at line 2)\n" + |
8834 |
" ^^^^^^\n" + |
8867 |
" static void a(X x) {}\n" + |
8835 |
"This static method cannot hide the instance method from A\n" + |
8868 |
" ^^^^^^\n" + |
8836 |
"----------\n" + |
8869 |
"This static method cannot hide the instance method from A\n" + |
8837 |
"2. ERROR in B.java (at line 3)\n" + |
8870 |
"----------\n" + |
8838 |
" static void b(Y<String> y) {}\n" + |
8871 |
"----------\n" + |
8839 |
" ^^^^^^^^^^^^^^\n" + |
8872 |
"1. ERROR in B2.java (at line 2)\n" + |
8840 |
"Name clash: The method b(Y<String>) of type B has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
8873 |
" static void b(Y<Integer> y) {}\n" + |
8841 |
"----------\n" + |
8874 |
" ^^^^^^^^^^^^^^^\n" + |
8842 |
"----------\n" + |
8875 |
"This static method cannot hide the instance method from A\n" + |
8843 |
"1. ERROR in B2.java (at line 2)\n" + |
8876 |
"----------\n" + |
8844 |
" static void b(Y<Integer> y) {}\n" + |
8877 |
"----------\n" + |
8845 |
" ^^^^^^^^^^^^^^^\n" + |
8878 |
"1. ERROR in C.java (at line 3)\n" + |
8846 |
"This static method cannot hide the instance method from A\n" + |
8879 |
" void b(Y<String> y) {}\n" + |
8847 |
"----------\n" + |
8880 |
" ^^^^^^^^^^^^^^\n" + |
8848 |
"----------\n" + |
8881 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
8849 |
"1. ERROR in C.java (at line 3)\n" + |
8882 |
"----------\n" + |
8850 |
" void b(Y<String> y) {}\n" + |
8883 |
"2. ERROR in C.java (at line 4)\n" + |
8851 |
" ^^^^^^^^^^^^^^\n" + |
8884 |
" void c(X x) {}\n" + |
8852 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
8885 |
" ^^^^^^\n" + |
8853 |
"----------\n" + |
8886 |
"This instance method cannot override the static method from A\n" + |
8854 |
"2. ERROR in C.java (at line 4)\n" + |
8887 |
"----------\n" + |
8855 |
" void c(X x) {}\n" + |
8888 |
"----------\n" + |
8856 |
" ^^^^^^\n" + |
8889 |
"1. ERROR in C2.java (at line 3)\n" + |
8857 |
"This instance method cannot override the static method from A\n" + |
8890 |
" void d(Y<Integer> y) {}\n" + |
8858 |
"----------\n" + |
8891 |
" ^^^^^^^^^^^^^^^\n" + |
8859 |
"----------\n" + |
8892 |
"This instance method cannot override the static method from A\n" + |
8860 |
"1. ERROR in C2.java (at line 3)\n" + |
|
|
8861 |
" void d(Y<Integer> y) {}\n" + |
8862 |
" ^^^^^^^^^^^^^^^\n" + |
8863 |
"This instance method cannot override the static method from A\n" + |
8864 |
"----------\n" |
8893 |
"----------\n" |
|
|
8894 |
:"----------\n" + |
8895 |
"1. ERROR in B.java (at line 2)\n" + |
8896 |
" static void a(X x) {}\n" + |
8897 |
" ^^^^^^\n" + |
8898 |
"This static method cannot hide the instance method from A\n" + |
8899 |
"----------\n" + |
8900 |
"2. ERROR in B.java (at line 3)\n" + |
8901 |
" static void b(Y<String> y) {}\n" + |
8902 |
" ^^^^^^^^^^^^^^\n" + |
8903 |
"Name clash: The method b(Y<String>) of type B has the same erasure as b(Y<Integer>) of type A but does not hide it\n" + |
8904 |
"----------\n" + |
8905 |
"3. ERROR in B.java (at line 5)\n" + |
8906 |
" static void d(Y<String> y) {}\n" + |
8907 |
" ^^^^^^^^^^^^^^\n" + |
8908 |
"Name clash: The method d(Y<String>) of type B has the same erasure as d(Y<Integer>) of type A but does not hide it\n" + |
8909 |
"----------\n" + |
8910 |
"----------\n" + |
8911 |
"1. ERROR in B2.java (at line 2)\n" + |
8912 |
" static void b(Y<Integer> y) {}\n" + |
8913 |
" ^^^^^^^^^^^^^^^\n" + |
8914 |
"This static method cannot hide the instance method from A\n" + |
8915 |
"----------\n" + |
8916 |
"----------\n" + |
8917 |
"1. ERROR in C.java (at line 3)\n" + |
8918 |
" void b(Y<String> y) {}\n" + |
8919 |
" ^^^^^^^^^^^^^^\n" + |
8920 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
8921 |
"----------\n" + |
8922 |
"2. ERROR in C.java (at line 4)\n" + |
8923 |
" void c(X x) {}\n" + |
8924 |
" ^^^^^^\n" + |
8925 |
"This instance method cannot override the static method from A\n" + |
8926 |
"----------\n" + |
8927 |
"3. ERROR in C.java (at line 5)\n" + |
8928 |
" void d(Y<String> y) {}\n" + |
8929 |
" ^^^^^^^^^^^^^^\n" + |
8930 |
"Name clash: The method d(Y<String>) of type C has the same erasure as d(Y<Integer>) of type A but does not hide it\n" + |
8931 |
"----------\n" + |
8932 |
"----------\n" + |
8933 |
"1. ERROR in C2.java (at line 3)\n" + |
8934 |
" void d(Y<Integer> y) {}\n" + |
8935 |
" ^^^^^^^^^^^^^^^\n" + |
8936 |
"This instance method cannot override the static method from A\n" + |
8937 |
"----------\n" |
8938 |
|
8865 |
); |
8939 |
); |
8866 |
} |
8940 |
} |
8867 |
public void test150() { |
8941 |
public void test150() { |
Lines 12328-12331
Link Here
|
12328 |
"The method f(String) is ambiguous for the type B<String>\n" + |
12402 |
"The method f(String) is ambiguous for the type B<String>\n" + |
12329 |
"----------\n"); |
12403 |
"----------\n"); |
12330 |
} |
12404 |
} |
|
|
12405 |
public void test345949a() throws Exception { |
12406 |
if (new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_7) return; |
12407 |
this.runNegativeTest( |
12408 |
new String[] { |
12409 |
"Sub.java", |
12410 |
"class A<T> {}\n" + |
12411 |
"class Super {\n" + |
12412 |
" public static void foo(A<Number> p) {}\n" + |
12413 |
"}\n" + |
12414 |
"public class Sub extends Super {\n" + |
12415 |
" public static void foo(A<Integer> p) {}\n" + |
12416 |
"}\n" |
12417 |
}, |
12418 |
"----------\n" + |
12419 |
"1. ERROR in Sub.java (at line 6)\n" + |
12420 |
" public static void foo(A<Integer> p) {}\n" + |
12421 |
" ^^^^^^^^^^^^^^^^^\n" + |
12422 |
"Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + |
12423 |
"----------\n"); |
12424 |
} |
12425 |
public void _test345949b() throws Exception { |
12426 |
this.runNegativeTest( |
12427 |
new String[] { |
12428 |
"Sub.java", |
12429 |
"class Super {\n" + |
12430 |
" public static void foo() {}\n" + |
12431 |
"}\n" + |
12432 |
"public class Sub extends Super {\n" + |
12433 |
" public static <T> void foo() {}\n" + |
12434 |
"}\n" |
12435 |
}, |
12436 |
""); |
12437 |
} |
12331 |
} |
12438 |
} |