This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 434325 - [api] Type arguments in Policy#get/setComparator APIs should be <Object>, not <String>
Summary: [api] Type arguments in Policy#get/setComparator APIs should be <Object>, not...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.4 RC1   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 413688
Blocks: 434334
  Show dependency tree
 
Reported: 2014-05-07 09:47 EDT by Markus Keller CLA
Modified: 2014-05-07 11:29 EDT (History)
3 users (show)

See Also:
daniel_megert: pmc_approved+
pwebster: review+


Attachments
Fix (1.71 KB, patch)
2014-05-07 09:48 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2014-05-07 09:47:47 EDT
Type arguments in Policy#get/setComparator APIs should be <String>, not <Object>.

I realized this when I switched org.eclipse.ui.ide.application to JavaSE-1.8. IDEWorkbenchAdvisor#initialize(IWorkbenchConfigurer) contains one typical usage:

		Policy.setComparator(Collator.getInstance());

Both com.ibm.icu.text.Collator and java.text.Collator implement Comparator<Object>, not Comparator<String>, so you get a compile error here.

It's unclear why they didn't bite the bullet and just made it a Comparator<String>; they probably just feared source incompatibilities. https://bugs.openjdk.java.net/browse/JDK-5062748 from 2004 remained unanswered.

org.eclipse.compare's DiffViewerComparator#getComparator() shows such a source compatibility problem Policy.getComparator().
Comment 1 Markus Keller CLA 2014-05-07 09:48:29 EDT
Created attachment 242797 [details]
Fix
Comment 2 Markus Keller CLA 2014-05-07 09:53:12 EDT
Oops, comment 0 and the original summary had the "should be *, not *" wrong. Fixed the summary.

Paul, can you please review the patch (or tell someone else to review it)?
Dani, can you please give PMC approval for the the API change?
Comment 3 Markus Keller CLA 2014-05-07 11:29:56 EDT
Added explanatory Javadoc for private field Policy#viewerComparator and released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ffc00fa559a3d6a3a72d3a8fe07c7e8a75789c3c