Bug 172345

Summary: [model][delta] path error markers are not regenerated on project rebuild
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jerome_lanneluc
Version: 3.3   
Target Milestone: 3.3 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fixed, non definitive test cases
none
Proposed patch
none
Additional patch to fix problem with workspace preferences none

Description Markus Keller CLA 2007-01-31 12:48:42 EST
I20061214-1445 (3.3M4), same in HEAD

Steps in M4:
- new workspace
- create new Java Project
- add this line to .classpath and save:
	<classpathentry kind="var" path="JUNIT_HOME/junit.jarXXX"/>

=> Build path error marker is generated: "Project J is missing required library: 'C:\e\i\I20061214-1445-clean\plugins\org.junit_3.8.2\junit.jarXXX'"

- project properties > Java Compiler > Building
- enable project specific settings
- set "Incomplete build path:" to Warning
- OK
- Yes (do a rebuild)

=> Marker has still Error severity, even after Project > Clean
Expected: severity should change to Warning

- close project and reopen

=> Marker has correct severity now

I realized this when I tested Frederic's fix for bug 172207 via hot code replace. Users may find it hard to find out what's wrong when Clean does not clean everything.

Bug 159452 and/or bug 154479 could be related.
Comment 1 Maxime Daniel CLA 2007-02-01 09:16:22 EST
Reproduced with I20070130-0800.
Comment 2 Maxime Daniel CLA 2007-02-02 05:33:12 EST
Released inactive test cases BuildpathTests#_testMissingLibrary3 and 4.
Comment 3 Maxime Daniel CLA 2007-02-05 05:18:33 EST
Created attachment 58245 [details]
Fixed, non definitive test cases

This patch fixes the test cases added to BuildpathTests so that they pass without changing the code. However, I believe this is not what we want to do (see further discussion below).
Comment 4 Maxime Daniel CLA 2007-02-05 05:26:09 EST
Frédéric, I believe that DeltaProcessor#validateClasspaths should detect that a change to <project>/.settings/org.eclipse.jdt.core.prefs may imply changes to the classpath and generate appropriate deltas, as it does when finding a change to .classpath (DeltaProcessor:2183 in head). Beware that it currently cuts the recursion upon .settings itself.
Comment 5 Frederic Fusier CLA 2007-02-09 13:01:26 EST
Created attachment 58674 [details]
Proposed patch

I have included Maxime's tests and they pass with this patch.
Jerome, what's your mind about this fix?
Comment 6 Frederic Fusier CLA 2007-02-09 14:41:58 EST
All JDT/Core Builder and Model tests also pass with this patch.
Of course, scenario described in comment 0 also passes with it... :-)

Note that with this change, DeltaProcessor will validate the classpath each time the compiler settings is modified. Perhaps, one can perform a more fine grain refresh while adding preference change listeners to JavaProject and only react on build preferences changes... I'll investigate this point and try to see if it's feasible.
Comment 7 Frederic Fusier CLA 2007-02-11 05:04:21 EST
There's already preferences listeners on JavaCore and JavaProject. However, as they both do not know the DeltaProcessingState, there's no easy way to validate classpath from there. So, the proposed fix is the best I can see for now.
Note also that it will also fix bug 75471...
Comment 8 Frederic Fusier CLA 2007-02-11 06:32:59 EST
(In reply to comment #7)
> Note also that it will also fix bug 75471...
> 
Added test case (see bug 75471 comment 10) shows that this assumption was wrong...

Comment 9 Frederic Fusier CLA 2007-02-19 12:28:23 EST
Released for 3.3 M6 in HEAD stream.
Comment 10 Frederic Fusier CLA 2007-02-20 03:57:23 EST
*** Bug 92614 has been marked as a duplicate of this bug. ***
Comment 11 Frederic Fusier CLA 2007-02-21 09:18:46 EST
Reopen this bug for 2 reasons:
1) Some tests added in BuildpathTests failed in integration build I20070220-0800
2) The fix does not work when workspace preferences are changed...
Comment 12 Frederic Fusier CLA 2007-02-27 07:03:28 EST
Created attachment 59863 [details]
Additional patch to fix problem with workspace preferences

I also did not see any new failures while looking at nightly builds tests log. So, I consider the tests problem also fixed, but still keep them as safe for a while to be 100% sure of this...
Comment 13 Frederic Fusier CLA 2007-02-27 07:04:12 EST
Additional patch released for 3.3 M6 in HEAD stream.
Comment 14 Olivier Thomann CLA 2007-03-20 09:27:01 EDT
Verified for 3.3 M6 using build I20070320-0010