Bug 29306

Summary: Can't get content of CU not on classpath
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Martin Aeschlimann CLA 2003-01-10 11:52:02 EST
20030107

New project with classpath set to
setRawClasspath(new ClasspathEntry[0], new Path("proj/bin"), null);

File src/junit/test/X.java: (File is a valid Java file)
  ICompilationUnit cu= JavaCore.createCompilationUnitFrom(file);
  if (cu != null) {
    ICompilationUnit workingCopy= null;
    try {
	workingCopy= (ICompilationUnit) cu.getWorkingCopy();

workingCopy.getSource is Empty.

As soon as you set the class path to at least one source folder, content can be 
read.
See test case: ClassPathDetectorTest
Comment 1 Jerome Lanneluc CLA 2003-01-17 11:09:33 EST
When opening the working copy (in Openable.openwhenClosed()), opening the 
buffer was skipped because the working copy had a null IResource. Fixed by 
moving the check for null in openBuffer().

Added regression test WorkingCopyNonInClasspathTests.testGetSource()
Comment 2 David Audel CLA 2003-02-10 07:00:30 EST
Verified.