The recovery logic applied when 'catch' is found w/o a matching 'try' is too weak and leads to confusing error messages, especially when lambda expression support is enabled. class Test { void test() { catch(Exception e) { e.printStackTrace(); } } } produces the following errors: Test.java:984: error: 'catch' without 'try' catch(Exception e) { e.printStackTrace(); } ^ Test.java:984: error: lambda expressions are not supported in -source 1.8 catch(Exception e) { e.printStackTrace(); } ^ (use -source 8 or higher to enable lambda expressions) Test.java:984: error: -> expected catch(Exception e) { e.printStackTrace(); } ^ Test.java:984: error: not a statement catch(Exception e) { e.printStackTrace(); } ^ Test.java:984: error: ';' expected catch(Exception e) { e.printStackTrace(); } ^
|