Lines 5828-5834
Link Here
|
5828 |
"1. ERROR in X.java (at line 3)\n" + |
5828 |
"1. ERROR in X.java (at line 3)\n" + |
5829 |
" private int valueOf(String arg0) { return 0; }//11\n" + |
5829 |
" private int valueOf(String arg0) { return 0; }//11\n" + |
5830 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
5830 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
5831 |
"The enum X already defines the method valueOf(String) implicitly\n" + |
5831 |
"The enum X already defines the method valueOf(String) implicitly\n" + |
|
|
5832 |
"----------\n" + |
5833 |
"2. ERROR in X.java (at line 5)\n" + |
5834 |
" int i = valueOf(\"\");\n" + |
5835 |
" ^^^^^^^^^^^\n" + |
5836 |
"Type mismatch: cannot convert from X to int\n" + |
5832 |
"----------\n", |
5837 |
"----------\n", |
5833 |
null, |
5838 |
null, |
5834 |
true, // flush output |
5839 |
true, // flush output |
Lines 5838-5856
Link Here
|
5838 |
false); |
5843 |
false); |
5839 |
// check for presence of #valueOf(...) in problem type |
5844 |
// check for presence of #valueOf(...) in problem type |
5840 |
String expectedOutput = |
5845 |
String expectedOutput = |
5841 |
" // Method descriptor #20 (Ljava/lang/String;)I\n" + |
5846 |
"public final enum X {\n" + |
5842 |
" // Stack: 3, Locals: 2\n" + |
5847 |
" \n" + |
5843 |
" private int valueOf(java.lang.String arg0);\n" + |
5848 |
" // Method descriptor #6 (Ljava/lang/String;I)V\n" + |
|
|
5849 |
" // Stack: 3, Locals: 3\n" + |
5850 |
" private X(java.lang.String arg0, int arg1);\n" + |
5844 |
" 0 new java.lang.Error [8]\n" + |
5851 |
" 0 new java.lang.Error [8]\n" + |
5845 |
" 3 dup\n" + |
5852 |
" 3 dup\n" + |
5846 |
" 4 ldc <String \"Unresolved compilation problem: \\n\\tThe enum X already defines the method valueOf(String) implicitly\\n\"> [10]\n" + |
5853 |
" 4 ldc <String \"Unresolved compilation problems: \\n\\tThe enum X already defines the method valueOf(String) implicitly\\n\\tType mismatch: cannot convert from X to int\\n\"> [10]\n" + |
5847 |
" 6 invokespecial java.lang.Error(java.lang.String) [12]\n" + |
5854 |
" 6 invokespecial java.lang.Error(java.lang.String) [12]\n" + |
5848 |
" 9 athrow\n" + |
5855 |
" 9 athrow\n" + |
5849 |
" Line numbers:\n" + |
5856 |
" Line numbers:\n" + |
5850 |
" [pc: 0, line: 3]\n" + |
5857 |
" [pc: 0, line: 3]\n" + |
5851 |
" Local variable table:\n" + |
5858 |
" Local variable table:\n" + |
5852 |
" [pc: 0, pc: 10] local: this index: 0 type: X\n" + |
5859 |
" [pc: 0, pc: 10] local: this index: 0 type: X\n" + |
5853 |
" [pc: 0, pc: 10] local: arg0 index: 1 type: java.lang.String\n"; |
5860 |
" \n" + |
|
|
5861 |
" // Method descriptor #20 ()V\n" + |
5862 |
" // Stack: 3, Locals: 1\n" + |
5863 |
" void foo();\n" + |
5864 |
" 0 new java.lang.Error [8]\n" + |
5865 |
" 3 dup\n" + |
5866 |
" 4 ldc <String \"Unresolved compilation problem: \\n\\tType mismatch: cannot convert from X to int\\n\"> [21]\n" + |
5867 |
" 6 invokespecial java.lang.Error(java.lang.String) [12]\n" + |
5868 |
" 9 athrow\n" + |
5869 |
" Line numbers:\n" + |
5870 |
" [pc: 0, line: 5]\n" + |
5871 |
" Local variable table:\n" + |
5872 |
" [pc: 0, pc: 10] local: this index: 0 type: X\n" + |
5873 |
"}"; |
5854 |
|
5874 |
|
5855 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); |
5875 |
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); |
5856 |
} |
5876 |
} |
Lines 5858-5871
Link Here
|
5858 |
public void test167() throws Exception { |
5878 |
public void test167() throws Exception { |
5859 |
this.runNegativeTest( |
5879 |
this.runNegativeTest( |
5860 |
new String[] { |
5880 |
new String[] { |
5861 |
"X.java", // ================= |
5881 |
"X.java", // ================= |
5862 |
"public enum X {\n" + |
5882 |
"public enum X {\n" + |
5863 |
" ;\n" + |
5883 |
" ;\n" + |
5864 |
" static int valueOf(String arg0) { return 0; }//9\n" + |
5884 |
" static int valueOf(String arg0) { return 0; }//9\n" + |
5865 |
" void foo() {\n" + |
5885 |
" void foo() {\n" + |
5866 |
" int i = X.valueOf(\"\");\n" + |
5886 |
" int i = X.valueOf(\"\");\n" + |
5867 |
" }\n" + |
5887 |
" }\n" + |
5868 |
"}\n", |
5888 |
"}\n", |
|
|
5889 |
"Other.java",// ================= |
5890 |
"public class Other {\n" + |
5891 |
" void foo() {\n" + |
5892 |
" int i = X.valueOf(\"\");\n" + |
5893 |
" }\n" + |
5894 |
"}\n", // ================= |
5895 |
}, |
5896 |
"----------\n" + |
5897 |
"1. ERROR in X.java (at line 3)\n" + |
5898 |
" static int valueOf(String arg0) { return 0; }//9\n" + |
5899 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
5900 |
"The enum X already defines the method valueOf(String) implicitly\n" + |
5901 |
"----------\n" + |
5902 |
"2. ERROR in X.java (at line 5)\n" + |
5903 |
" int i = X.valueOf(\"\");\n" + |
5904 |
" ^^^^^^^^^^^^^\n" + |
5905 |
"Type mismatch: cannot convert from X to int\n" + |
5906 |
"----------\n" + |
5907 |
"----------\n" + |
5908 |
"1. ERROR in Other.java (at line 3)\n" + |
5909 |
" int i = X.valueOf(\"\");\n" + |
5910 |
" ^^^^^^^^^^^^^\n" + |
5911 |
"Type mismatch: cannot convert from X to int\n" + |
5912 |
"----------\n", |
5913 |
null, |
5914 |
true, // flush output |
5915 |
null, |
5916 |
true, // generate output |
5917 |
false, |
5918 |
false); |
5919 |
// check consistency of problem when incremental compiling against X problemType |
5920 |
this.runNegativeTest( |
5921 |
new String[] { |
5869 |
"Other.java",// ================= |
5922 |
"Other.java",// ================= |
5870 |
"public class Other {\n" + |
5923 |
"public class Other {\n" + |
5871 |
" void foo() {\n" + |
5924 |
" void foo() {\n" + |
Lines 5873-5905
Link Here
|
5873 |
" }\n" + |
5926 |
" }\n" + |
5874 |
"}\n", // ================= |
5927 |
"}\n", // ================= |
5875 |
}, |
5928 |
}, |
5876 |
"----------\n" + |
5929 |
"----------\n" + |
5877 |
"1. ERROR in X.java (at line 3)\n" + |
5930 |
"1. ERROR in Other.java (at line 3)\n" + |
5878 |
" static int valueOf(String arg0) { return 0; }//9\n" + |
5931 |
" int i = X.valueOf(\"\");\n" + |
5879 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
5932 |
" ^^^^^^^\n" + |
5880 |
"The enum X already defines the method valueOf(String) implicitly\n" + |
5933 |
"The method valueOf(Class<T>, String) in the type Enum<X> is not applicable for the arguments (String)\n" + |
5881 |
"----------\n", |
5934 |
"----------\n", |
5882 |
null, |
5935 |
null, |
5883 |
true, // flush output |
5936 |
false, // flush output |
5884 |
null, |
5937 |
null, |
5885 |
true, // generate output |
5938 |
true, // generate output |
5886 |
false, |
5939 |
false, |
5887 |
false); |
5940 |
false); |
5888 |
// check consistency of problem when incremental compiling against X problemType |
5941 |
} |
5889 |
this.runNegativeTest( |
|
|
5890 |
new String[] { |
5891 |
"Other.java",// ================= |
5892 |
"public class Other {\n" + |
5893 |
" void foo() {\n" + |
5894 |
" int i = X.valueOf(\"\");\n" + |
5895 |
" }\n" + |
5896 |
"}\n", // ================= |
5897 |
}, |
5898 |
"", |
5899 |
null, |
5900 |
false, // flush output |
5901 |
null, |
5902 |
true, // generate output |
5903 |
false, |
5904 |
false);} |
5905 |
} |
5942 |
} |