Bug 384320 - [1.8][compiler] Syntax error while mixing type annotations & reference expressions.
Summary: [1.8][compiler] Syntax error while mixing type annotations & reference expres...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: BETA J8   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 380188
  Show dependency tree
 
Reported: 2012-07-05 01:17 EDT by Srikanth Sankaran CLA
Modified: 2012-07-05 03: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 Srikanth Sankaran CLA 2012-07-05 01:17:00 EDT
BETA_JAVA8:

The following contrived test case refuses to compile and we get 
"Syntax error on token "X", . expected after this token"

// ----------------------
interface I {
	void foo(X<String> s, int x);
}

@Foo({"hello"}) 
public class X<T> {
	I i = X<@Foo({"hello"}) String>::foo;
	void foo(int x) {
		
	}
}

@interface Foo {
	String [] value();
}

It should compile. The problem comes from the black list strategy used
in the scanner to bound look ahead. It incorrectly assumes that the
tokens '{' and '}' cannot feature in type arguments, but they can as
this example shows. We need to choose the black list with more rigor
if we want to use it at all.