JEP 186: Collection Literals

Remi Forax forax at univ-mlv.fr
Tue Jan 14 14:37:20 PST 2014


On 01/14/2014 08:05 PM, Per Bothner wrote:
> On 01/14/2014 09:23 AM, Brian Goetz wrote:>
>> In fact, since the goal at this point is to discuss whether we should
>> move forward or not with the /exploration/ of the language feature, let
>> me restrict the discussion to this point: is this something that needs a
>> language feature, or would library support be enough?
> Collection literals encourage embedding large data structures in the
> Java source code.  (These could be program-generated.)  This is more
> likely to blow up class-file size limitations, primarily size of
> constant pool, and size of code attributes.

yes, that why you need to have new constant pool constant that are able 
to store arrays.

>
> Note that a library-only solution does not solve this problem.
>
> In this day and age I would be embarrassed to say: We added
> collection literals, but they can be no longer that 10k elements long
> (on a good day).
>
> Ergo I think we need to fix the classfile-size-limitation bug
> if we're adding collection literals.  I was surprised to not find
> that in the list at http://openjdk.java.net/jeps/0

Changing the classfile format is I think something that never appears 
because it's like changing the AST of Java.

>
> If we fix this, some resource files could probably be replaced
> by (machine-generated?) collection literals.  That might allow
> marginally faster loading/startup (I'm guessing) of such code.

Rémi



More information about the lambda-dev mailing list