Eclipse vs Javac difference

Stephen Colebourne scolebourne at joda.org
Fri Aug 27 02:06:08 PDT 2010


That sounds similar to the problem Benedict - one method inherited
from two interfaces, one with a generic definition Iterator<T> and one
with an extension of that BooleanIterator. I assume the convariant
return type isn't picked up after the erasure occurs.

I have limited internet connection, so can't search the bug database
to find the reference. This will be very difficult to work around I
suspect.

Stephen


On 27 August 2010 08:39, Benedict Elliott Smith <lists at laerad.com> wrote:
> This is something that bit me once - if you implement two
> methods from different interfaces with the same erasure, the JDK6 compiler
> barfs. It has definitely been fixed, but I think only in JDK7.
>
>
> On 27 August 2010 01:11, Jonathan Gibbons <jonathan.gibbons at oracle.com>
> wrote:
>>
>> Stephen,
>>
>> Have you tried versions of JDK, such as OpenJDK 6 or OpenJDK 7?
>>
>> Can you boil the code down to a simple example which illustrates the
>> different behavior?
>>
>> -- Jon
>>
>> On 08/26/2010 04:10 PM, Stephen Colebourne wrote:
>>>
>>> I'm currently seeing a difference between Eclipse and Javac and am
>>> trying to determine who is at fault, and how to work around it.
>>>
>>> The code in question is at Joda Primitives -
>>>
>>> http://joda-primitives.svn.sourceforge.net/viewvc/joda-primitives/trunk/JodaPrimitives/?pathrev=30
>>>
>>> Running maven - mvn package - shows the problem (it compiles in
>>> Eclipse 3.5.0 and not in javac 1.6.0_13-b03)
>>>
>>>
>>> \dev\joda\primitives\src\test\java\org\joda\primitives\list\impl\AbstractTestBooleanList.java:[76,39]
>>> reference to iterator is ambiguous, both method iterator() in
>>> org.joda.primitives.collection.BooleanCollection and method iterator()
>>> in java.util.List<java.lang.Boolean>  match
>>>
>>> The code includes an interface BooleanCollection that extends
>>> interface PrimitiveCollection, which extends Collection<Boolean>. The
>>> iterator() method is overridden covariantly in BooleanCollection to
>>> return BooleanIterator, a subinterface of PrimitiveIterator<Boolean>
>>> and Iterator<Boolean>.
>>>
>>> Any ideas? The svn repo is available to view (Apache 2 license).
>>> Stephen
>>>
>>
>
>



More information about the compiler-dev mailing list