Bug 309009

Summary: Reference to getBuffer() seems inconsistent with working copies
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, daniel_megert, jerome_lanneluc, markus.kell.r
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2010-04-13 10:58:56 EDT
The creation of a buffer can potentially be overridden for a working copy by overriding the method:
org.eclipse.jdt.core.WorkingCopyOwner.createBuffer(ICompilationUnit)

But it looks like there are some calls that retrieve the buffer of a working copy without checking this method.
org.eclipse.jdt.internal.core.ClassFileWorkingCopy.openBuffer(IProgressMonitor, Object)

org.eclipse.jdt.internal.core.CompilationUnit.openBuffer(IProgressMonitor, Object)

Some calls directly target the buffer manager without checking if the buffer should be retrieved through the working copy owner.
For example:
org.eclipse.jdt.internal.core.CompilationUnit.getContents()

This looks suspicious.
Comment 1 Olivier Thomann CLA 2010-04-13 11:00:08 EDT
Jay, please have a look at this.
I believe we can get inconsistencies if the working copy owner is used to set the buffer of the working copy.
Comment 2 Olivier Thomann CLA 2010-04-13 12:08:24 EDT
Closing as INVALID.
Only the creation of the buffer should use the working copy owner.
All further calls to the buffer should go through the buffer manager.
It looks ok.
Comment 3 Ayushman Jain CLA 2010-04-26 02:33:41 EDT
Verified for 3.6M7
Comment 4 Jay Arthanareeswaran CLA 2010-04-26 13:45:01 EDT
Verified.