Bug 24498

Summary: Duplicate entries on classpath cause CP marker to no longer refresh
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2002-10-08 09:06:20 EDT
20021001

In presence of duplicate entries on the CP, there seem to be little/no refresh 
of the CP markers.

auto-build is off.

e.g.
1. create project P with src source folder.

2. edit its .classpath file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="src2"/>
    <classpathentry kind="src" path="src3"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

3. observe 2 errors are signaled (missing src2 and src3)

4. revert .classpath file to initial content
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

5. observe the CP marker go away

6. now change the .classpath file as follows
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="src3"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

7. observe no CP marker is generated (should be a duplicate one and still 
missing src3).

=======
When forcing manual build actions, symptoms are changing a little bit, but 
still not satisfactory.
Comment 1 Jerome Lanneluc CLA 2002-10-08 11:53:20 EDT
You get the following stack trace on step 6:
!ENTRY org.eclipse.jdt.core 4 4 Oct 08, 2002 18:17:33.87
!MESSAGE Could not set classpath for /Test
!STACK 1
Java Model Exception: Java Model Status [Cannot nest entry /Test/src inside 
entry /Test/src.]
        at org.eclipse.jdt.internal.core.JavaModelOperation.execute
(JavaModelOperation.java:322)
        at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:620)
        at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1378)
        at org.eclipse.jdt.internal.core.JavaElement.runOperation
(JavaElement.java:563)
        at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath
(JavaProject.java:2238)
        at 
org.eclipse.jdt.internal.core.DeltaProcessor.reconcileClasspathFileUpdate
(DeltaProcessor.java:1293)
        at org.eclipse.jdt.internal.core.DeltaProcessor.performPreBuildCheck
(DeltaProcessor.java:1106)
        at org.eclipse.jdt.internal.core.DeltaProcessor.performPreBuildCheck
(DeltaProcessor.java:1120)
        at org.eclipse.jdt.internal.core.DeltaProcessor.performPreBuildCheck
(DeltaProcessor.java:1120)
        at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged
(DeltaProcessor.java:1429)
        at org.eclipse.core.internal.events.NotificationManager$1.run
(NotificationManager.java:128)
        at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:839)
        at org.eclipse.core.runtime.Platform.run(Platform.java:413)
        at org.eclipse.core.internal.events.NotificationManager.notify
(NotificationManager.java:143)
        at org.eclipse.core.internal.events.NotificationManager.broadcastChanges
(NotificationManager.java:67)
        at org.eclipse.core.internal.resources.Workspace.broadcastChanges
(Workspace.java:133)
        at org.eclipse.core.internal.resources.Workspace.endOperation
(Workspace.java:742)
        at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1383)
        at org.eclipse.ui.actions.WorkspaceModifyOperation.run
(WorkspaceModifyOperation.java:78)
        at org.eclipse.ui.texteditor.AbstractTextEditor.performSaveOperation
(AbstractTextEditor.java:2413)
        at org.eclipse.ui.texteditor.AbstractTextEditor.doSave
(AbstractTextEditor.java:2267)
        at org.eclipse.ui.internal.EditorManager$11.run(EditorManager.java:1005)
        at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:874)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:299)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249)
        at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:394)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
        at org.eclipse.jface.window.ApplicationWindow.run
(ApplicationWindow.java:391)
        at org.eclipse.ui.internal.WorkbenchWindow.run
(WorkbenchWindow.java:1117)
        at org.eclipse.ui.internal.EditorManager.runProgressMonitorOperation
(EditorManager.java:880)
        at org.eclipse.ui.internal.EditorManager.saveEditor
(EditorManager.java:1010)
        at org.eclipse.ui.internal.WorkbenchPage.saveEditor
(WorkbenchPage.java:2012)
        at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:749)
        at 
org.eclipse.ui.internal.registry.AcceleratorScope$AcceleratorAction.run
(AcceleratorScope.java:289)
        at org.eclipse.ui.internal.registry.AcceleratorScope.processKey
(AcceleratorScope.java:249)
        at org.eclipse.ui.internal.KeyBindingMenu$3.handleEvent
(KeyBindingMenu.java:90)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1272)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:1255)
        at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
        at org.eclipse.core.launcher.Main.run(Main.java:703)
        at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 2 Jerome Lanneluc CLA 2002-10-11 04:59:49 EDT
First problem was with JavaConventions.validateClasspath() that returned the 
wrong status for duplicate entries ("Cannot nest entry" instead of "Name 
collision").

Second problem was that DeltaProcessor.reconcileClasspathFileUpdate() was not 
handling the JavaModelException correctly. It now creates a marker and don't 
log the exception.

Added regression test ClasspathTests.testDuplicateEntries()
Comment 3 David Audel CLA 2002-10-17 10:28:05 EDT
Verified.