Bug 168565 - Eclipse finds errors where there are none
Summary: Eclipse finds errors where there are none
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Linux-GTK
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
: 318276 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-19 10:54 EST by mpriors CLA
Modified: 2010-06-29 10:52 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mpriors CLA 2006-12-19 10:54:35 EST
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.
Comment 1 Kent Johnson CLA 2006-12-19 13:45:43 EST
We'll need a testcase.

Can you please attach the source projects?
Comment 2 Olivier Thomann CLA 2006-12-19 17:15:44 EST
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.
Comment 3 mpriors CLA 2006-12-20 08:35:05 EST
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.
Comment 4 Olivier Thomann CLA 2006-12-20 15:04:07 EST
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?
Comment 5 Kent Johnson CLA 2006-12-20 15:39:34 EST
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?
Comment 6 Denis Roy CLA 2009-08-30 02:06:45 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 7 Srikanth Sankaran CLA 2010-06-29 10:52:56 EDT
*** Bug 318276 has been marked as a duplicate of this bug. ***