Community
Participate
Working Groups
Build ID: M20060629-1905 Steps To Reproduce: I used ASTParser to parse a java file. When statements has some wrong syntax in a method,such as... 1.The statement has only one " . example: System.out.println("hello); 2.The statement has only one ' or a couple of ' are not follow syntax. example: System.out.println('a); System.out.println(''a); 3.The statement is begin with number+e . example: 7eSystem.out.println(); This method will be parsed a malformed MethodDeclaration object by ASTParser. I want to call MethodDeclaration.getBody() to get it's Block but return null. In other wrong syntax cases, they can still have Block. I know these all wrong syntax cases, but I have request to get their Blocks. More information:
If you enable the statement recovery, you get a body, but it is empty.
(In reply to comment #1) > If you enable the statement recovery, you get a body, but it is empty. I set ASTParser.setStatementsRecovery(true), but the result was the same. It's seems that those three types of syntax error statement can not be recoverd.
This bug is already fixed in the 3.4 stream. I close this bug as WORKSFORME. I added some regression tests: ASTConverterBugsTest#testBug215137a() -> testBug215137d()
Verified for 3.4M6 using I20080325-0100