| Summary: | Cannot delete package from java project (two source and output folders) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Elias Volanakis <elias> | ||||||||||
| Component: | Core | Assignee: | Jay Arthanareeswaran <jarthana> | ||||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | amj87.iitr | ||||||||||
| Version: | 3.7 | Flags: | amj87.iitr:
review+
|
||||||||||
| Target Milestone: | 3.8 M6 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows Vista | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Elias Volanakis
Created attachment 196712 [details]
Project to reproduce issue
Reproduced with 3.7RC2 build. Jay, can you please investigate? thanks! In the concerned project, the output folder for both source folders, the same folders (src and test respectively) are used as output folders. When I remove that and use a different output such as \javaproj\bin, they get removed alright. Could you try that? Sorry, I didn't look at the analysis part of the report. My bad. I will see what we can do here. Created attachment 196751 [details] Proposed fix Draft patch. In the code highlighted in comment #0, we always use the bin folder that gets passed to the findSourceFiles() method. This is not correct esp. when each source folder has it's own output folder. The patch needs additional regression test and some more testing. Created attachment 197570 [details]
Patch with test
Patch updated with new test in JavaProjectTests. Will update after running all regression tests.
All existing test + new ones pass. Ayush, can you please review this? Should be straight forward. Created attachment 197730 [details]
alternate fix
Although the patch does fix the problem, I think there may be a fundamental difference in what you set out to achieve here and what the patch ends up doing. You basically wanted to make sure that deleted packages are not created back in case source folder = output folder. The fix, however, creates the deleted package in the binary folder of a source location which also happens to have a package with the same name. Note that this latter fix is a no-op in all cases (You can debug further inside the call to createFolder(..) and see why - the output folder will always have a directory corresponding to the package in question, except for the source location from where the package is being deleted, if it happens to be the output location itself.)
Hence, attaching an alternate fix here. Let me know what you think. The tests pass with it.
(In reply to comment #9) > Created attachment 197730 [details] > alternate fix Good catch and thanks Ayush! I think I grossly misunderstood the 'hasIndependentOutputFolder' flag. This patch looks good. Released the fix here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=f161d44712d28500f89fdf0082018d208530e0ea Verified for 3.8M6 using build I20120306-0800 |