V? and generics

Remi Forax forax at univ-mlv.fr
Fri May 10 20:50:33 UTC 2019


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