Lines 479-482
Link Here
|
479 |
expectedSyntaxErrorDiagnosis, |
479 |
expectedSyntaxErrorDiagnosis, |
480 |
testName); |
480 |
testName); |
481 |
} |
481 |
} |
|
|
482 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210419 |
483 |
public void test15() { |
484 |
|
485 |
String s = |
486 |
"package bug;\n" + |
487 |
"public class Test {\n" + |
488 |
" static int X;\n" + |
489 |
" String field = { String str;\n" + |
490 |
" switch (X) {\n" + |
491 |
" case 0:\n" + |
492 |
" str = \"zero\";\n" + |
493 |
" break;\n" + |
494 |
" default:\n" + |
495 |
" str = \"other\";\n" + |
496 |
" break;\n" + |
497 |
" }\n" + |
498 |
" this.field = str;\n" + |
499 |
" };\n" + |
500 |
" public static void main(String[] args) {\n" + |
501 |
" System.out.println(new Test().field);\n" + |
502 |
" }\n" + |
503 |
"}\n"; |
504 |
|
505 |
String expectedSyntaxErrorDiagnosis = |
506 |
"----------\n" + |
507 |
"1. ERROR in <test> (at line 4)\n" + |
508 |
" String field = { String str;\n" + |
509 |
" ^^^^^^^^\n" + |
510 |
"Syntax error on token(s), misplaced construct(s)\n" + |
511 |
"----------\n" + |
512 |
"2. ERROR in <test> (at line 4)\n" + |
513 |
" String field = { String str;\n" + |
514 |
" ^\n" + |
515 |
"Syntax error on token \";\", { expected after this token\n" + |
516 |
"----------\n"; |
517 |
|
518 |
String testName = "<test>"; |
519 |
checkParse( |
520 |
s.toCharArray(), |
521 |
expectedSyntaxErrorDiagnosis, |
522 |
testName); |
523 |
} |
482 |
} |
524 |
} |