Bug 93975 - [1.5][syntax] Poor recovery when extra semicolon in annotation
Summary: [1.5][syntax] Poor recovery when extra semicolon in annotation
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-06 14:27 EDT by Philipe Mulet CLA
Modified: 2005-06-10 12:13 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2005-05-06 14:27:14 EDT
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;
	}
}
Comment 1 Philipe Mulet CLA 2005-05-06 14:27:54 EDT
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
Comment 2 Philipe Mulet CLA 2005-06-09 09:52:34 EDT
+1 for RC2
Comment 3 Philipe Mulet CLA 2005-06-09 09:52:47 EDT
+1 for RC2
Comment 4 David Audel CLA 2005-06-09 10:10:51 EDT
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)
Comment 5 David Audel CLA 2005-06-09 10:15:36 EDT
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
Comment 6 Olivier Thomann CLA 2005-06-09 10:42:42 EDT
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.
Comment 7 David Audel CLA 2005-06-09 10:47:45 EDT
The first error is caused by bug 99150
Comment 8 Olivier Thomann CLA 2005-06-10 12:13:03 EDT
Verified in I20050610-0010.