Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336782 - [1.7][recovery]Extra error tokens with invalid unary operator
Summary: [1.7][recovery]Extra error tokens with invalid unary operator
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-10 01:56 EST by Ayushman Jain CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:


Attachments
Patch (849 bytes, patch)
2011-02-18 04:52 EST, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-02-10 01:56:02 EST
The following code snippet gives some extra error diagnostics when compiled in BETA_JAVA7 branch, as compared to when compiled with HEAD

public class GlobalVariables_1 {
	public static Object o;
	public static int i;
	static {
		try {
			o= new Object();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		try {
			i= (1 + 1) *
                       (1 ++ 2);
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}
}

Extra errors are:
Pb(240) Syntax error, insert "}" to complete Block
Pb(240) Syntax error, insert "Finally" to complete TryStatement
Pb(235) Syntax error on token "1", invalid (
Pb(240) Syntax error, insert ";" to complete BlockStatements

This is illustrated by the failing test org.eclipse.jdt.core.tests.eval.NegativeVariableTest.testInitializerProblem() in BETA_JAVA7 branch.
Comment 1 Satyam Kandula CLA 2011-02-18 04:52:36 EST
Created attachment 189259 [details]
Patch

One new 1.7 grammar rule (CatchType ::= DisjunctiveType) get used also on 1.5, but their compliance in the grammar file has 1.7, causing the recovery to assume that it is illegal and thus the tests were failing.

Removed the compliance for this rule and other rule where the compliance was added 1.5, though it would get used in 1.3 too.
Comment 2 Satyam Kandula CLA 2011-02-18 04:55:30 EST
Released the grammar changes and the resource file that got updated on the java7 branch.
Comment 3 Ayushman Jain CLA 2011-06-29 06:08:57 EDT
Verified using Eclipse Java 7 Support(Beta) feature patch v20110623-0900.