RFR: 8004518 & 8010122 : Default methods on Map (original) (raw)

Ulf Zibis Ulf.Zibis at CoSoCo.de
Thu Apr 18 22:48:25 UTC 2013


Am 10.04.2013 20:24, schrieb Remi Forax:

interface + default methods are conceptually what is known as traits(*), you can see them as interface + method with code or as abstract class without state, it's the same thing.

Now, if you want traits in Java, you have 3 choices: add a new kind of type, trait, introduce a stateless abstract class or add default methods to interface. All these changes require to change the VM, so all of them are big changes. The lambda expert group studies each solution and adding default methods to interface is the path that creates less problems, that why it was chosen.

I like to mention another thought. When I look at the result, we now have interfaces with normal methods and default methods and to the unprepared reader it seems as there is no logical rationale for which method which type was chosen. The only justification is the history about extending legacy interfaces.

Thanks,

-Ulf



More information about the core-libs-dev mailing list