Bug 163200 - Moving code with compile errors outside of a source folder preserve compile errors
Summary: Moving code with compile errors outside of a source folder preserve compile e...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-02 08:07 EST by Pascal Rapicault CLA
Modified: 2008-05-14 01:43 EDT (History)
2 users (show)

See Also:
philippe_mulet: review+


Attachments
Proposed patch with testcase (3.96 KB, patch)
2008-05-07 13:50 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2006-11-02 08:07:28 EST
When I move code with compile errors outside of a source folder, the compile errors are still reported. This is annoying since the reason why I'm moving this code out of the source folder is to keep it around in my project without having the compile errors.

Steps to reproduce:
- create a java project
- create two packages each containing a class
- add a class in each package (one of this class must have a must compile error)
- go to the navigator view, find the package that contains the class that does not compile and move it at the root of the project
- go back to the package explorer, you will notice that the problems are still reported.

I would have expected the problems to be cleared.
I have a project with a src folder. In this project I have multiple packages, one of which has compile errors.
Comment 1 Markus Keller CLA 2006-11-03 11:09:25 EST
I would expect that the builder takes care of removing the markers when the file is moved out of the source path. Happens when moving in Package Explorer as well as in Navigator.
Comment 2 Philipe Mulet CLA 2006-11-03 11:30:04 EST
We have code in place doing this; apparently there is a hole in our story.
Comment 3 Jerome Lanneluc CLA 2007-06-21 07:41:59 EDT
This works for me using 3.3RC4.
Comment 4 Markus Keller CLA 2007-06-21 08:53:01 EDT
Steps from comment 0 still show the problem in I20070615-1200:

- paste this to empty Package Explorer:
package a;
public class A {
}
package b;
public class B extends Invalid {
}

- in Navigator, drag folder /_pasted_code_/src/b (not B.java) to /_pasted_code_

=> Error marker "Invalid cannot be resolved to a type" stays on _pasted_code_/b/B.java

I'm not sure why I wrote "Happens when moving in Package Explorer as well" in comment 1, since it is not (and was not) possible to move a package to a folder or a project in the Package Explorer.
Comment 5 Jerome Lanneluc CLA 2007-06-21 09:03:07 EDT
Thanks Markus. Reproduced as well. My mistake was to interpret 'it' in 'move it at the root of the project' as being the class. In fact 'it' is the package.
Comment 6 Jerome Lanneluc CLA 2008-05-07 10:01:34 EDT
The Java builder should remove the markers when the delta corresponds to a .java file moved to a folder that is not on any classpath.
Moving to Kent to resolve post 3.4
Comment 7 Kent Johnson CLA 2008-05-07 13:50:17 EDT
Created attachment 99131 [details]
Proposed patch with testcase

Added code used to 'move' a source file so it also handles moving a package
Comment 8 Philipe Mulet CLA 2008-05-12 07:12:48 EDT
Fix for bug 2857 indeed did not consider folders.
+1 for 3.4RC1
Comment 9 Kent Johnson CLA 2008-05-12 09:41:48 EDT
Released for 3.4RC1

Added IncrementalTests.testMovePackage2()
Comment 10 Maxime Daniel CLA 2008-05-14 01:43:59 EDT
Verified for 3.4 RC1 using build I20080513-2000.