Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 507-511
Link Here
|
507 |
"The local variable error6 may not have been initialized\n" + |
507 |
"The local variable error6 may not have been initialized\n" + |
508 |
"----------\n"); |
508 |
"----------\n"); |
509 |
} |
509 |
} |
510 |
|
510 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 |
|
|
511 |
public void test018() { |
512 |
this.runNegativeTest(new String[] { |
513 |
"X.java", |
514 |
"public class X {\n" + |
515 |
" static final int i;\n" + |
516 |
" static {\n" + |
517 |
" assert (i = 0) == 0;\n" + |
518 |
" System.out.println(i);\n" + |
519 |
" }\n" + |
520 |
"}" |
521 |
}, |
522 |
"----------\n" + |
523 |
"1. ERROR in X.java (at line 2)\n" + |
524 |
" static final int i;\n" + |
525 |
" ^\n" + |
526 |
"The blank final field i may not have been initialized\n" + |
527 |
"----------\n" + |
528 |
"2. ERROR in X.java (at line 5)\n" + |
529 |
" System.out.println(i);\n" + |
530 |
" ^\n" + |
531 |
"The blank final field i may not have been initialized\n" + |
532 |
"----------\n"); |
533 |
} |
534 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 |
535 |
public void test019() { |
536 |
this.runConformTest(new String[] { |
537 |
"X.java", |
538 |
"public class X {\n" + |
539 |
" static final int i;\n" + |
540 |
" static {\n" + |
541 |
" i = 0;\n" + |
542 |
" assert i == 0;\n" + |
543 |
" System.out.println(i);\n" + |
544 |
" }\n" + |
545 |
"}" |
546 |
}, |
547 |
""); |
548 |
} |
549 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 |
550 |
public void test020() throws Exception { |
551 |
this.runNegativeTest( |
552 |
new String[] { |
553 |
"X.java", |
554 |
"public class X {\n" + |
555 |
" void method1() {\n" + |
556 |
" int i;" + |
557 |
" assert (i = 0) == 0;\n" + |
558 |
" System.out.println(i);\n" + |
559 |
" }\n" + |
560 |
"}\n" |
561 |
}, |
562 |
"----------\n" + |
563 |
"1. ERROR in X.java (at line 4)\n" + |
564 |
" System.out.println(i);\n" + |
565 |
" ^\n" + |
566 |
"The local variable i may not have been initialized\n" + |
567 |
"----------\n"); |
568 |
} |
569 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 |
570 |
public void test021() throws Exception { |
571 |
this.runNegativeTest( |
572 |
new String[] { |
573 |
"X.java", |
574 |
"public class X {\n" + |
575 |
" public int bar() {\n" + |
576 |
" return 1;\n" + |
577 |
" }\n" + |
578 |
" void method1() {\n" + |
579 |
" int i;" + |
580 |
" assert (i = this.bar()) == 0;\n" + |
581 |
" System.out.println(i);\n" + |
582 |
" }\n" + |
583 |
"}\n" |
584 |
}, |
585 |
"----------\n" + |
586 |
"1. ERROR in X.java (at line 7)\n" + |
587 |
" System.out.println(i);\n" + |
588 |
" ^\n" + |
589 |
"The local variable i may not have been initialized\n" + |
590 |
"----------\n"); |
591 |
} |
592 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 |
593 |
public void test022() throws Exception { |
594 |
this.runNegativeTest( |
595 |
new String[] { |
596 |
"X.java", |
597 |
"public class X {\n" + |
598 |
" public int bar() {\n" + |
599 |
" return 1;\n" + |
600 |
" }\n" + |
601 |
" void method1() {\n" + |
602 |
" int i;\n" + |
603 |
" assert i++ == 0;\n" + |
604 |
" System.out.println(i);\n" + |
605 |
" }\n" + |
606 |
"}\n" |
607 |
}, |
608 |
"----------\n" + |
609 |
"1. ERROR in X.java (at line 7)\n" + |
610 |
" assert i++ == 0;\n" + |
611 |
" ^\n" + |
612 |
"The local variable i may not have been initialized\n" + |
613 |
"----------\n" + |
614 |
"2. ERROR in X.java (at line 8)\n" + |
615 |
" System.out.println(i);\n" + |
616 |
" ^\n" + |
617 |
"The local variable i may not have been initialized\n" + |
618 |
"----------\n"); |
619 |
} |
511 |
} |
620 |
} |