Bug 31799 - Getting squigglies in Java files not on classpath
Summary: Getting squigglies in Java files not on classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 33005 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-13 13:08 EST by Andre Weinand CLA
Modified: 2003-03-11 06:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weinand CLA 2003-02-13 13:08:03 EST
I20030211
- load project "platform launcher" from dev.eclipse.org repository
- open file "Main.java"
Observe: lots of squigglies

I would expect not to get these kind of errors for files that are not on the class path.
Comment 1 Kai-Uwe Maetzel CLA 2003-02-26 13:42:01 EST
*** Bug 33005 has been marked as a duplicate of this bug. ***
Comment 2 Kai-Uwe Maetzel CLA 2003-03-03 13:13:15 EST
Follow the described scenario.

When looking into what happens the following truns out:

A compilation unit for Main.java is created using JavaCore.create(<file>);
Although the file is in a simple and not in a Java project, a package and a 
Java project are created for this compilation unit.

Creating a working copy of this compilation unit is also successful.

The reconciler works on this working copy and reports the found problems to 
the registered problem requestor. The problem requestor uses the following 
check to decide whether the reported problems should be considered at all:

ICompilationUnit unit= getWorkingCopy(...);
if (unit != null && unit.getJavaProject().isOnClasspath(unit))
   .. consider reported problems ....

In the given scenario this check is successful although it should not.

Increasing severity and moving to JDT Core.
Comment 3 Philipe Mulet CLA 2003-03-04 06:25:34 EST
Dirk, do you expect the working copy creation to be successfull in this 
scenario ? I am wondering if we should deny its creation alltogether. We do 
support some minimal editor behavior, but this is clearly going too far in this 
case. 
Comment 4 Philipe Mulet CLA 2003-03-04 06:31:06 EST
Ok, talking with Erich, I understand that you need working copies to be 
openable on any .java files anywhere in the workspace (no matter if 
inside/outside Java projects).

Definitely #isOnClasspath should behave correctly.
Comment 5 Philipe Mulet CLA 2003-03-04 07:30:06 EST
Problem is actually more subtle. The first call on #isOnClasspath does answer 
false, however other questions (getPreferences, getLastBuiltState) will cause a 
per project info to be cached into the manager. Thus, from thereon subsequent 
calls of isOnClasspath will misbehave (since it thinks it is a legite Java 
project, missing its .classpath file, thus defaulting to project src folder).

Note that performing a check on the fly in the problem requestor is likely a 
little expensive, why not caching this information upfront and never activating 
the problem requestor at all in this case ?
Comment 6 Philipe Mulet CLA 2003-03-04 07:47:29 EST
Fixed in latest
Comment 7 David Audel CLA 2003-03-11 06:22:45 EST
Verified.