Bug 307527 - Mark internal stuff on IRequirementChange as @noreference
Summary: Mark internal stuff on IRequirementChange as @noreference
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
: 305080 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-30 09:55 EDT by Thomas Watson CLA
Modified: 2010-04-09 10:09 EDT (History)
5 users (show)

See Also:
tjwatson: pmc_approved+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2010-03-30 09:55:37 EDT
The following methods need @noreference to indicate that they are not to be used by clients

	public IRequiredCapability applyOn();
	public IRequiredCapability newValue();
	public boolean matches(IRequiredCapability toMatch);

IRequiredCapability is an internal class and should not be referenced anyways.  This is a safe change for 3.6.  (and pascal already did it).  Opening bug report to clean up our API scans in the build.
Comment 1 Thomas Watson CLA 2010-03-30 09:59:43 EDT
Kim can you use this bug to exempt the API changes to the following from the api scan report?

org.eclipse.equinox.p2.metadata.IRequirementChange#IRequiredCapability applyOn()
org.eclipse.equinox.p2.metadata.IRequirementChange#boolean matches(IRequiredCapability)
org.eclipse.equinox.p2.metadata.IRequirementChange#IRequiredCapability newValue()
Comment 2 Kim Moir CLA 2010-03-30 10:49:14 EDT
Tom, it might be easier for you to update the files yourself.  They are in the org.eclipse.releng project, in the apiexclude directory
Comment 3 Thomas Watson CLA 2010-03-30 10:58:53 EDT
(In reply to comment #2)
> Tom, it might be easier for you to update the files yourself.  They are in the
> org.eclipse.releng project, in the apiexclude directory

Thanks Kim.  Will do.
Comment 4 Thomas Watson CLA 2010-03-30 10:59:24 EDT
*** Bug 305080 has been marked as a duplicate of this bug. ***
Comment 5 Thomas Watson CLA 2010-04-07 14:32:31 EDT
Pascal, I noticed that you added @noreference to org.eclipse.equinox.p2.metadata.IRequirementChange.equals(Object)

Note that adding @noreference/@noextend/@noimplement will show as API changes.  We need to get all of these documented in bug reports and get PMC approvals so we can exclude them from the API change scans.

It seems a bit strange to add @noreference to the equals method.  Why was that needed?
Comment 6 Pascal Rapicault CLA 2010-04-07 15:20:45 EDT
Because in the future I'm not sure about the ability to be able to support equality computation between those two objects.
Comment 7 Thomas Watson CLA 2010-04-08 11:28:33 EDT
(In reply to comment #6)
> Because in the future I'm not sure about the ability to be able to support
> equality computation between those two objects.

I find it strange to add @noreference to a method that is overwritten from the Object class.  In reality the equals method is going to be implicitly called all over the place if IRequirementChange is placed in Collection (in particular Set).  John, do you see any issue here?
Comment 8 John Arthorne CLA 2010-04-08 11:48:31 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > Because in the future I'm not sure about the ability to be able to support
> > equality computation between those two objects.
> 
> I find it strange to add @noreference to a method that is overwritten from the
> Object class.  In reality the equals method is going to be implicitly called
> all over the place if IRequirementChange is placed in Collection (in particular
> Set).  John, do you see any issue here?

Yes, I don't think @noreference is useful here because it won't catch the most common uses (such as having the object in a collection). Also a client can always invoke ((Object)requirementChange).equals(..) and they will never hit the @noreference warning.

I suggest if we aren't sure if the specification of equals will stay the same, or will be possible to support in the future, then just remove #equals from the interface. This way equality just isn't defined in the API and clients can't rely on its semantics. This way they can reference equals(...), but we can change the implementation in the future without breaking any of our API contracts.
Comment 9 Thomas Watson CLA 2010-04-09 10:09:16 EDT
Pascal, would you be willing to simply remove the equals method from the interface?  From an API point of view that is the same as adding @noreference.