V? and generics
Brian Goetz
brian.goetz at oracle.com
Mon May 13 16:46:12 UTC 2019
The question about "what about F-bounds" is a good one; thanks for
raising this. Needs further thought.
But, while I agree you've raised a problem, I think it's a pretty big
leap to the "solution" you propose. So let's table that (re-)proposal
pending a deeper understanding of the problem, and its relation to the
other requirements.
On 5/10/2019 4:50 PM, Remi Forax wrote:
> Let's say i have this interface:
> interface Orderable<T extends Orderable<T>> {
> boolean lessThan(T t);
> }
>
> and i want my inline class to implement it:
> @__inline__ class FooOrderable implements Orderable<FooOrderable?> {
> ...
> @Override
> public boolean lessThan(FooOrderable? foo) {
> return false;
> }
> }
>
> how i'm suppose to write it given that the bound of FooOrderable as to be Orderable<FooOrderable> but Orderable<FooOrderable> is not a valid type ?
>
> I think that we have moved from a generic of an inline class is unsafe (because of the NPEs) to it's an illegal type a little to fast.
>
> I believe we should emit an unchecked warning instead with the definition of unchecked to be widened to include not only the CCEs but also the NPEs.
>
> Rémi
More information about the valhalla-spec-experts
mailing list