Community
Participate
Working Groups
try{ return 10; } catch (Exception e) { e.printStackTrace(); } Ends up with the following error Evaluation failed. Reason(s): Syntax error, insert ";" to complete BlockStatements Using this try{ return 10; } catch (Exception e) { } will ends up in Evaluation failed. Reason(s): Syntax error on token "return", delete this token
I will have look at this bug for next release if current release is too late.
The main issue is https://bugs.eclipse.org/bugs/show_bug.cgi?id=571219, if we fixed this issue i don't see a real need for try-catch. But i will keep the issue open in case someone can point of a good use case.
(In reply to Gayan Perera from comment #2) > The main issue is https://bugs.eclipse.org/bugs/show_bug.cgi?id=571219, if > we fixed this issue i don't see a real need for try-catch. But i will keep > the issue open in case someone can point of a good use case. I am not sure if the reason is this. The error what we are getting here is when JDT Core parses this code unit.
I tried it and seems like its not parsing only. We don’t have support for instructions as well.
(In reply to Gayan Perera from comment #4) > I tried it and seems like its not parsing only. We don’t have support for > instructions as well. what do you mean by not parsing only? I observe that CompilationUnit created comes with 2 problems in org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.parseCompilationUnit(char[], String, IJavaProject, Map<String, String>)
Yes there is parsing issue at that place as well. But for some reason when i wrote a test for this, it actually got parsed and when into AST visitor which construct instructions. And for try catch we throw out saying we don’t support at visiting phase.
After the new patch you can see we get this error: Try statement cannot be used in an evaluation expression https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/176435/5
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. If you have further information on the current state of the bug, please add it. 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.