See you at JVMLS

Guillaume Martres smarter3 at gmail.com
Thu Aug 20 16:12:15 UTC 2015


On Thursday 20 August 2015 13:47:36 Palo Marton wrote:
> > This would be a compile time (or JVM link time) error as this interface
> > extends 2 classes.
> 
> Sorry, I overlook that in your example E is a class (above reaction was for
> interface E extends I,J). But anyway this will be also a compile time
> error. Rule for classes could be: lass can implement an interface only if
> it extends the same class as interface (or subclass of that class). So
> these are OK
> class E extends C implements I {}
> class F extends D implements J {}
> 
> This is error:
> class E implements I {}
> 
> Rules for interfaces would be that you can write any number of interfaces
> and max 1 class in "extends", but in the end it must be resolved in a way
> that interface extends exactly one class. If there is a class in "extends",
> it is that class. If there are interfaces in "extends" that themselves
> extend classes, then situation is checked for conflicts and the most
> specific class is taken as "superclass" for the interface.

Keep going and you'll end up fully reinventing Scala traits ;)


More information about the valhalla-dev mailing list