Bug 29306 - Can't get content of CU not on classpath
Summary: Can't get content of CU not on classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-10 11:52 EST by Martin Aeschlimann CLA
Modified: 2003-02-10 07:00 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 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.