Bug 36465

Summary: Unable to create multiple source folders when not using bin for output
Product: [Eclipse Project] JDT Reporter: Jason Sholl <jsholl>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P1 CC: daniel_megert
Version: 2.1   
Target Milestone: 2.1.1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jason Sholl CLA 2003-04-14 14:49:25 EDT
To recreate:
1 Create a Java project and add two folders, test1 & test2.
2 Open the project properties.
3 Open Java Build Path and goto source page. 
4 Add test1 as a source folder.
5 Change the output location from bin to test1.
6 Press OK to close properties page.
7 Open the properties page again and try to add test2 as a source folder.

This fails.  The OK button is greyed out.  This fails programatically as well.  
Line 663 of JavaConventions is the problem.

if (otherEntry.getPath().equals(output)) {
   return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, 
Util.bind("classpath.cannotUseDistinctSourceFolderAsOutput", 
entryPath.makeRelative().toString(), otherEntry.getPath().makeRelative
().toString())); //$NON-NLS-1$
}

This is causing a huge problem for EJB projects and needs to be fixed ASAP.
Comment 1 Philipe Mulet CLA 2003-04-15 03:09:56 EDT
This check is intending to capture the scenario where some source folder would 
output to a different entry on the classpath (using a custom output location).

The scenario described in this defect should work.

Candidate for backporting to 2.1 maintenance stream.
Comment 2 Philipe Mulet CLA 2003-04-15 04:00:35 EDT
Actually, this situation is indeed meant to be forbidden. We don't want to let 
generated files pollute a source folder (consequence of fix for bug 33207 which 
was released in 2.1-rc2).

We could relax this rule, the end result is not nice, but is still supported 
(as it was in 2.0).
Comment 3 Philipe Mulet CLA 2003-04-15 04:26:04 EDT
For backward compatibility with 2.0, we allow the default output location to 
coincidate again, only specific output locations (associated with each source 
folder) will be denied to coincidate.

Note that in your testcase, the end result can be strange if doing the 
following:

P
+-test1/
| +- p/
|     +-X.java
+-test2/
  +- q/
     +-Y.java

after building (with output being test1/), you obtain

P
+-test1/
| +-p/
|   +-X.java
| +-q/   <------------ EXTRA EMPTY PACKAGE APPEARS
+-test2/
  +-q/
    +-Y.java

but presumably this doesn't bother you, right ?
Comment 4 Philipe Mulet CLA 2003-04-15 04:47:55 EDT
Patch available in JDT/Core 2.1 update area:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/r2.1/main.html#updates
Comment 5 Jerome Lanneluc CLA 2003-04-15 10:46:11 EDT
Fixed in 2.2 stream as well.
Comment 6 David Audel CLA 2003-06-02 06:48:15 EDT
Verified.
Comment 7 David Audel CLA 2003-06-10 10:20:57 EDT
Verified for 3.0M1
Comment 8 Chuck Bridgham CLA 2005-03-01 17:10:06 EST
OK