Lines 8170-8243
Link Here
|
8170 |
"}", |
8170 |
"}", |
8171 |
|
8171 |
|
8172 |
}, |
8172 |
}, |
8173 |
"----------\n" + |
8173 |
"----------\n" + |
8174 |
"1. ERROR in p\\r2\\A.java (at line 6)\n" + |
8174 |
"1. ERROR in p\\r2\\A.java (at line 6)\n" + |
8175 |
" static void foo() {p.r2.helper.B.x = 100;}\n" + |
8175 |
" static void foo() {p.r2.helper.B.x = 100;}\n" + |
8176 |
" ^^^^^^^^^^^^^^^\n" + |
8176 |
" ^^^^^^^^^^^^^^^\n" + |
8177 |
"The field p.r2.helper.B.x is not visible\n" + |
8177 |
"The field p.r2.helper.B.x is not visible\n" + |
8178 |
"----------\n" + |
8178 |
"----------\n" + |
8179 |
"----------\n" + |
8179 |
"----------\n" + |
8180 |
"1. ERROR in p\\r2\\CMain.java (at line 20)\n" + |
8180 |
"1. ERROR in p\\r2\\CMain.java (at line 20)\n" + |
8181 |
" p1.p2.i = 3;\n" + |
8181 |
" p1.p2.i = 3;\n" + |
8182 |
" ^^^^^^^\n" + |
8182 |
" ^^^^^^^\n" + |
8183 |
"The type P2 is not visible\n" + |
8183 |
"The type P2 is not visible\n" + |
8184 |
"----------\n" + |
8184 |
"----------\n" + |
8185 |
"2. ERROR in p\\r2\\CMain.java (at line 21)\n" + |
8185 |
"2. ERROR in p\\r2\\CMain.java (at line 21)\n" + |
8186 |
" System.out.println(p1.p2.i);\n" + |
8186 |
" System.out.println(p1.p2.i);\n" + |
8187 |
" ^^^^^^^\n" + |
8187 |
" ^^^^^^^\n" + |
8188 |
"The type P2 is not visible\n" + |
8188 |
"The type P2 is not visible\n" + |
8189 |
"----------\n" + |
8189 |
"----------\n" + |
8190 |
"----------\n" + |
8190 |
"----------\n" + |
8191 |
"1. ERROR in p\\r2\\Point.java (at line 10)\n" + |
8191 |
"1. ERROR in p\\r2\\Point.java (at line 10)\n" + |
8192 |
" if (a.z > 0) a.delta(this);\n" + |
8192 |
" if (a.z > 0) a.delta(this);\n" + |
8193 |
" ^^^\n" + |
8193 |
" ^^^\n" + |
8194 |
"The field a.z is not visible\n" + |
8194 |
"The field a.z is not visible\n" + |
8195 |
"----------\n" + |
8195 |
"----------\n" + |
8196 |
"----------\n" + |
8196 |
"----------\n" + |
8197 |
"1. ERROR in p\\r2\\Point4d.java (at line 7)\n" + |
8197 |
"1. ERROR in p\\r2\\Point4d.java (at line 7)\n" + |
8198 |
" z = p.z; }\n" + |
8198 |
" z = p.z; }\n" + |
8199 |
" ^^^\n" + |
8199 |
" ^^^\n" + |
8200 |
"The field p.z is not visible\n" + |
8200 |
"The field p.z is not visible\n" + |
8201 |
"----------\n" + |
8201 |
"----------\n" + |
8202 |
"----------\n" + |
8202 |
"----------\n" + |
8203 |
"1. ERROR in p\\r2\\helper\\Point3d.java (at line 9)\n" + |
8203 |
"1. WARNING in p\\r2\\SubSubA.java (at line 3)\n" + |
8204 |
" p.x += this.x;\n" + |
8204 |
" int j = super.i;\n" + |
8205 |
" ^^^\n" + |
8205 |
" ^^^^^^^\n" + |
8206 |
"The field p.x is not visible\n" + |
8206 |
"The static field A.i should be accessed in a static way\n" + |
8207 |
"----------\n" + |
8207 |
"----------\n" + |
8208 |
"2. ERROR in p\\r2\\helper\\Point3d.java (at line 10)\n" + |
8208 |
"----------\n" + |
8209 |
" p.y += this.y;\n" + |
8209 |
"1. ERROR in p\\r2\\helper\\Point3d.java (at line 9)\n" + |
8210 |
" ^^^\n" + |
8210 |
" p.x += this.x;\n" + |
8211 |
"The field p.y is not visible\n" + |
8211 |
" ^^^\n" + |
8212 |
"----------\n" + |
8212 |
"The field p.x is not visible\n" + |
8213 |
"----------\n" + |
8213 |
"----------\n" + |
8214 |
"1. WARNING in p\\r2\\helper\\B.java (at line 3)\n" + |
8214 |
"2. ERROR in p\\r2\\helper\\Point3d.java (at line 10)\n" + |
8215 |
" protected static int x = 10;\n" + |
8215 |
" p.y += this.y;\n" + |
8216 |
" ^\n" + |
8216 |
" ^^^\n" + |
8217 |
"The field B.x is hiding a field from type A\n" + |
8217 |
"The field p.y is not visible\n" + |
8218 |
"----------\n" + |
8218 |
"----------\n" + |
8219 |
"2. WARNING in p\\r2\\helper\\B.java (at line 4)\n" + |
8219 |
"----------\n" + |
8220 |
" static void foo() {p.r2.A.x = 100;} \n" + |
8220 |
"1. WARNING in p\\r2\\helper\\B.java (at line 3)\n" + |
8221 |
" ^^^^^\n" + |
8221 |
" protected static int x = 10;\n" + |
8222 |
"The method B.foo() does not override the inherited method from A since it is private to a different package.\n" + |
8222 |
" ^\n" + |
8223 |
"----------\n" + |
8223 |
"The field B.x is hiding a field from type A\n" + |
8224 |
"----------\n" + |
8224 |
"----------\n" + |
8225 |
"1. WARNING in p\\r2\\helper\\SomeTest.java (at line 6)\n" + |
8225 |
"2. WARNING in p\\r2\\helper\\B.java (at line 4)\n" + |
8226 |
" assertEquals(false);\n" + |
8226 |
" static void foo() {p.r2.A.x = 100;} \n" + |
8227 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
8227 |
" ^^^^^\n" + |
8228 |
"Access to enclosing method assertEquals(boolean) from the type Test is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + |
8228 |
"The method B.foo() does not override the inherited method from A since it is private to a different package.\n" + |
8229 |
"----------\n" + |
8229 |
"----------\n" + |
8230 |
"----------\n" + |
8230 |
"----------\n" + |
8231 |
"1. WARNING in p\\r2\\helper\\SubA.java (at line 11)\n" + |
8231 |
"1. WARNING in p\\r2\\helper\\SomeTest.java (at line 6)\n" + |
8232 |
" int x = i; }; // bad since from inside inner\n" + |
8232 |
" assertEquals(false);\n" + |
8233 |
" ^\n" + |
8233 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
8234 |
"The field new Object(){}.x is hiding a field from type A\n" + |
8234 |
"Access to enclosing method assertEquals(boolean) from the type Test is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + |
8235 |
"----------\n" + |
8235 |
"----------\n" + |
8236 |
"2. WARNING in p\\r2\\helper\\SubA.java (at line 11)\n" + |
8236 |
"----------\n" + |
8237 |
" int x = i; }; // bad since from inside inner\n" + |
8237 |
"1. WARNING in p\\r2\\helper\\SubA.java (at line 3)\n" + |
8238 |
" ^\n" + |
8238 |
" int j = super.i;\n" + |
8239 |
"Read access to enclosing field A.i is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + |
8239 |
" ^^^^^^^\n" + |
8240 |
"----------\n" |
8240 |
"The static field A.i should be accessed in a static way\n" + |
|
|
8241 |
"----------\n" + |
8242 |
"2. WARNING in p\\r2\\helper\\SubA.java (at line 11)\n" + |
8243 |
" int x = i; }; // bad since from inside inner\n" + |
8244 |
" ^\n" + |
8245 |
"The field new Object(){}.x is hiding a field from type A\n" + |
8246 |
"----------\n" + |
8247 |
"3. WARNING in p\\r2\\helper\\SubA.java (at line 11)\n" + |
8248 |
" int x = i; }; // bad since from inside inner\n" + |
8249 |
" ^\n" + |
8250 |
"Read access to enclosing field A.i is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + |
8251 |
"----------\n" + |
8252 |
"----------\n" + |
8253 |
"1. WARNING in p\\r2\\helper2\\SubSubA2.java (at line 3)\n" + |
8254 |
" int j = super.i;\n" + |
8255 |
" ^^^^^^^\n" + |
8256 |
"The static field A.i should be accessed in a static way\n" + |
8257 |
"----------\n" |
8241 |
); |
8258 |
); |
8242 |
} |
8259 |
} |
8243 |
public void test222() { |
8260 |
public void test222() { |
Lines 10309-10335
Link Here
|
10309 |
" ^^^^^^^^^^^^^^^^\n" + |
10326 |
" ^^^^^^^^^^^^^^^^\n" + |
10310 |
"The static field X.staticField should be accessed in a static way\n" + |
10327 |
"The static field X.staticField should be accessed in a static way\n" + |
10311 |
"----------\n" + |
10328 |
"----------\n" + |
10312 |
"10. WARNING in p\\X.java (at line 36)\n" + |
10329 |
"10. WARNING in p\\X.java (at line 35)\n" + |
|
|
10330 |
" i = super.staticField; \n" + |
10331 |
" ^^^^^^^^^^^^^^^^^\n" + |
10332 |
"The static field X0.staticField should be accessed in a static way\n" + |
10333 |
"----------\n" + |
10334 |
"11. WARNING in p\\X.java (at line 36)\n" + |
10313 |
" i = new X().staticField; \n" + |
10335 |
" i = new X().staticField; \n" + |
10314 |
" ^^^^^^^^^^^\n" + |
10336 |
" ^^^^^^^^^^^\n" + |
10315 |
"The static field X.staticField should be accessed in a static way\n" + |
10337 |
"The static field X.staticField should be accessed in a static way\n" + |
10316 |
"----------\n" + |
10338 |
"----------\n" + |
10317 |
"11. WARNING in p\\X.java (at line 37)\n" + |
10339 |
"12. WARNING in p\\X.java (at line 37)\n" + |
10318 |
" i = x.staticField; \n" + |
10340 |
" i = x.staticField; \n" + |
10319 |
" ^^^^^^^^^^^^^\n" + |
10341 |
" ^^^^^^^^^^^^^\n" + |
10320 |
"The static field X.staticField should be accessed in a static way\n" + |
10342 |
"The static field X.staticField should be accessed in a static way\n" + |
10321 |
"----------\n" + |
10343 |
"----------\n" + |
10322 |
"12. WARNING in p\\X.java (at line 38)\n" + |
10344 |
"13. WARNING in p\\X.java (at line 38)\n" + |
10323 |
" i = x.other.staticField; \n" + |
10345 |
" i = x.other.staticField; \n" + |
10324 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
10346 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
10325 |
"The static field X.staticField should be accessed in a static way\n" + |
10347 |
"The static field X.staticField should be accessed in a static way\n" + |
10326 |
"----------\n" + |
10348 |
"----------\n" + |
10327 |
"13. ERROR in p\\X.java (at line 42)\n" + |
10349 |
"14. ERROR in p\\X.java (at line 42)\n" + |
10328 |
" method(); \n" + |
10350 |
" method(); \n" + |
10329 |
" ^^^^^^\n" + |
10351 |
" ^^^^^^\n" + |
10330 |
"Cannot make a static reference to the non-static method method() from the type X\n" + |
10352 |
"Cannot make a static reference to the non-static method method() from the type X\n" + |
10331 |
"----------\n" + |
10353 |
"----------\n" + |
10332 |
"14. ERROR in p\\X.java (at line 45)\n" + |
10354 |
"15. ERROR in p\\X.java (at line 45)\n" + |
10333 |
" i = field; \n" + |
10355 |
" i = field; \n" + |
10334 |
" ^^^^^\n" + |
10356 |
" ^^^^^\n" + |
10335 |
"Cannot make a static reference to the non-static field field\n" + |
10357 |
"Cannot make a static reference to the non-static field field\n" + |
Lines 13385-13390
Link Here
|
13385 |
public void test359() { |
13407 |
public void test359() { |
13386 |
Map customOptions = getCompilerOptions(); |
13408 |
Map customOptions = getCompilerOptions(); |
13387 |
customOptions.put(CompilerOptions.OPTION_ReportIndirectStaticAccess, CompilerOptions.ERROR); |
13409 |
customOptions.put(CompilerOptions.OPTION_ReportIndirectStaticAccess, CompilerOptions.ERROR); |
|
|
13410 |
customOptions.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); |
13388 |
this.runNegativeTest( |
13411 |
this.runNegativeTest( |
13389 |
new String[] { |
13412 |
new String[] { |
13390 |
"X.java", |
13413 |
"X.java", |