Summary: | Operations on cu outside classpath should fail | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jerome Lanneluc <jerome_lanneluc> |
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.0 | ||
Target Milestone: | 2.1 M3 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Jerome Lanneluc
2002-10-22 09:44:47 EDT
We should wait until we have some feedback on this front. Current plan is to release this no later than 2.1-M3. Fixed CompilationUnit to ensure that exists() returns false for a cu outside the classpath and that it cannot be opened. Fixed WorkingCopy to allow to open a working copy on such a cu. In case this fix needs to be undone: 1. Add the following methods to CompilationUnit: public IResource getUnderlyingResource() throws JavaModelException { return getResource(); } protected boolean parentExists(){ return true; // tolerate units outside classpath } 2. Move WorkingCopy.openParent() to CompilationUnit 3. Replace WorkingCopy.commit with the following contents: /** * @see IWorkingCopy */ public void commit(boolean force, IProgressMonitor monitor) throws JavaModelException { ICompilationUnit original = (ICompilationUnit)this.getOriginalElement(); if (original.exists()) { CommitWorkingCopyOperation op= new CommitWorkingCopyOperation (this, force); runOperation(op, monitor); } else { IFile originalRes = (IFile)original.getResource(); try { originalRes.create( new InputStream() { public int read() throws IOException { return -1; } }, force, monitor); } catch (CoreException e) { throw new JavaModelException(e); } original.getBuffer().setContents(this.getContents()); original.save(monitor, force); } } Actually point 3 is not needed. Added flag CompilationUnit.FIX_BUG25184 which is set to true. To undo the fix, set it to false. Verified. |