Language feature proposal: Partial Java types

Gunnar Morling gunnar at
Fri Nov 21 18:03:39 UTC 2014

2014-11-21 13:31 GMT+01:00 Stephen Colebourne <scolebourne at>:

> There are definitely use cases for a feature like this. For example,
> Joda-Beans [1] adopts the source code generation approach to beans.


> This approach ensures good Javadoc and debugging, because the classes
are just standard Java source files. It also allows genuinely
> immutable classes (because they can be final). But it is far from
> ideal, and partial classes, or the ability to generate into the same
> source file, is really what is needed here.

Right, generators like Joda-Beans are exactly what I have in mind here.
Also some UI builders work with "protected regions" where they put
generated code; Clearly a separate part for generated code would be very

> However, desirability does
> not create engineering development time within Oracle.

Yes, I understand that.

I still wanted to bring it up as it would allow developers and libraries
out there to define their own approach for things such as properties or
traits. The desire to add these features to the language itself might be
reduced if they can be emulated sufficiently well on a library level.

This may be a way out for cases where features can't be added natively
because it's not clear which approach to take (properties) or because they
don't pull their weight in terms of complexity cost as they are only
interesting for a minority of users etc.

More information about the discuss mailing list