Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

java - The type Collection is not generic; it cannot be parameterized with arguments <? extends E>

I have a strange problem with Eclipse Galileo.
I set Java 1.6 as my JRE. On this line of code

List templates = new ArrayList ();

I see the following error in Eclipse's problem list:

The type Collection is not generic; it cannot be parameterized with arguments

I don't have any problems with building this project with Ant.
How can I fix it? Looks like it is an Eclipse problem, but because of this error, I can't compile/publish my project from the IDE.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What List are you importing? (see this thread from 2006)

java.awt.List or java.util.List?

Because, as eclipse aptly comments, java.awt.List is not parameterized ;)


Check also the

  • Java Build path: it must not contain a reference to the J2SE 1.4.2 libraries.
  • Source Compatibility: project properties -> Java Compiler Settings, Source Compatibility 5.0 or 6.0.

Other than that, there was lots of issue back in 2005 when the latest Eclipse 3.1 beta was supporting J2SE5, but this was fixed since then.

Try tyo use the latest JDK6 in your project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...