View | Details | Raw Unified | Return to bug 80756
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/ClasspathTests.java (-3 / +26 lines)
Lines 1627-1634 Link Here
1627
		this.deleteProject("P");
1627
		this.deleteProject("P");
1628
	}
1628
	}
1629
}
1629
}
1630
/**
1630
/*
1631
 * 62713 - variation
1631
 * Ensures that a source folder with a custom output can be nested in the default output
1632
 */
1632
 */
1633
public void testClasspathValidation41() throws CoreException {
1633
public void testClasspathValidation41() throws CoreException {
1634
	try {
1634
	try {
Lines 1642-1648 Link Here
1642
		IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
1642
		IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, proj.getOutputLocation());
1643
		
1643
		
1644
		assertStatus(
1644
		assertStatus(
1645
			"Cannot nest \'P/src\' inside output folder \'P/\'",
1645
			"OK",
1646
			status);
1646
			status);
1647
	} finally {
1647
	} finally {
1648
		this.deleteProject("P");
1648
		this.deleteProject("P");
Lines 1672-1677 Link Here
1672
		this.deleteProject("P");
1672
		this.deleteProject("P");
1673
	}
1673
	}
1674
}
1674
}
1675
/*
1676
 * Ensure that a custom output folder cannot be nested in the default output folder
1677
 * (regression test for bug 80756 Multiple source folders to one bin forgot copy some files)
1678
 */
1679
public void testClasspathValidation43() throws CoreException {
1680
	try {
1681
		IJavaProject proj =  createJavaProject("P", new String[] {}, "");
1682
		IClasspathEntry[] originalCP = proj.getRawClasspath();
1683
	
1684
		IClasspathEntry[] newCP = new IClasspathEntry[originalCP.length+2];
1685
		System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
1686
		newCP[originalCP.length] = JavaCore.newSourceEntry(new Path("/P/src1"), new IPath[0], new Path("/P/bin"));
1687
		newCP[originalCP.length+1] = JavaCore.newSourceEntry(new Path("/P/src2"));
1688
		
1689
		IJavaModelStatus status = JavaConventions.validateClasspath(proj, newCP, new Path("/P/bin/default"));
1690
		
1691
		assertStatus(
1692
			"Cannot nest output folder \'P/bin/default\' inside output folder \'P/bin\'",
1693
			status);
1694
	} finally {
1695
		deleteProject("P");
1696
	}
1697
}
1675
/**
1698
/**
1676
 * Setting the classpath with two entries specifying the same path
1699
 * Setting the classpath with two entries specifying the same path
1677
 * should fail.
1700
 * should fail.
(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (+10 lines)
Lines 1377-1382 Link Here
1377
				}
1377
				}
1378
			}
1378
			}
1379
		}	
1379
		}	
1380
		// check nesting of project's output in custom output
1381
		int projectOutputIndex;
1382
		if ((projectOutputIndex = Util.indexOfEnclosingPath(projectOutputLocation, outputLocations, outputCount)) > 0) {
1383
			// allow project's output nesting in custom output if all source entries have a custom output
1384
			if (sourceEntryCount <= outputCount-1) {
1385
			    allowNestingInOutputLocations[projectOutputIndex] = true;
1386
			} else {
1387
				return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestOutputInOutput, new String[] {projectOutputLocation.makeRelative().toString(), outputLocations[projectOutputIndex].makeRelative().toString()})); 
1388
			}
1389
		}
1380
		// allow custom output nesting in project's output if all source entries have a custom output
1390
		// allow custom output nesting in project's output if all source entries have a custom output
1381
		if (sourceEntryCount <= outputCount-1) {
1391
		if (sourceEntryCount <= outputCount-1) {
1382
		    allowNestingInOutputLocations[0] = true;
1392
		    allowNestingInOutputLocations[0] = true;

Return to bug 80756