Community
Participate
Working Groups
Description of problem: Eclipse highlights errors in valid java code. In java source file generated by JAXB, the very first line in the file is a single line comment, with no text: // This gets flagged with the message: "The type Collection is not generic; it cannot be parameterized with arguments <? extends E> If i delete this empty comment line and save the file eclipse then flags up the new top line (also a comment) with the same message. If I delete all the comment line at the top of the file and leave a blank line at the top, then the first line with content (the package statement) gets flagged. After I modify the file and save, and after all subsequent saves, addtional errors appear. These relate to eclipse not finding source files in the same directory/package as the source file. The project builds fine if I use NetBeans, or if I use ant from the command line. And has previously worked fine in eclipse. I am using: java-1.5.0-sun-1.5.0.09 (following are fedora core 6 rpms) eclipse-platform-3.2.1-23 eclipse-ecj-3.2.1-23 eclipse-rcp-3.2.1-23 eclipse-jdt-3.2.1-23 Ihave also reproduced the problem using eclipse 3.2.1 downloaded from the eclipse site. How reproducible: This happens every time i create a new project from my existing source, i have removed my ~/.eclipse and ~/workspace directories and started from fresh. Steps to Reproduce: 1. Create new Java Project from existing source 2. Select my source 3. See error Actual results: This seems to stop the build process, as it is the only Error or warning to appear. I know that there should be some warnings. If other files are modified they suddenly produce incorrect error messages. This really makes eclipse unusable. Expected results: Project builds.
We'll need a testcase. Can you please attach the source projects?
My guess is that you have 1.4 libraries on the classpath. Closing as REMIND. Please reopen when information requested in comment 1 and comment 2 are available.
Olivier, your guess was right - Thank you. A jar file (cryptix-jce-compat.jar) was defining java.util.Collection and appeared before the Java SDK in the classpath. Is there any way this problem could be better reported by eclipse? The current symptoms don't guide the average user towards the solution.
The problem is that as soon as a type is found (java.util.Collection in this case), the classpath is no longer searched. So the compiler doesn't "see" the second java.util.Collection defined in the 1.5 libraries. We might want to define a separate tool that would examine the whole classpath to find duplicates. I don't really see a way to do this from within the compiler. Kent, you might have a better idea?
We could add the declaring jar to the error message... but I'm not sure that would be enough to make the user notice the conflict. If the user tries to open the type Collection, he should see the multiple declarations. Do you see more than 1?
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
*** Bug 318276 has been marked as a duplicate of this bug. ***