Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329373

Summary: Javadoc of IContainer.findMember(String) does not match reality
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: ResourcesAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: malgorzata.tomczyk, markus.kell.r
Version: 3.7Flags: malgorzata.tomczyk: review? (Szymon.Brandys)
Target Milestone: 3.7 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Modified javadoc
none
Corrected javadoc
none
Corrected javadoc
none
Markus comments to javadoc applied
none
findMember(String, boolean) and findMember(IPath, boolean) synchronized with eachother. Szymon.Brandys: iplog+

Description Dani Megert CLA 2010-11-03 12:49:48 EDT
The Javadoc of IContainer.findMember(String) does not match reality: it specifies to find the members with a given *name* but actually treats the name as path.

The Javadoc should also mention that "" finds the resource itself.
Comment 1 Malgorzata Janczarska CLA 2010-11-04 08:44:26 EDT
Created attachment 182365 [details]
Modified javadoc

I've added a note to javadoc to clarify.
Comment 2 Dani Megert CLA 2010-11-04 08:48:56 EDT
We should not just add a note but rewrite the Javadoc since it clearly doesn't find a member by name but by path.
Comment 3 Markus Keller CLA 2010-11-04 09:02:03 EDT
And please write complete sentences (e.g. *a* relative path...), see also
http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html .
Comment 4 Malgorzata Janczarska CLA 2010-11-04 10:36:54 EDT
Created attachment 182373 [details]
Corrected javadoc

How do you like the javadoc now?
Comment 5 Markus Keller CLA 2010-11-04 14:23:28 EDT
(In reply to comment #4)
Looks better. But after looking more closely at the implementation, I think you should just copy the Javadocs of the corresponding findMember(IPath*) methods. That's more precise, and reducing variants is always goodness.

Then compare IPath#append(String) and IPath#append(IPath) and add the missing bits to the findMember(String*) APIs:
- The given string path must be a valid path.
- @see IPath#isValidPath(String)
... and I would add:
- @see IPath#isValidSegment(String)
Comment 6 Malgorzata Janczarska CLA 2010-11-08 10:54:29 EST
Created attachment 182627 [details]
Corrected javadoc

I used javadoc from findMember(Path*) and added some links to IPath.
Comment 7 Markus Keller CLA 2010-11-09 06:58:27 EST
(In reply to comment #6)
> Created an attachment (id=182627) [details] [diff]

We're getting close, but when I select the two corresponding methods in the Outline view and then execute Compare With ... > Each Other, I still see unnecessary differences:

#findMember(String) misses:
	 * <p>
	 * Note that no attempt is made to exclude team-private member resources
	 * as with <code>members</code>.
	 * </p>


#findMember(String, boolean) misses the following paragraph from #findMember(String):
	 * <p>Note that <code>path</code> contains a relative path to the resource
	 * and all path special characters will be interpreted. Passing an empty string
	 * will result in returning this {@link IContainer} itself.
	 * </p>

#findMember(String, boolean) contains "@see #members()", but it should be
"@see #members(boolean)".
Comment 8 Malgorzata Janczarska CLA 2010-12-01 08:47:39 EST
Created attachment 184255 [details]
Markus comments to javadoc applied

I've attached a patch with your comments applied.
Comment 9 Malgorzata Janczarska CLA 2010-12-03 07:27:55 EST
Created attachment 184456 [details]
findMember(String, boolean) and findMember(IPath, boolean) synchronized with eachother.
Comment 10 Szymon Brandys CLA 2010-12-03 07:54:44 EST
Looks good now. Committed to HEAD.