Community
Participate
Working Groups
Build 20040513 Compiling the following test case in 1.5 mode issues numerous syntax errors, where there is only one missing semicolon (at end of Local innerclass declaration). public class X { public <T> X(T t){ System.out.println(t); } } public static void main(String[] args) { class Local extends X { Local() { <String>super("SUCCESS"); } } new Local(); } } "----------\n" + "1. ERROR in X.java (at line 6)\r\n" + " public static void main(String[] args) {\r\n" + " ^^^^\n" + "Syntax error on token \"void\", AT expected\n" + "----------\n" + "2. ERROR in X.java (at line 6)\r\n" + " public static void main(String[] args) {\r\n" + " ^\n" + "Syntax error on token \"]\", invalid (\n" + "----------\n" + "3. ERROR in X.java (at line 6)\r\n" + " public static void main(String[] args) {\r\n" + " ^\n" + "Syntax error, insert \"]\" to complete ArrayAccess\n" + "----------\n" + "4. ERROR in X.java (at line 6)\r\n" + " public static void main(String[] args) {\r\n" + " ^\n" + "Syntax error, insert \")\" to complete SingleMemberAnnotation\n" + "----------\n" + "5. ERROR in X.java (at line 6)\r\n" + " public static void main(String[] args) {\r\n" + " ^\n" + "Syntax error, insert \"enum Identifier\" to complete EnumHeader\n" + "----------\n" + "6. ERROR in X.java (at line 14)\r\n" + " }\r\n" + " ^\n" + "Syntax error on token \"}\", delete this token\n" + "----------\n"
Actually, there is also an extra closing curly brace at end of generic constructor X<T>. Still syntax errors are a bit cryptic.
There is no missing semicolon inside this test case. Fixed and tests added DietRecoveryTest#test111() ComplianceDiagnoseTest#test0044() ComplianceDiagnoseTest#test0045() Fix is inside RecoveredUnit#add(AbstractMethodDeclaration,int). An Initializer is added when an extra closing curly brace is detected.
Verified in I200409240100.