Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359716 - Update filter implementation(s) to support new rules in OSGi R5.
Summary: Update filter implementation(s) to support new rules in OSGi R5.
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: Juno M4   Edit
Assignee: John Ross CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-03 11:16 EDT by John Ross CLA
Modified: 2011-10-31 15:20 EDT (History)
2 users (show)

See Also:


Attachments
Proposed Patch (8.67 KB, patch)
2011-10-03 13:42 EDT, John Ross CLA
no flags Details | Diff
Proposed Patch 2 (18.12 KB, patch)
2011-10-04 13:38 EDT, John Ross CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Ross CLA 2011-10-03 11:16:21 EDT
OSGi R5 (previously known as 4.4) will add support for enums as part of filter matching. A full discussion may be found here: https://www.osgi.org/members/bugzilla/show_bug.cgi?id=2112. In summary, when comparing Comparables or unknowns, R5 will require implementations to prefer a public, static method named "valueOf" that takes a single String parameter over the current public constructor. If the appropriate "valueOf" method is not present, the constructor is still used as a secondary form of conversion. This will support java.lang.Enum since it implements Comparable and has the "valueOf" method. It will also take advantage of the flyweight pattern used in certain "valueOf" method implementations such as Integer.

At a minimum, this will require updates to org.osgi.framework.FrameworkUtil.FilterImpl and org.eclipse.osgi.framework.internal.core.FilterImpl.
Comment 1 John Ross CLA 2011-10-03 11:21:11 EDT
Apparently, if you assign a bug to yourself as part of creating it, emails go out to noone. So here's your email making you aware of it. Assigning back to me.
Comment 2 BJ Hargrave CLA 2011-10-03 12:47:08 EDT
We still need to agree to this in OSGi before we implement in Equinox.
Comment 3 John Ross CLA 2011-10-03 13:42:12 EDT
Created attachment 204463 [details]
Proposed Patch

I don't have permissions for hargrave/osgi44.

Attached is a patch off of hargrave/osgi44 that copies over FrameworkUtil.FilterImpl and updates org.eclipse.osgi.framework.internal.core.FilterImpl.
Comment 4 John Ross CLA 2011-10-04 13:38:31 EDT
Created attachment 204533 [details]
Proposed Patch 2

Updates the previous patch with additional support for ensuring the target object's class is assignable from the valueOf method's return type.
Comment 5 John Ross CLA 2011-10-31 10:18:03 EDT
Comment on attachment 204533 [details]
Proposed Patch 2

Marking patch as obsolete. The necessary changes to osgi FrameworkUtil and equinox FilterImpl classes may be found at

FilterImpl
https://github.com/bjhargrave/rt.equinox.framework/commit/1375a524aaea2e91eec44c56fec64068cacff266

FrameworkUtil https://github.com/bjhargrave/rt.equinox.framework/commit/1f919a9ce579a1ebc0a2eccd2b0e0ea442750baa