Bug 62713 - should not be able to nest output folders [build path]
Summary: should not be able to nest output folders [build path]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-18 13:34 EDT by Tom Hofmann CLA
Modified: 2004-05-28 15:57 EDT (History)
0 users

See Also:


Attachments
nested output folders (43.67 KB, image/png)
2004-05-18 13:35 EDT, Tom Hofmann CLA
no flags Details
Expected validation error seen at stage 10 (45.63 KB, image/jpeg)
2004-05-24 11:23 EDT, Philipe Mulet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2004-05-18 13:34:58 EDT
I20040518-gtk M9 test pass

It's going to be hard to reconstruct what I did, but I ended up with nested
output folders (will attach a screenshot of the property page).

+/- Steps:

1. Create project JUnit
2. import junit.zip, no separate source and output folders
3. Using the context menu in the package explorer, add source folder "test"
4. info: the output will be set to "bin". Ok.
-> Note that the standard directory with my junit source is not a source folder
any longer
5. Open the project properties, Java build path
6. Add a source folder, choose the root (Project)
-> error, "cannot nest Junit/test into Junit"
7. exclude JUnit/test/ from JUnit source folder
(cool caption telling me to add a slash to fully exclude the folder!)

Everything ok up to now.

8. Enable output folders per source folder
9. Set the output folder for test to "Junit/bin"
10. Set the output folder for the root dir to "Junit/bin/test" (no complaint)
11. leave the property page

Hm, now I have a different problem: The folder JUnit/bin/test does not exist
-> error in problems view telling me that the project cannot be built because of
this

We'll continue this way, cannot reproduce the original set up.
12. Over the context menu, choose to create JUnit/bin/test
-> I get this in the log:

!ENTRY org.eclipse.jdt.core 4 4 May 18, 2004 19:19:49.409
!MESSAGE JavaBuilder handling ImageBuilderInternalException while building: JUnit
!STACK 1
org.eclipse.core.internal.resources.ResourceException: Resource /JUnit/bin/test
does not exist.
        at java.lang.Throwable.<init>(Throwable.java)
        at java.lang.Throwable.<init>(Throwable.java)
        at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:37)
        at
org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:30)
        at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java)
        at org.eclipse.core.internal.resources.Container.members(Container.java)
        at org.eclipse.core.internal.resources.Container.members(Container.java)
        at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.cleanOutputFolders(BatchImageBuilder.java:112)
        at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:35)
        at
org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:213)
        at
org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:145)
        at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:532)
        at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
        at org.eclipse.core.runtime.Platform.run(Platform.java)
        at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:148)
        at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:225)
        at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:178)
        at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:205)
        at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
        at org.eclipse.core.runtime.Platform.run(Platform.java)
        at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:208)
        at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:244)
        at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:273)
        at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:151)
        at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:198)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java)
!SUBENTRY 1 org.eclipse.core.resources 4 368 May 18, 2004 19:19:49.434
!MESSAGE Resource /JUnit/bin/test does not exist.
Comment 1 Tom Hofmann CLA 2004-05-18 13:35:50 EDT
Created attachment 10781 [details]
nested output folders

shows nested output folders.
Comment 2 Martin Aeschlimann CLA 2004-05-18 14:10:09 EDT
moving to jdt.core

the JavaConventions.validateClasspath should not allow invalid settings
Comment 3 Philipe Mulet CLA 2004-05-24 11:23:56 EDT
Created attachment 11014 [details]
Expected validation error seen at stage 10

Cannot reproduce on M9. At stage 10, I obtain the expected validation error
refusing to nest output folders in each other.
Comment 4 Philipe Mulet CLA 2004-05-24 11:26:34 EDT
Can you reproduce it with exact steps you described in fresh new workspace ?
Please reopen once information is available.
Comment 5 Tom Hofmann CLA 2004-05-24 12:27:21 EDT
Here we go - there were a couple of steps missing in my original steps:

1. Create project JUnit
2. import junit.zip, no separate source and output folders
3. Using the context menu in the package explorer, add source folder "test"
4. info: the output will be set to "bin". Ok.
-> Note that the standard directory with my junit source is not a source folder
any longer
5. Open the project properties, Java build path
6. Add a source folder, choose the root (Project)
-> error, "cannot nest Junit/test into Junit"
7. exclude JUnit/test/ from JUnit source folder
7a. ok & leave property page

Everything ok up to now. The problem lies in the following steps, I believe:

7b. Open the properties anew.
7c. Set the default output folder to the project root: JUnit. (should this be
possible?)
7d. Ok & Exit.

7e. Open the properties anew.
8. Enable output folders per source folder
9. Set the output folder for test to "Junit/bin"
10. Set the output folder for the root dir to "Junit/bin/test" (no complaint)
11. leave the property page
11a. Observe: JUnit/bin/test does not exist
12. Over the context menu, choose to create JUnit/bin/test
-> I get the exception mentioned in comment 0.
Comment 6 Philipe Mulet CLA 2004-05-24 13:13:06 EDT
Reproduced with new steps.
Comment 7 Philipe Mulet CLA 2004-05-24 18:29:45 EDT
Output folder nesting check was ordering dependent (1) and not specific enough 
(2). 

(1) List of output folders in order is: {P/, P/bin/test/, P/bin/}. When 
checking P/bin/test/, we don't yet have come across P/bin/, and only find 
enclosing P/ which is tolerated (as default output folder). Changed check to 
accumulate all outputs before looking for enclosing scenario. Thus check on 
P/bin/test/ can now find P/bin/.

(2) Also when looking for enclosing scenario, we were looking for first 
enclosing folder, as opposed to most specific one, thus in above scenario, we 
would always find the output folder P/ which is then thought to be acceptable; 
and thus failing to notice more specific nesting in output folders.

[Note: nesting in default output folder is tolered iff all source folder 
declare a custom output.]

Added regression test ClasspathTests#test39-41.

Fixed
Comment 8 Philipe Mulet CLA 2004-05-24 18:30:05 EDT
Fixed
Comment 9 Olivier Thomann CLA 2004-05-28 15:57:47 EDT
Verified in 200405281200