Bug 15168 - circular errors not reported
Summary: circular errors not reported
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-03 02:55 EDT by John Wiegand CLA
Modified: 2002-05-07 09:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Wiegand CLA 2002-05-03 02:55:32 EDT
(patched) M5

Not reproducable:

I added several projects and ended up with a cycle that was not reported.
Guess: A second error caused us not to update markers. (working on a test case)

Simple test case that causes the opposite problem (left over cycle markers when 
there is no cycle)
1. Create a project A.
2. Create a project B with A on its classpath.
3. Add B to A's classpath.
now you have a cycle.
4. Delete A.
now the cycle is gone, but the cycle marker is still on project B
Comment 1 Philipe Mulet CLA 2002-05-03 03:20:56 EDT
We have noticed defficiencies in cycle detection around M5 due to some 
optimizations which didn't work. Should be fixed in 20020501.

Comment 2 Philipe Mulet CLA 2002-05-03 04:27:07 EDT
In 20020501 (and 0502), we issue too many cycle markers (see bug 15091).
This is been resolved in latest.
Comment 3 Philipe Mulet CLA 2002-05-03 06:55:11 EDT
Fixed
Comment 4 John Wiegand CLA 2002-05-03 20:51:48 EDT
I can still reproduce both my problem (and the simple test case below).
I will try to provide a reasonably sized test case by Monday.
Comment 5 Jerome Lanneluc CLA 2002-05-04 12:03:45 EDT
I was able to reproduce the simple test case. This is due to the fact that 
JavaProject.updateAllCycleMerkers() doesn't check if the project is being 
deleted.

Another test case that causes cycle markers not to be reported is:
1. Create project B with A on its classpath (but A does not exist yet)
2. Create project A with B on its classpath (it has to be done in one operation)
The cycle on B is reported, but it is not reported on A.
This is because JavaProject.updateAllCycleMarkers() doesn't consider A since it 
is not in the Java model yet.
Comment 6 John Wiegand CLA 2002-05-04 13:57:04 EDT
I believe I have discovered a more serious limitation.
If the java core plugin is not loaded in advance of the project changes, 
circularities will not be detected.

Test case:
1. create a java project A that has B on its classpath and B that has A on its 
classpath.   Create these projects in a directory c:\test (outside the 
workspace).
2, start a new workspace. TURN AUTOBUILD OFF.
Do not go to the java perspective - do nothing except the steps mentioned 
below. Stay in the resource perspective.
3. Import external project A.
4. Import external project B
5. Press build.

No circularities are detected.  If you now alter the preoject dependency graph 
further, problems will be discovered.
Comment 7 John Wiegand CLA 2002-05-04 14:01:18 EDT
I just reproduced this will autobuild on.  I am still missing something.
Comment 8 Jerome Lanneluc CLA 2002-05-05 11:35:30 EDT
I cannot reproduce the last test case with autobuild off: before I press build, 
no cycles are reported (expected since jdt core is not loaded), and after I 
press build the cycle is reported on both projects A and B.

With autobuild on, I can reproduce. Here is what I see:
- when importing A: the same 2 markers are created. They both indicate that B 
is missing. 
- when importing B: the 2 above markers are removed, but no cycle markers are 
created.
Comment 9 John Wiegand CLA 2002-05-05 23:27:04 EDT
I missed one key point (entirely unintentionally).  Almost the same test case - 

1. create a java project A that has B on its classpath and B that has A on its 
classpath.   Create these projects in a directory c:\test (outside the 
workspace).
2, start a new workspace. Do not go to the java perspective - do nothing except 
the steps mentioned below. Stay in the resource perspective.
3. (MISSING STEP) Define a classpath variable JUNK (value = c:\temp).
4. Import external project A.
5. Import external project B

Step 3 shouldn't make a difference - it isn't used, but it does.  My earlier 
test used an empty workspace with classpath variables defined - that is why it 
allowed me to reproduce the steps.
Comment 10 Philipe Mulet CLA 2002-05-06 05:40:40 EDT
Problem is that when jdt/core is started, we no longer have a delta indicating 
a project was added. Thus we will not trigger a cycle marker check.

We could defensively force a cycle marker update on plugin startup, but this 
would still not be optimal in so far as markers would not appear until you 
create the variable. Where they should show up at the moment the projects are 
brought in (problem similar to inconsistent initialization of JRE_LIB var when 
activating the Jdt/UI - we did introduce a mechanism for allowing early 
activation of classpath variable initializer).

I am not getting why the import of Java projects did not trigger the activation 
of the Jdt/core plugin. If I am building, then yes it will be loaded due to the 
Java builder activation, so why not loading Jdt/Core initially ?
Comment 11 Jerome Lanneluc CLA 2002-05-06 12:56:02 EDT
I assume John's steps are still with autobuild off. In this case, I see only 
one project with a cycle marker, the other one is missing a cycle marker.
Comment 12 Jerome Lanneluc CLA 2002-05-06 13:11:15 EDT
Note that when the JUNK variable is created, jdtcore is started and we listen 
for changes thereafter.
Comment 13 Jerome Lanneluc CLA 2002-05-06 17:38:51 EDT
Fixed the first test cases by updating the java model (i.e. by adding/removing 
projects to/from their parent) before the updateCycleMarkers is called. 

Also keep the list of projects before processing the delta. This list is used 
by the delta processor to find out if a project was a java project before.
Comment 14 Jerome Lanneluc CLA 2002-05-07 09:53:42 EDT
Updating cycle markers on plugin startup will be reviewed post 2.0, unless this 
become critical.