Community
Participate
Working Groups
Build N20050505 On following testcase with extra semicolon after annotation, many misleading syntax errors are diagnosed. import java.io.Serializable; import java.util.List; import java.util.Vector; public class X { @SuppressWarnings( { "deprecation",//$NON-NLS-1$ "finally",//$NON-NLS-1$ "unchecked"//$NON-NLS-1$ }) public static void main(String[] args) { //W.deprecated(); List<X> l = new Vector(); l.size(); try { // do nothing } finally { throw new Error(); } Zork z; } // not ready yet: field support @SuppressWarnings("unchecked");//$NON-NLS-1$ List<X> l = new Vector(); @SuppressWarnings("serial")//$NON-NLS-1$ class S implements Serializable { String dummy; } }
Severity Description Resource In Folder Location Creation Time 2 Syntax error on tokens, delete these tokens X.java Crap/src line 6 May 6, 2005 8:24:06 PM 2 Zork cannot be resolved to a type X.java Crap/src line 19 May 6, 2005 8:24:06 PM 2 Return type for the method is missing X.java Crap/src line 23 May 6, 2005 8:24:06 PM 2 Syntax error on token ""unchecked"", delete this token X.java Crap/src line 23 May 6, 2005 8:24:06 PM 2 Syntax error on token ")", { expected after this token X.java Crap/src line 23 May 6, 2005 8:24:06 PM 2 Syntax error on token "@", } expected X.java Crap/src line 23 May 6, 2005 8:24:06 PM
+1 for RC2
Fixed and test added AnnotationDietRecoveryTest#test0009() There are several problems in this bug report a first one with @SuppressWarnings( { "deprecation",//$NON-NLS-1$ "finally",//$NON-NLS-1$ "unchecked"//$NON-NLS-1$ }) public static void main(String[] args) { //W.deprecated(); List<X> l = new Vector(); l.size(); try { // do nothing } finally { throw new Error(); } Zork z; } and a second one with @SuppressWarnings("serial")//$NON-NLS-1$ class S implements Serializable { String dummy; } Only the second one is fixed, i fill another bug report for the first problem (bug 99150)
New errors are Severity Description Resource In Folder Location Creation Time 2 Syntax error on tokens, delete these tokens Test.java Crap line 8 June 9, 2005 4:12:38 PM 2 Syntax error, insert "EnumBody" to complete EnumDeclaration Test.java Crap line 13 June 9, 2005 4:12:38 PM 2 Syntax error, insert "enum Identifier" to complete EnumHeaderName Test.java Crap line 13 June 9, 2005 4:12:38 PM
Verified that the new list of errors looks like comment 5. But I don't understand the first error: 2 Syntax error on tokens, delete these tokens Test.java Crap line 8 June 9, 2005 4:12:38 PM This is perfectly fine. If you remove the ';', this error is gone. So it looks like this is unrelated. Verified in N20050609-0010 + JDT/Core HEAD. David, please comment why the first error occurs.
The first error is caused by bug 99150
Verified in I20050610-0010.