Bug 293711 - Clarify ICompilationUnit#getOwner() javadoc
Summary: Clarify ICompilationUnit#getOwner() javadoc
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-29 13:57 EDT by Min Idzelis CLA
Modified: 2009-12-08 03:30 EST (History)
4 users (show)

See Also:


Attachments
Proposed fix (977 bytes, patch)
2009-11-10 14:43 EST, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (1.24 KB, patch)
2009-11-11 09:26 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Min Idzelis CLA 2009-10-29 13:57:53 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: 

It is worth clarifying the javadoc for ICompilationUnit? This is what it says now:

WorkingCopyOwner org.eclipse.jdt.core.ICompilationUnit.getOwner()
Returns the working copy owner of this working copy. Returns null if it is not a working copy or if it has no owner. 
Returns: 
WorkingCopyOwner the owner of this working copy or null 
Since: 
3.0


It says it returns "null" if it has no owner which is deceptive since when ( isWorkingCopy() && getOwner()==null) == true that means it's a primary working copy owner. 

Reproducible: Always
Comment 1 Dani Megert CLA 2009-10-30 03:42:54 EDT
Agree, could be clarified.
Comment 2 Olivier Thomann CLA 2009-11-10 14:43:44 EST
Created attachment 151872 [details]
Proposed fix

Would this make it clearer ?
Comment 3 Min Idzelis CLA 2009-11-10 15:02:09 EST
I'm still confused by the text. 

What about:

@return <tt>null</tt> if this <code>ICompilationUnit</code> is the primary working copy, or this <code>ICompilationUnit</code> is not a working copy, otherwise the <code>WorkingCopyOwner</code>.

In the proposed text, it seems that null can have two meanings if it is a working copy.
Comment 4 Min Idzelis CLA 2009-11-10 15:04:58 EST
Honestly, a new API method named isPrimaryWorkingCopy() seems like a good addition. It would return true if it is a working copy AND primary, false otherwise.
Comment 5 Olivier Thomann CLA 2009-11-10 15:21:14 EST
(In reply to comment #4)
> Honestly, a new API method named isPrimaryWorkingCopy() seems like a good
> addition. It would return true if it is a working copy AND primary, false
> otherwise.
I opened bug 294804 for this.
Comment 6 Olivier Thomann CLA 2009-11-11 09:26:27 EST
Created attachment 151940 [details]
Proposed fix

Here is the new patch based on last proposal.
Comment 7 Olivier Thomann CLA 2009-11-11 09:32:57 EST
Released for 3.6M4.
Comment 8 Ayushman Jain CLA 2009-12-08 01:34:22 EST
Verified for 3.6M4.