Bug 42579 - Eclipse allows setting a source folder's parent as output folder, which wipes out source code
Summary: Eclipse allows setting a source folder's parent as output folder, which wipes...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 2.1.3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-05 01:14 EDT by David Gallardo CLA
Modified: 2004-03-01 12:09 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Gallardo CLA 2003-09-05 01:14:58 EDT
It's possible to select a source folder's parent as the output folder, as
described below. This has the majorly annoying side-effect of wiping out your
source code. Viz:

Suppose you have a project named MyProject.

- Create a source folder MyDir/src as a source folder. This will set the new
default output directory to MyProject/bin. 
- Create a class, package com.abs.stc, name Hello, in this directory.

Now change the source folder to /MyDir/src and the output folder to /MyDir as
follows: 

- Right click on the project and select Properties->Java Build Path->Source.
- click on Allow output folders for source folders. Click on Output folder,
(expand the source folder MyProject/MyDir/src if necessary), press Edit, click
on "Specific Output Folder" and change it to MyDir. Click OK. 
- You'll get a message about not being able to nest MyProject/MyDir/src inside
MyProject/MyDir. Make this message go away by changing the Default output folder
at the bottom of the dialog box from MyProject/bin to MyProject. (This is
probably where this bug should get fixed; it shouldn't let you do this.) 
- Click OK. You'll get a message box asking if it's OK to remove the old
generated sources from the old output folder; click Yes. BOOM! If you're using
Eclipse 3.0 or 2.1.1, this will immediately wipe out your source directory.

(If you're using 2.1, you get a reprieve; your source directory won't get wiped
until try to run Hello.java when you get an error about the main class not being
found.)
Comment 1 Philipe Mulet CLA 2003-12-09 08:07:50 EST
Reproduced
Comment 2 Philipe Mulet CLA 2003-12-09 10:29:57 EST
Validation check did incorrectly tolerate this scenario.
Fixed
Comment 3 Philipe Mulet CLA 2003-12-09 10:32:46 EST
Regression test added: ClasspathTests#testClasspathValidation33()
Comment 4 Philipe Mulet CLA 2003-12-09 10:33:08 EST
Fixed
Comment 5 Philipe Mulet CLA 2003-12-09 12:24:58 EST
Backporting to 2.1 stream.
Comment 6 David Audel CLA 2003-12-17 10:34:01 EST
Verified for 3.0M6
Comment 7 Frederic Fusier CLA 2004-03-01 07:25:59 EST
Verified for 2.1.3 with build I200402251535.
Comment 8 Frederic Fusier CLA 2004-03-01 12:09:23 EST
Build was M200402251535 and not I200402251535....