Bug 138372 - Java markers not removed when builder removed
Summary: Java markers not removed when builder removed
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-25 10:11 EDT by Ed Burnette CLA
Modified: 2009-08-30 02:39 EDT (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 Ed Burnette CLA 2006-04-25 10:11:18 EDT
3.2RC1
Create a Java project that has some errors in it, and you can see the markers in the editor and in the Problems views. Then right click on the project, select Properties > Builders, and turn off the Java Builder. Click OK. All the markers put in by the builder remain and there's no obvious way to get rid of them. I discovered this when trying to replace the Java Builder.

In lieu of a patch here's the fix. In org.eclipse.jdt.internal.core.JavaProject, the deconfigure() method, after the Java builder has been deregistered all the project markers it might have put there should be deleted. I'm not sure if this is the complete set of markers but it should be something like this:

public void deconfigure() throws CoreException {

   // deregister Java builder
   removeFromBuildSpec(JavaCore.BUILDER_ID);
+
+   // remove orphaned markers
+   this.project.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER,
+      true, IResource.DEPTH_INFINITE);
}
Comment 1 Philipe Mulet CLA 2006-04-25 10:39:46 EDT
+1 for 3.2RC2. 
Jerome - shouldn't it also clear all managed markers ?
Comment 2 Jerome Lanneluc CLA 2006-04-25 10:44:31 EDT
Yes, managed markers should be deleted as well as BUILD_PATH_PROBLEM_MARKERs and TASK_MARKERs.
Comment 3 Jerome Lanneluc CLA 2006-04-25 10:48:41 EDT
Actually, BUILD_PATH_PROBLEM_MARKERs are not created by the Java builder, and they should not be deleted. Since they indicate build path problems, they can have an impact on errors reported in the Java editor, independantly of the Java builder.
Comment 4 Jerome Lanneluc CLA 2006-04-25 13:07:05 EDT
Ed, deconfigure() is called only if the Java nature is removed from the project. 

Removing the Java builder does not call deconfigure(). It triggers an IResourceDelta which doesn't contain the information that the builder was removed, only that the project was changed. 

So the fix is not as simple as this. Also this is not a regression since this scenario was never supported in previous releases.

Propose to consider post 3.2. Is that ok with you ?
Comment 5 Philipe Mulet CLA 2006-04-25 13:20:13 EDT
Agree for deferring, this isn't an immediate/trivial fix and we are closing already.
Comment 6 Jerome Lanneluc CLA 2006-04-26 07:08:16 EDT
Will consider post 3.2. Workaround is to run Project > Clean (without building) before removing the Java builder.
Comment 7 Ed Burnette CLA 2006-04-26 10:58:24 EDT
Ah, you're right. It's ok to defer because I have a workaround. The workaround is that when I configure my own nature I'll remove the Java markers (because for my use case it doesn't make sense to have both the Java builder and my builder active at the same time).

And maybe for a more complete fix, each builder should register the markers or marker types it creates, so when builders are removed the markers could be removed automatically. That would benefit all builders, not just the Java one.
Comment 8 Markus Keller CLA 2007-05-11 06:57:17 EDT
See also bug 136337.
Comment 9 Eclipse Webmaster CLA 2009-08-30 02:39:32 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.