Skip to content

Commit 38cf97c

Browse files
mickaelistriarobstryker
authored andcommitted
Better handle incomplete try/catch/finally
* Improve error mapping * Add recovered finally block when missing catch&finally
1 parent 4fc33b4 commit 38cf97c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,11 @@ private boolean matchesAlternateMessage(String original, String expected, int pr
10641064
return false;
10651065
case IProblem.NotAnnotationType:
10661066
return (arguments[0] + " is not an annotation type").equals(expected);
1067+
case IProblem.Syntax:
1068+
return original.equals(switch (expected) {
1069+
case "Syntax error, insert \"Finally\" to complete BlockStatements" -> "'try' without 'catch', 'finally' or resource declarations";
1070+
default -> "";
1071+
});
10671072
default:
10681073
return false;
10691074
}

0 commit comments

Comments
 (0)