Mixins

David Holmes david.holmes at oracle.com
Mon Jan 23 21:14:13 PST 2012


On 24/01/2012 9:47 AM, Behrang Saeedzadeh wrote:
> What's the general consensus regarding supporting mixins in Java 8 (or 9,
> etc.)? The more I use them, the more I like them. I especially like them
> for organizing code -- different categories of responsibility for a class
> are encapsulated in different mixins, for example:
>
> public class AccountManagement {
>     mixin Authentication;
>     mixin Authorization;
>     mixin Administration;
> }

You can get (some of?) the effects of stateless mixins/traits using the 
proposed Default Methods [1] coming in with Project Lambda. Given the 
lack of any active projects to do anything more than this, this would 
seem to be the most you could expect to get in Java 8.

For Java 9+ ... work with an OpenJDK Committer to write up a JEP [2].

Cheers,
David Holmes

[1] 
http://cr.openjdk.java.net/~briangoetz/lambda/Defender%20Methods%20v4.pdf
[2] http://openjdk.java.net/jeps/0

> Cheers,
> Behrang Saeedzadeh
> http://www.behrang.org


More information about the jdk8-dev mailing list