Lines 15533-15538
public void testBug247564a_3() {
Link Here
|
15533 |
"public class X {\n" + |
15533 |
"public class X {\n" + |
15534 |
" Object o;\n" + |
15534 |
" Object o;\n" + |
15535 |
" void foo() {\n" + |
15535 |
" void foo() {\n" + |
|
|
15536 |
" o = null;\n" + |
15536 |
" }\n" + |
15537 |
" }\n" + |
15537 |
" void foo1() {\n" + |
15538 |
" void foo1() {\n" + |
15538 |
" o.toString();\n" + |
15539 |
" o.toString();\n" + |
Lines 15580-15586
public void testBug247564a_5() {
Link Here
|
15580 |
" if (field == null) { \n" + |
15581 |
" if (field == null) { \n" + |
15581 |
" field = new Object();\n" + |
15582 |
" field = new Object();\n" + |
15582 |
" }\n" + |
15583 |
" }\n" + |
15583 |
" field.toString(); //Pot. NPE\n" + |
15584 |
" field.toString(); // Wrong outcome was: Pot. NPE\n" + |
15584 |
" i--;\n" + |
15585 |
" i--;\n" + |
15585 |
" }\n" + |
15586 |
" }\n" + |
15586 |
" }\n" + |
15587 |
" }\n" + |
Lines 16005-16011
public void testBug247564b_4() {
Link Here
|
16005 |
" }\n" + |
16006 |
" }\n" + |
16006 |
" void foo1() {\n" + |
16007 |
" void foo1() {\n" + |
16007 |
" if (o == null) {\n" + |
16008 |
" if (o == null) {\n" + |
16008 |
" o.toString(); // danger" + |
16009 |
" o.toString(); // danger\n" + |
16009 |
" return;\n" + |
16010 |
" return;\n" + |
16010 |
" }\n" + |
16011 |
" }\n" + |
16011 |
" o.toString(); // safe\n" + |
16012 |
" o.toString(); // safe\n" + |
Lines 16019-16029
public void testBug247564b_4() {
Link Here
|
16019 |
"}\n"}, |
16020 |
"}\n"}, |
16020 |
"----------\n" + |
16021 |
"----------\n" + |
16021 |
"1. ERROR in X.java (at line 13)\n" + |
16022 |
"1. ERROR in X.java (at line 13)\n" + |
16022 |
" o.toString(); // danger return;\n" + |
16023 |
" o.toString(); // danger\n" + |
16023 |
" ^\n" + |
16024 |
" ^\n" + |
16024 |
"Null pointer access: The field o can only be null at this location\n" + |
16025 |
"Null pointer access: The field o can only be null at this location\n" + |
16025 |
"----------\n" + |
16026 |
"----------\n" + |
16026 |
"2. ERROR in X.java (at line 21)\n" + |
16027 |
"2. ERROR in X.java (at line 22)\n" + |
16027 |
" o.toString(); // uncertain\n" + |
16028 |
" o.toString(); // uncertain\n" + |
16028 |
" ^\n" + |
16029 |
" ^\n" + |
16029 |
"Potential null pointer access: The field o may be null at this location\n" + |
16030 |
"Potential null pointer access: The field o may be null at this location\n" + |
Lines 16075-16081
public void testBug247564b_4_2() {
Link Here
|
16075 |
" }\n" + |
16076 |
" }\n" + |
16076 |
" void foo1() {\n" + |
16077 |
" void foo1() {\n" + |
16077 |
" if (o == null) {\n" + |
16078 |
" if (o == null) {\n" + |
16078 |
" o.toString(); // danger" + |
16079 |
" o.toString(); // danger\n" + |
16079 |
" return;\n" + |
16080 |
" return;\n" + |
16080 |
" }\n" + |
16081 |
" }\n" + |
16081 |
" o.toString(); // safe\n" + |
16082 |
" o.toString(); // safe\n" + |
Lines 16089-16099
public void testBug247564b_4_2() {
Link Here
|
16089 |
"}\n"}, |
16090 |
"}\n"}, |
16090 |
"----------\n" + |
16091 |
"----------\n" + |
16091 |
"1. ERROR in X.java (at line 39)\n" + |
16092 |
"1. ERROR in X.java (at line 39)\n" + |
16092 |
" o.toString(); // danger return;\n" + |
16093 |
" o.toString(); // danger\n" + |
16093 |
" ^\n" + |
16094 |
" ^\n" + |
16094 |
"Null pointer access: The field o can only be null at this location\n" + |
16095 |
"Null pointer access: The field o can only be null at this location\n" + |
16095 |
"----------\n" + |
16096 |
"----------\n" + |
16096 |
"2. ERROR in X.java (at line 47)\n" + |
16097 |
"2. ERROR in X.java (at line 48)\n" + |
16097 |
" o.toString(); // uncertain\n" + |
16098 |
" o.toString(); // uncertain\n" + |
16098 |
" ^\n" + |
16099 |
" ^\n" + |
16099 |
"Potential null pointer access: The field o may be null at this location\n" + |
16100 |
"Potential null pointer access: The field o may be null at this location\n" + |
Lines 16128-16133
public void testBug247564b_5() {
Link Here
|
16128 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16129 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16129 |
" o.toString();\n" + // report NPE |
16130 |
" o.toString();\n" + // report NPE |
16130 |
" }\n" + |
16131 |
" }\n" + |
|
|
16132 |
" local.toString();\n" + // try to diffuse status for o / o2 |
16131 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16133 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16132 |
" if (o2 == null) {\n" + // report always false null check |
16134 |
" if (o2 == null) {\n" + // report always false null check |
16133 |
" o2.toString();\n" + // dead code |
16135 |
" o2.toString();\n" + // dead code |
Lines 16151-16162
public void testBug247564b_5() {
Link Here
|
16151 |
" ^\n" + |
16153 |
" ^\n" + |
16152 |
"Null pointer access: The field o can only be null at this location\n" + |
16154 |
"Null pointer access: The field o can only be null at this location\n" + |
16153 |
"----------\n" + |
16155 |
"----------\n" + |
16154 |
"4. ERROR in X.java (at line 22)\n" + |
16156 |
"4. ERROR in X.java (at line 23)\n" + |
16155 |
" if (o2 == null) {\n" + |
16157 |
" if (o2 == null) {\n" + |
16156 |
" ^^\n" + |
16158 |
" ^^\n" + |
16157 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16159 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16158 |
"----------\n" + |
16160 |
"----------\n" + |
16159 |
"5. WARNING in X.java (at line 22)\n" + |
16161 |
"5. WARNING in X.java (at line 23)\n" + |
16160 |
" if (o2 == null) {\n" + |
16162 |
" if (o2 == null) {\n" + |
16161 |
" o2.toString();\n" + |
16163 |
" o2.toString();\n" + |
16162 |
" }\n" + |
16164 |
" }\n" + |
Lines 16166-16174
public void testBug247564b_5() {
Link Here
|
16166 |
); |
16168 |
); |
16167 |
} |
16169 |
} |
16168 |
|
16170 |
|
16169 |
//null analysis -- case for static final field initialized inside static block with different values |
16171 |
// null analysis -- case for static final field initialized inside static block with different values |
16170 |
//check if the resetting works properly i.e. null status for constant fields should not be |
16172 |
// check if the resetting works properly i.e. null status for constant fields should not be |
16171 |
//reset on method calls. This test is for constructors |
16173 |
// reset on method calls. This test is for constructors |
16172 |
public void testBug247564b_6() { |
16174 |
public void testBug247564b_6() { |
16173 |
this.runNegativeTest( |
16175 |
this.runNegativeTest( |
16174 |
new String[] { |
16176 |
new String[] { |
Lines 16193-16198
public void testBug247564b_6() {
Link Here
|
16193 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16195 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16194 |
" o.toString();\n" + // report NPE |
16196 |
" o.toString();\n" + // report NPE |
16195 |
" }\n" + |
16197 |
" }\n" + |
|
|
16198 |
" local.toString();\n" + // try to diffuse status for o / o2 |
16196 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16199 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16197 |
" if (o2 == null) {\n" + // report always false null check |
16200 |
" if (o2 == null) {\n" + // report always false null check |
16198 |
" o2.toString();\n" + // dead code |
16201 |
" o2.toString();\n" + // dead code |
Lines 16216-16227
public void testBug247564b_6() {
Link Here
|
16216 |
" ^\n" + |
16219 |
" ^\n" + |
16217 |
"Null pointer access: The field o can only be null at this location\n" + |
16220 |
"Null pointer access: The field o can only be null at this location\n" + |
16218 |
"----------\n" + |
16221 |
"----------\n" + |
16219 |
"4. ERROR in X.java (at line 22)\n" + |
16222 |
"4. ERROR in X.java (at line 23)\n" + |
16220 |
" if (o2 == null) {\n" + |
16223 |
" if (o2 == null) {\n" + |
16221 |
" ^^\n" + |
16224 |
" ^^\n" + |
16222 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16225 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16223 |
"----------\n" + |
16226 |
"----------\n" + |
16224 |
"5. WARNING in X.java (at line 22)\n" + |
16227 |
"5. WARNING in X.java (at line 23)\n" + |
16225 |
" if (o2 == null) {\n" + |
16228 |
" if (o2 == null) {\n" + |
16226 |
" o2.toString();\n" + |
16229 |
" o2.toString();\n" + |
16227 |
" }\n" + |
16230 |
" }\n" + |
Lines 16231-16239
public void testBug247564b_6() {
Link Here
|
16231 |
); |
16234 |
); |
16232 |
} |
16235 |
} |
16233 |
|
16236 |
|
16234 |
//null analysis -- case for static final field initialized inside static block with different values |
16237 |
// null analysis -- case for static final field initialized inside static block with different values |
16235 |
//check if the resetting works properly i.e. null status for constant fields should not be |
16238 |
// check if the resetting works properly i.e. null status for constant fields should not be |
16236 |
//reset on method calls. This test is for constructors |
16239 |
// reset on method calls. This test is for constructors |
16237 |
public void testBug247564b_6_2() { |
16240 |
public void testBug247564b_6_2() { |
16238 |
this.runNegativeTest( |
16241 |
this.runNegativeTest( |
16239 |
new String[] { |
16242 |
new String[] { |
Lines 16284-16289
public void testBug247564b_6_2() {
Link Here
|
16284 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16287 |
" if (o == null) {\n" + // don't know o's nullness, so silent |
16285 |
" o.toString();\n" + // report NPE |
16288 |
" o.toString();\n" + // report NPE |
16286 |
" }\n" + |
16289 |
" }\n" + |
|
|
16290 |
" local.toString();\n" + // try to diffuse status for o / o2 |
16287 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16291 |
" o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16288 |
" if (o2 == null) {\n" + // report always false null check |
16292 |
" if (o2 == null) {\n" + // report always false null check |
16289 |
" o2.toString();\n" + // dead code |
16293 |
" o2.toString();\n" + // dead code |
Lines 16307-16318
public void testBug247564b_6_2() {
Link Here
|
16307 |
" ^\n" + |
16311 |
" ^\n" + |
16308 |
"Null pointer access: The field o can only be null at this location\n" + |
16312 |
"Null pointer access: The field o can only be null at this location\n" + |
16309 |
"----------\n" + |
16313 |
"----------\n" + |
16310 |
"4. ERROR in X.java (at line 48)\n" + |
16314 |
"4. ERROR in X.java (at line 49)\n" + |
16311 |
" if (o2 == null) {\n" + |
16315 |
" if (o2 == null) {\n" + |
16312 |
" ^^\n" + |
16316 |
" ^^\n" + |
16313 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16317 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16314 |
"----------\n" + |
16318 |
"----------\n" + |
16315 |
"5. WARNING in X.java (at line 48)\n" + |
16319 |
"5. WARNING in X.java (at line 49)\n" + |
16316 |
" if (o2 == null) {\n" + |
16320 |
" if (o2 == null) {\n" + |
16317 |
" o2.toString();\n" + |
16321 |
" o2.toString();\n" + |
16318 |
" }\n" + |
16322 |
" }\n" + |
Lines 16349-16354
public void testBug247564b_7() {
Link Here
|
16349 |
" if (o1 == null) {\n" + // can't be null, was dereferenced in static initializer |
16353 |
" if (o1 == null) {\n" + // can't be null, was dereferenced in static initializer |
16350 |
" o1.toString();\n" + // dead |
16354 |
" o1.toString();\n" + // dead |
16351 |
" }\n" + |
16355 |
" }\n" + |
|
|
16356 |
" local.toString();\n" + // try to diffuse status for o1 / o2 |
16352 |
" o1.toString();\n" + // safe |
16357 |
" o1.toString();\n" + // safe |
16353 |
" if (o2 == null) {\n" + // report always false null check |
16358 |
" if (o2 == null) {\n" + // report always false null check |
16354 |
" o2.toString();\n" + // dead code |
16359 |
" o2.toString();\n" + // dead code |
Lines 16384-16395
public void testBug247564b_7() {
Link Here
|
16384 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
16389 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
16385 |
"Dead code\n" + |
16390 |
"Dead code\n" + |
16386 |
"----------\n" + |
16391 |
"----------\n" + |
16387 |
"6. ERROR in X.java (at line 22)\n" + |
16392 |
"6. ERROR in X.java (at line 23)\n" + |
16388 |
" if (o2 == null) {\n" + |
16393 |
" if (o2 == null) {\n" + |
16389 |
" ^^\n" + |
16394 |
" ^^\n" + |
16390 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16395 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16391 |
"----------\n" + |
16396 |
"----------\n" + |
16392 |
"7. WARNING in X.java (at line 22)\n" + |
16397 |
"7. WARNING in X.java (at line 23)\n" + |
16393 |
" if (o2 == null) {\n" + |
16398 |
" if (o2 == null) {\n" + |
16394 |
" o2.toString();\n" + |
16399 |
" o2.toString();\n" + |
16395 |
" }\n" + |
16400 |
" }\n" + |
Lines 16447-16452
public void testBug247564b_8() {
Link Here
|
16447 |
" if (o1 == null) {\n" + // report redundant null check |
16452 |
" if (o1 == null) {\n" + // report redundant null check |
16448 |
" o1.toString();\n" + // report NPE |
16453 |
" o1.toString();\n" + // report NPE |
16449 |
" }\n" + |
16454 |
" }\n" + |
|
|
16455 |
" local.toString();\n" + // try to diffuse status for o1 / o2 |
16450 |
" o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16456 |
" o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16451 |
" if (o2 == null) {\n" + // report always false null check |
16457 |
" if (o2 == null) {\n" + // report always false null check |
16452 |
" o2.toString();\n" + // dead code |
16458 |
" o2.toString();\n" + // dead code |
Lines 16477-16488
public void testBug247564b_8() {
Link Here
|
16477 |
" ^^\n" + |
16483 |
" ^^\n" + |
16478 |
"Null pointer access: The field o1 can only be null at this location\n" + |
16484 |
"Null pointer access: The field o1 can only be null at this location\n" + |
16479 |
"----------\n" + |
16485 |
"----------\n" + |
16480 |
"5. ERROR in X.java (at line 40)\n" + |
16486 |
"5. ERROR in X.java (at line 41)\n" + |
16481 |
" if (o2 == null) {\n" + |
16487 |
" if (o2 == null) {\n" + |
16482 |
" ^^\n" + |
16488 |
" ^^\n" + |
16483 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16489 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16484 |
"----------\n" + |
16490 |
"----------\n" + |
16485 |
"6. WARNING in X.java (at line 40)\n" + |
16491 |
"6. WARNING in X.java (at line 41)\n" + |
16486 |
" if (o2 == null) {\n" + |
16492 |
" if (o2 == null) {\n" + |
16487 |
" o2.toString();\n" + |
16493 |
" o2.toString();\n" + |
16488 |
" }\n" + |
16494 |
" }\n" + |
Lines 16517-16522
public void testBug247564b_9() {
Link Here
|
16517 |
" if (o1 == null) {\n" + // report redundant null check |
16523 |
" if (o1 == null) {\n" + // report redundant null check |
16518 |
" o1.toString();\n" + // report NPE |
16524 |
" o1.toString();\n" + // report NPE |
16519 |
" }\n" + |
16525 |
" }\n" + |
|
|
16526 |
" local.toString();\n" + // try to diffuse status for o1 / o2 |
16520 |
" o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16527 |
" o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' |
16521 |
" if (o2 == null) {\n" + // report always false null check |
16528 |
" if (o2 == null) {\n" + // report always false null check |
16522 |
" o2.toString();\n" + // dead code |
16529 |
" o2.toString();\n" + // dead code |
Lines 16547-16558
public void testBug247564b_9() {
Link Here
|
16547 |
" ^^\n" + |
16554 |
" ^^\n" + |
16548 |
"Null pointer access: The field o1 can only be null at this location\n" + |
16555 |
"Null pointer access: The field o1 can only be null at this location\n" + |
16549 |
"----------\n" + |
16556 |
"----------\n" + |
16550 |
"5. ERROR in X.java (at line 18)\n" + |
16557 |
"5. ERROR in X.java (at line 19)\n" + |
16551 |
" if (o2 == null) {\n" + |
16558 |
" if (o2 == null) {\n" + |
16552 |
" ^^\n" + |
16559 |
" ^^\n" + |
16553 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16560 |
"Null comparison always yields false: The field o2 cannot be null at this location\n" + |
16554 |
"----------\n" + |
16561 |
"----------\n" + |
16555 |
"6. WARNING in X.java (at line 18)\n" + |
16562 |
"6. WARNING in X.java (at line 19)\n" + |
16556 |
" if (o2 == null) {\n" + |
16563 |
" if (o2 == null) {\n" + |
16557 |
" o2.toString();\n" + |
16564 |
" o2.toString();\n" + |
16558 |
" }\n" + |
16565 |
" }\n" + |
Lines 16812-16837
public void testBug247564d_1() {
Link Here
|
16812 |
); |
16819 |
); |
16813 |
} |
16820 |
} |
16814 |
|
16821 |
|
16815 |
// null analysis -- test redundant instanceof warning for static final fields |
|
|
16816 |
public void testBug247564e_1() { |
16817 |
this.runNegativeTest( |
16818 |
new String[] { |
16819 |
"X.java", |
16820 |
"public class X {\n" + |
16821 |
" static final Object o = null;\n" + |
16822 |
" void foo() {\n" + |
16823 |
" if (o instanceof X) return;\n" + |
16824 |
" }\n" + |
16825 |
"}"}, |
16826 |
"----------\n" + |
16827 |
"1. ERROR in X.java (at line 4)\n" + |
16828 |
" if (o instanceof X) return;\n" + |
16829 |
" ^\n" + |
16830 |
"instanceof always yields false: The field o can only be null at this location\n" + |
16831 |
"----------\n", |
16832 |
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); |
16833 |
} |
16834 |
|
16835 |
// null analysis -- test potential null ptr access warning because of static field access through object returned by method call |
16822 |
// null analysis -- test potential null ptr access warning because of static field access through object returned by method call |
16836 |
public void testBug247564f() { |
16823 |
public void testBug247564f() { |
16837 |
Map compilerOptions = getCompilerOptions(); |
16824 |
Map compilerOptions = getCompilerOptions(); |
Lines 16935-16941
public void testBug247564g() {
Link Here
|
16935 |
" if (this.field99 == null && this.field99.hashCode() == 0){}\n" + |
16922 |
" if (this.field99 == null && this.field99.hashCode() == 0){}\n" + |
16936 |
" this.field98 = null;\n" + |
16923 |
" this.field98 = null;\n" + |
16937 |
" }\n" + |
16924 |
" }\n" + |
16938 |
" if (this.field98.hashCode() == 0) {}\n" + // should not complain |
16925 |
" if (this.field98.hashCode() == 0) {}\n" + |
16939 |
" this.field97 = null;\n" + |
16926 |
" this.field97 = null;\n" + |
16940 |
" if (this.field97.hashCode() == 0) {}\n" + |
16927 |
" if (this.field97.hashCode() == 0) {}\n" + |
16941 |
" if (this.field100.hashCode() == 0) {}\n" + |
16928 |
" if (this.field100.hashCode() == 0) {}\n" + |
Lines 16999-17005
public void testBug247564h() {
Link Here
|
16999 |
} |
16986 |
} |
17000 |
|
16987 |
|
17001 |
// null analysis -- simple case for field for inner class |
16988 |
// null analysis -- simple case for field for inner class |
17002 |
// to make sure that id's of local variables in inner classes dotn conflict with those of fields. |
16989 |
// to make sure that id's of local variables in inner classes don't conflict with those of fields. |
17003 |
public void testBug247564h_1() { |
16990 |
public void testBug247564h_1() { |
17004 |
this.runNegativeTest( |
16991 |
this.runNegativeTest( |
17005 |
new String[] { |
16992 |
new String[] { |
Lines 17027-17033
public void testBug247564h_1() {
Link Here
|
17027 |
} |
17014 |
} |
17028 |
|
17015 |
|
17029 |
// null analysis -- simple case for field for inner class |
17016 |
// null analysis -- simple case for field for inner class |
17030 |
// to make sure that id's of local variables in inner classes dotn conflict with those of fields. |
17017 |
// to make sure that id's of local variables in inner classes don't conflict with those of fields. |
17031 |
public void testBug247564h_2() { |
17018 |
public void testBug247564h_2() { |
17032 |
this.runNegativeTest( |
17019 |
this.runNegativeTest( |
17033 |
new String[] { |
17020 |
new String[] { |
Lines 17041-17054
public void testBug247564h_2() {
Link Here
|
17041 |
" class X2 {\n" + |
17028 |
" class X2 {\n" + |
17042 |
" Object field4;\n" + |
17029 |
" Object field4;\n" + |
17043 |
" Object field5;\n" + |
17030 |
" Object field5;\n" + |
17044 |
" void goo(Object var) {\n" + |
17031 |
" void goo(Object var) {\n" + |
17045 |
" if (var == null && field4.toString() == \"\"){}\n" + |
17032 |
" if (var == null && field4.toString() == \"\"){}\n" + |
17046 |
" if (var == null && field5.toString() == \"\"){}\n" + |
17033 |
" if (var == null && field5.toString() == \"\"){}\n" + |
17047 |
" if (field3 == null && field3.toString() == \"\"){}\n" + |
17034 |
" if (field3 == null && field3.toString() == \"\"){}\n" + |
17048 |
" if (field3 == null && field1.toString() == \"\"){}\n" + |
17035 |
" if (field3 == null && field1.toString() == \"\"){}\n" + |
17049 |
" }\n" + |
17036 |
" }\n" + |
17050 |
" }\n" + |
17037 |
" }\n" + |
17051 |
" Object field22;\n" + |
17038 |
" Object field22;\n" + |
17052 |
" }\n" + |
17039 |
" }\n" + |
17053 |
"}\n"}, |
17040 |
"}\n"}, |
17054 |
"----------\n" + |
17041 |
"----------\n" + |
Lines 17085-17091
public void testBug247564i_1() {
Link Here
|
17085 |
" if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17072 |
" if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17086 |
" if (this.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17073 |
" if (this.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17087 |
" if (X.field0 == null && this.field0.toString() == \"\"){}\n" + // warn |
17074 |
" if (X.field0 == null && this.field0.toString() == \"\"){}\n" + // warn |
17088 |
" if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn |
17075 |
" if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn (diffused by getX() call) |
17089 |
" }\n" + |
17076 |
" }\n" + |
17090 |
"}\n" + |
17077 |
"}\n" + |
17091 |
"class Y{\n" + |
17078 |
"class Y{\n" + |
Lines 17199-17207
public void testBug247564i_3() {
Link Here
|
17199 |
" static Y getY(){ return new Y();}\n" + |
17186 |
" static Y getY(){ return new Y();}\n" + |
17200 |
" static X getX() { return new X();}\n" + |
17187 |
" static X getX() { return new X();}\n" + |
17201 |
" static class XInner{\n" + |
17188 |
" static class XInner{\n" + |
17202 |
" static Object xinnerfield;\n" + |
17189 |
" static Object xinnerfield;\n" + |
17203 |
" XInner getXInner() { return new XInner();\n}" + |
17190 |
" XInner getXInner() { return new XInner();\n}" + |
17204 |
" void goo(Object var) {\n" + |
17191 |
" void goo(Object var) {\n" + |
17205 |
" if (new Y().getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn |
17192 |
" if (new Y().getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn |
17206 |
" if (getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn |
17193 |
" if (getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn |
17207 |
" if (new Y().getX().field0 == null && field0.toString() == \"\"){}\n" + // warn |
17194 |
" if (new Y().getX().field0 == null && field0.toString() == \"\"){}\n" + // warn |
Lines 17223-17229
public void testBug247564i_3() {
Link Here
|
17223 |
" if (Y.xiny.field1 == null && Y.yField1.toString() == \"\"){}\n" + // no warn |
17210 |
" if (Y.xiny.field1 == null && Y.yField1.toString() == \"\"){}\n" + // no warn |
17224 |
" if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17211 |
" if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn |
17225 |
" if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn |
17212 |
" if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn |
17226 |
" }\n" + |
17213 |
" }\n" + |
17227 |
" }\n" + |
17214 |
" }\n" + |
17228 |
"}\n" + |
17215 |
"}\n" + |
17229 |
"class Y{\n" + |
17216 |
"class Y{\n" + |
Lines 17643-17649
public void testBug247564m() {
Link Here
|
17643 |
this.runNegativeTest( |
17630 |
this.runNegativeTest( |
17644 |
new String[] { |
17631 |
new String[] { |
17645 |
"X.java", |
17632 |
"X.java", |
17646 |
"class MyException extends Exception{}" + |
17633 |
"class MyException extends Exception{}\n" + |
17647 |
"public class X {\n" + |
17634 |
"public class X {\n" + |
17648 |
" private Object f;\n" + |
17635 |
" private Object f;\n" + |
17649 |
" void gooCalls() throws MyException{}\n" + |
17636 |
" void gooCalls() throws MyException{}\n" + |
Lines 17660-17670
public void testBug247564m() {
Link Here
|
17660 |
"}\n"}, |
17647 |
"}\n"}, |
17661 |
"----------\n" + |
17648 |
"----------\n" + |
17662 |
"1. WARNING in X.java (at line 1)\n" + |
17649 |
"1. WARNING in X.java (at line 1)\n" + |
17663 |
" class MyException extends Exception{}public class X {\n" + |
17650 |
" class MyException extends Exception{}\n" + |
17664 |
" ^^^^^^^^^^^\n" + |
17651 |
" ^^^^^^^^^^^\n" + |
17665 |
"The serializable class MyException does not declare a static final serialVersionUID field of type long\n" + |
17652 |
"The serializable class MyException does not declare a static final serialVersionUID field of type long\n" + |
17666 |
"----------\n" + |
17653 |
"----------\n" + |
17667 |
"2. ERROR in X.java (at line 11)\n" + |
17654 |
"2. ERROR in X.java (at line 12)\n" + |
17668 |
" f.toString();\n" + |
17655 |
" f.toString();\n" + |
17669 |
" ^\n" + |
17656 |
" ^\n" + |
17670 |
"Potential null pointer access: The field f may be null at this location\n" + |
17657 |
"Potential null pointer access: The field f may be null at this location\n" + |