Lines 6105-6109
Link Here
|
6105 |
"Cannot reference a field before it is defined\n" + |
6105 |
"Cannot reference a field before it is defined\n" + |
6106 |
"----------\n"); |
6106 |
"----------\n"); |
6107 |
} |
6107 |
} |
|
|
6108 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=263877 |
6109 |
public void test170() { |
6110 |
this.runNegativeTest( |
6111 |
new String[] { |
6112 |
"X.java", // ================= |
6113 |
"enum Days {\n" + |
6114 |
" Monday(\"Mon\", Days.OFFSET + 0), // should not complain\n" + |
6115 |
" Tuesday(\"Tue\", Days.Wednesday.hashCode()), // should complain since enum constant\n" + |
6116 |
" Wednesday(\"Wed\", OFFSET + 2); // should complain since unqualified\n" + |
6117 |
" public static final int OFFSET = 0; // cannot move this above, else more errors\n" + |
6118 |
" Days(String abbr, int index) {\n" + |
6119 |
" }\n" + |
6120 |
"}\n" + |
6121 |
"\n" + |
6122 |
"class X {\n" + |
6123 |
" public static final int FOO = X.OFFSET + 0;\n" + |
6124 |
" public static final int BAR = OFFSET + 1;\n" + |
6125 |
" public static final int OFFSET = 0; // cannot move this above, else more errors\n" + |
6126 |
"}\n", // ================= |
6127 |
}, |
6128 |
"----------\n" + |
6129 |
"1. ERROR in X.java (at line 3)\n" + |
6130 |
" Tuesday(\"Tue\", Days.Wednesday.hashCode()), // should complain since enum constant\n" + |
6131 |
" ^^^^^^^^^\n" + |
6132 |
"Cannot reference a field before it is defined\n" + |
6133 |
"----------\n" + |
6134 |
"2. ERROR in X.java (at line 4)\n" + |
6135 |
" Wednesday(\"Wed\", OFFSET + 2); // should complain since unqualified\n" + |
6136 |
" ^^^^^^\n" + |
6137 |
"Cannot reference a field before it is defined\n" + |
6138 |
"----------\n" + |
6139 |
"3. ERROR in X.java (at line 12)\n" + |
6140 |
" public static final int BAR = OFFSET + 1;\n" + |
6141 |
" ^^^^^^\n" + |
6142 |
"Cannot reference a field before it is defined\n" + |
6143 |
"----------\n"); |
6144 |
} |
6108 |
} |
6145 |
} |
6109 |
|
6146 |
|