Community
Participate
Working Groups
Created attachment 241849 [details] Workaround in ASTRewriteAnalyzer For this example from bug 338785 comment 0, the parser inserts a fake 'finally' block: import java.io.File; public class CLAZZ { public void method() { try { //press Ctrl + 1 on try to view quickfix, you can remove try block but can not add finally File f = new File("c:\testfile"); f.createNewFile(); // throws IOException, which means I want/have to add finally block } // Error is on this line } } Is the fake node really necessary? I wonder if bug 143001 would not better be implemented by changing line TryStatement ::= 'try' TryBlock Catches in java.g to TryStatement ::= 'try' TryBlock CatchesOpt and then reporting the syntax error manually when the TryStatement is missing catch and finally. The fake 'finally' block is problematic for ASTRewrite, since it assumes the 'finally' keyword is already there in source. When we try to set a real 'finally' block, then the keyword is still missing. If the better recovery suggested above doesn't work out, then a workaround could be to fix the problem in ASTRewriteAnalyzer, see attached patch.
This blocks bug 338785. Would be good to have a fix early in Mars, so that we have more time to find regressions that may arise from the grammar change (and avoid trouble like bug 430336).
Manoj, please take a look. Please check with Srikanth on feasibility of the grammar change.
Sasi: Could you please comment on the grammar change?
(In reply to comment #3) > Sasi: Could you please comment on the grammar change? I can confirm that the suggested grammar change works. Yet to look at the reporting syntax error later part.
This got missed out in the early Mars releases. Wouldn't want a grammar change at this stage[see comment 1 as well]. Will aim for early 4.6.
To be targetted for 4.7M1
Moving out to early 4.8
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.