Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Syntax Error, parameterized types are only if source level is 1.5

Tags:

java

eclipse

I try to use the following code:

ArrayList<String> Map<String, String> 

Eclipse complains about both of them: Syntax Error, parameterized types are only if source level is 1.5.

I use JDK 1.6, but even if I go to compiler and switch the compliance to 1.5. It still give me this error. Any Idea why?

like image 932
Thang Pham Avatar asked Mar 10 '10 17:03

Thang Pham


2 Answers

This workaround is helpful when this problem pops up.

1) Set Workspace JRE to 1.5 (and apply/save). Projects will rebuild.

2)Set Workspace JRE back to 1.6 (and apply/save). Projects will rebuild.

All errors are then gone (for now at least).

like image 76
Chris Blyseth Avatar answered Oct 08 '22 11:10

Chris Blyseth


It can be resolved as follows:

  1. Go to Project properties.

  2. Then 'Java Compiler' -> Check the box ('Enable project specific settings')

  3. Change the compiler compliance level to '5.0' & click ok.

Do rebuild. It will be resolved.

Also, click the checkbox for "Use default compliance settings".

like image 34
VigneshKumar S Avatar answered Oct 08 '22 11:10

VigneshKumar S