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

Bug 337699

Summary: ICU 4.4.2 is not (source?) compatible with 4.2.1
Product: [Tools] Orbit Reporter: David Williams <david_williams>
Component: bundlesAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: neil.hauge, pwebster, tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description David Williams CLA 2011-02-21 05:00:26 EST
In WTP, we tried moving to  I20110215-0800 (from M5) and got 3 compile errors that were tracked down to changes in ICU4J.

For example: 

Source File: org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
    1. ERROR: TypeMismatch

    Type mismatch: cannot convert from Collator to Comparator<String>

    JaxbProjectPropertiesPage.java :

    69 : /* private */ static final Comparator<String> STRING_COMPARATOR = Collator.getInstance();


This is fine, with ICU 4.2.1, but compile error with 4.4.2. 

The definition, in 4.2.1 is 
 public abstract class Collator implements Comparator, Cloneable

The definition in 4.4.2 is 
public abstract class Collator implements Comparator<Object>, Cloneable

I suspect this is similar to bug 335372 and should have been defined as 
public abstract class Collator implements Comparator<? extends Object>, Cloneable

I marked this as a 'blocker' since prevents us from moving up to I20110215-0800 (which was important, to me, to do early, since it has Ant 1.8.2 in it). 

I guess we can change our source (not sure of impact, not my code). Not sure we can get immediate fix for ICU4J ... but ... I wonder if worth reporting to them, and getting a near fix before Indigo? 

 
The other type of error we got looks similar (if not exact same reason): 
Source File: org/eclipse/jpt/jpa/ui/internal/details/MappedByPane.java
    1. ERROR: UndefinedConstructor

    The constructor SortedListValueModelAdapter<String>(new CollectionAspectAdapter<MappedByRelationshipStrategy,String>(){}, Collator) is undefined

    MappedByPane.java :

    74 : return new SortedListValueModelAdapter<String>( new CollectionAspectAdapter<MappedByRelationshipStrategy, String>( getSubjectHolder()) { @Override protected Iterator<String> iterator_() { return this.subject.candidateMappedByAttributeNames(); } }, Collator.getInstance() );
Comment 1 David Williams CLA 2011-02-21 05:09:53 EST
DJ, can you investigate? with ICU project? with Platform team? (that is, if there is a chance to get improved (fixed) version, perhaps the 4.4..2 version should be backed out of current platform?) 

Not sure how many others this would impact ... but, a break is a break is a pain.
Comment 2 Thomas Watson CLA 2011-02-21 09:03:56 EST
(In reply to comment #0)
> In WTP, we tried moving to  I20110215-0800 (from M5) and got 3 compile errors
> that were tracked down to changes in ICU4J.
> 
> For example: 
> 
> Source File:
> org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
>     1. ERROR: TypeMismatch
> 
>     Type mismatch: cannot convert from Collator to Comparator<String>
> 
>     JaxbProjectPropertiesPage.java :
> 
>     69 : /* private */ static final Comparator<String> STRING_COMPARATOR =
> Collator.getInstance();
> 
> 
> This is fine, with ICU 4.2.1, but compile error with 4.4.2. 
> 
> The definition, in 4.2.1 is 
>  public abstract class Collator implements Comparator, Cloneable
> 
> The definition in 4.4.2 is 
> public abstract class Collator implements Comparator<Object>, Cloneable
> 
> I suspect this is similar to bug 335372 and should have been defined as 
> public abstract class Collator implements Comparator<? extends Object>,
> Cloneable

Even if if it was Collator implements Comparator<? extends Object> you would not be able to assign that to Comparator<String>

> 
> I marked this as a 'blocker' since prevents us from moving up to I20110215-0800
> (which was important, to me, to do early, since it has Ant 1.8.2 in it). 
> 
> I guess we can change our source (not sure of impact, not my code). Not sure we
> can get immediate fix for ICU4J ... but ... I wonder if worth reporting to
> them, and getting a near fix before Indigo? 

I'm not sure I agree with blocker.  We never state that each release of eclipse must be source compatible.  To fix you have to assign the result to a raw Comparator and then cast it to a Comparator<String> 

CC'ing Paul since he will have more knowledge about ICU than DJ (no offense DJ) ;-)
Comment 3 David Williams CLA 2011-02-21 10:59:13 EST
(In reply to comment #2)

> 
> I'm not sure I agree with blocker.  We never state that each release of eclipse
> must be source compatible.  To fix you have to assign the result to a raw
> Comparator and then cast it to a Comparator<String> 
> 

I'm easy. I'll assume you are confirming this is merely source compatibility issue, and not binary compatibility (it's hard for me to tell when it involves generics). If it is merely source compatibility issue, I think the ways to resolve is a) "won't fix" and do nothing, b) "fixed" and doc in migration guide as a known, potential source incompatibility issue, or c) still worth getting a more source compatible version from ICU project.
Comment 4 Thomas Watson CLA 2011-02-21 11:57:46 EST
What you point out for Collator sounds like a source code compatibility issue.  I suspect the ICU Collator class simply mimics the java.text.Collator class which implements java.util.Comparator<Object>.  I doubt the ICU team would change that, but it does not hurt to ask.  But all that would help in your case is to change it to java.util.Comparator<String> or perhaps java.util.Comparator<? extends String> but String is final so that would not work.  I also am not sure if that is accurate from the Collator class POV if they really can have objects of other types.
Comment 5 Paul Webster CLA 2011-02-22 13:04:07 EST
I did ask the ICU4J guys, and the ICU collator should mirror the JRE collator, so the Comparator<Object> is correct.

I would suggest we close this as WONTFIX, and then I'll write something and post it to cross-projects.

PW
Comment 6 David Williams CLA 2011-02-22 13:22:57 EST
Sounds appropriate to me. Sounds like there was good reason for their change. 

FWIW, we in WTP tracked our reaction to this change in bug 337743 (and Neil did come up with a fix that was compatible with both versions).