Revisiting primitives in generics: This can *NOT* be delayed for later.

Florian Weimer fweimer at
Mon Jul 19 06:58:37 PDT 2010

* John Nilsson:

> I'm note sure I understand why this is a problem. But if it is, why
> not fix it?
> So I understand it correct that there is no runtime lookup for a
> compatible method (supertype of DoubleComparator)? If so, why not add
> this to the runtime?

This would work.  However, you still break backwards compatibility (at
the source level, not the binary level) when a user has defined
methods like this:

    void perform(Ops.DoubleComparator);
    void perform(Comparator<Double>);

, assuming that Comparator<Double> and Comparator<double> have the
same erasure (at least at the Java level).

Retrofitting a class to implement an interface is only safe if the
interface is new.

Florian Weimer                <fweimer at>
BFK edv-consulting GmbH
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

More information about the lambda-dev mailing list