Lines 3176-3181
Link Here
|
3176 |
"The type B$A is not visible\n" + |
3176 |
"The type B$A is not visible\n" + |
3177 |
"----------\n"); |
3177 |
"----------\n"); |
3178 |
} |
3178 |
} |
|
|
3179 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 |
3180 |
public void test098() { |
3181 |
Map options = getCompilerOptions(); |
3182 |
CompilerOptions compOptions = new CompilerOptions(options); |
3183 |
if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; |
3184 |
this.runNegativeTest( |
3185 |
new String[] { |
3186 |
"A.java",//------------------------------ |
3187 |
"public class A {\n" + |
3188 |
" private int x;\n" + |
3189 |
" static class B {\n" + |
3190 |
" private int x;\n" + |
3191 |
" private C c = new C() {\n" + |
3192 |
" void foo() {\n" + |
3193 |
" x = 3;\n" + |
3194 |
" }\n" + |
3195 |
" };\n" + |
3196 |
" }\n" + |
3197 |
" static class C {\n" + |
3198 |
" private int x;\n" + |
3199 |
" }\n" + |
3200 |
" }\n", |
3201 |
}, |
3202 |
"----------\n" + |
3203 |
"1. WARNING in A.java (at line 2)\n" + |
3204 |
" private int x;\n" + |
3205 |
" ^\n" + |
3206 |
"The field A.x is never read locally\n" + |
3207 |
"----------\n" + |
3208 |
"2. WARNING in A.java (at line 4)\n" + |
3209 |
" private int x;\n" + |
3210 |
" ^\n" + |
3211 |
"The field A.B.x is never read locally\n" + |
3212 |
"----------\n" + |
3213 |
"3. WARNING in A.java (at line 5)\n" + |
3214 |
" private C c = new C() {\n" + |
3215 |
" ^\n" + |
3216 |
"The field A.B.c is never read locally\n" + |
3217 |
"----------\n" + |
3218 |
"4. WARNING in A.java (at line 6)\n" + |
3219 |
" void foo() {\n" + |
3220 |
" ^^^^^\n" + |
3221 |
"The method foo() from the type new A.C(){} is never used locally\n" + |
3222 |
"----------\n" + |
3223 |
"5. WARNING in A.java (at line 7)\n" + |
3224 |
" x = 3;\n" + |
3225 |
" ^\n" + |
3226 |
"Write access to enclosing field A.B.x is emulated by a synthetic accessor method\n" + |
3227 |
"----------\n" + |
3228 |
"6. WARNING in A.java (at line 12)\n" + |
3229 |
" private int x;\n" + |
3230 |
" ^\n" + |
3231 |
"The field A.C.x is never read locally\n" + |
3232 |
"----------\n"); |
3233 |
} |
3234 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 |
3235 |
public void test099() { |
3236 |
Map options = getCompilerOptions(); |
3237 |
CompilerOptions compOptions = new CompilerOptions(options); |
3238 |
if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; |
3239 |
this.runNegativeTest( |
3240 |
new String[] { |
3241 |
"A.java",//------------------------------ |
3242 |
"public class A {\n" + |
3243 |
" private int x;\n" + |
3244 |
" static class B {\n" + |
3245 |
" private int x;\n" + |
3246 |
" private C c = new C() {\n" + |
3247 |
" void foo() {\n" + |
3248 |
" x = 3;\n" + |
3249 |
" }\n" + |
3250 |
" };\n" + |
3251 |
" }\n" + |
3252 |
" static class C {\n" + |
3253 |
" public int x;\n" + |
3254 |
" }\n" + |
3255 |
" }\n", |
3256 |
}, |
3257 |
"----------\n" + |
3258 |
"1. WARNING in A.java (at line 2)\n" + |
3259 |
" private int x;\n" + |
3260 |
" ^\n" + |
3261 |
"The field A.x is never read locally\n" + |
3262 |
"----------\n" + |
3263 |
"2. WARNING in A.java (at line 4)\n" + |
3264 |
" private int x;\n" + |
3265 |
" ^\n" + |
3266 |
"The field A.B.x is never read locally\n" + |
3267 |
"----------\n" + |
3268 |
"3. WARNING in A.java (at line 5)\n" + |
3269 |
" private C c = new C() {\n" + |
3270 |
" ^\n" + |
3271 |
"The field A.B.c is never read locally\n" + |
3272 |
"----------\n" + |
3273 |
"4. WARNING in A.java (at line 6)\n" + |
3274 |
" void foo() {\n" + |
3275 |
" ^^^^^\n" + |
3276 |
"The method foo() from the type new A.C(){} is never used locally\n" + |
3277 |
"----------\n"); |
3278 |
} |
3279 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 |
3280 |
public void test100() { |
3281 |
Map options = getCompilerOptions(); |
3282 |
CompilerOptions compOptions = new CompilerOptions(options); |
3283 |
if (compOptions.complianceLevel < ClassFileConstants.JDK1_4) return; |
3284 |
this.runNegativeTest( |
3285 |
new String[] { |
3286 |
"A.java",//------------------------------ |
3287 |
"public class A {\n" + |
3288 |
" private int x;\n" + |
3289 |
" private C c = new C() {\n" + |
3290 |
" void foo() {\n" + |
3291 |
" x = 3;\n" + |
3292 |
" }\n" + |
3293 |
" };\n" + |
3294 |
" static class C {\n" + |
3295 |
" private int x;\n" + |
3296 |
" }\n" + |
3297 |
" }\n", |
3298 |
}, |
3299 |
"----------\n" + |
3300 |
"1. WARNING in A.java (at line 2)\n" + |
3301 |
" private int x;\n" + |
3302 |
" ^\n" + |
3303 |
"The field A.x is never read locally\n" + |
3304 |
"----------\n" + |
3305 |
"2. WARNING in A.java (at line 3)\n" + |
3306 |
" private C c = new C() {\n" + |
3307 |
" ^\n" + |
3308 |
"The field A.c is never read locally\n" + |
3309 |
"----------\n" + |
3310 |
"3. WARNING in A.java (at line 4)\n" + |
3311 |
" void foo() {\n" + |
3312 |
" ^^^^^\n" + |
3313 |
"The method foo() from the type new A.C(){} is never used locally\n" + |
3314 |
"----------\n" + |
3315 |
"4. WARNING in A.java (at line 5)\n" + |
3316 |
" x = 3;\n" + |
3317 |
" ^\n" + |
3318 |
"Write access to enclosing field A.x is emulated by a synthetic accessor method\n" + |
3319 |
"----------\n" + |
3320 |
"5. WARNING in A.java (at line 9)\n" + |
3321 |
" private int x;\n" + |
3322 |
" ^\n" + |
3323 |
"The field A.C.x is never read locally\n" + |
3324 |
"----------\n"); |
3325 |
} |
3179 |
public static Class testClass() { return LookupTest.class; |
3326 |
public static Class testClass() { return LookupTest.class; |
3180 |
} |
3327 |
} |
3181 |
} |
3328 |
} |