Documentation of Project Coin features as implemented in the JDK 7 developer preview
Jesper Öqvist
jesper.oqvist at cs.lth.se
Wed Mar 9 06:47:38 PST 2011
Rémi Forax wrote:
> On 03/09/2011 03:17 PM, Maurizio Cimadamore wrote:
>
>> On 09/03/11 13:49, Eamonn McManus wrote:
>>
>>>> So it is more a compiler bug erroneously accepting spaces 'inside' the
>>>> diamond. The compiler should be fixed.
>>>>
>>> I don't understand this. We're not introducing a new lexical<> token,
>>> are we? So obviously the compiler must allow spaces between< and>,
>>> as between any pair of tokens. Stylistically, some people might prefer
>>> to write List< Integer>, say, and would certainly be surprised not
>>> to be able to write List< >.
>>>
>> I think it would be better if the compiler would be stricter about this,
>> and to deal with diamond as if it were a token - otherwise, programmer
>> might abuse of current behavior:
>>
>> new ArrayList< >();
>>
>> new ArrayList<
>> >();
>>
>> Which is ugly.
>>
>> Maurizio
>>
>
> It's not fundamentally different from
> new ArrayList
> <>
> ();
> which is legal.
>
> And considering <> is a kind of new operator is weird.
>
Exactly! A type parameter list is similar to a method argument list, and
it is allowed to have whitespace between the parenthesis of a parameter
list.
I don't see why you should be able to write
new ArrayList<>(
);
and not
new ArrayList<
>();
even though I agree that the last example is a bit unsightly.
/Jesper
> As Éamonn says new ArrayList < String > is legal so new ArrayList < >
> should be legal.
>
> Rémi
>
>
>>> Éamonn
>>>
>>> On 9/3/11 2:25 PM, Maurizio Cimadamore wrote:
>>>
>>>> On 09/03/11 12:57, Ulf Zibis wrote:
>>>>
>>>>> Why do you allow whitespace between the "<" and">" of a diamond.
>>>>>
>>>> Good catch - I don't think this is a spec problem, as the grammar for
>>>> diamond is defined as follows in the latest draft:
>>>>
>>>> /TypeArgumentsOrDiamond:/
>>>>
>>>> /TypeArguments/
>>>>
>>>> |<||>|
>>>>
>>>>
>>>> So it is more a compiler bug erroneously accepting spaces 'inside' the
>>>> diamond. The compiler should be fixed.
>>>>
>>>> Maurizio
>>>>
>>>>> Is whitespace allowed for ++ operator e.g.?
>>>>>
>>>>> -Ulf
>>>>>
>>>>>
>>>>> Am 09.03.2011 07:40, schrieb Joe Darcy:
>>>>>
>>>>>> Joe Darcy wrote:
>>>>>>
>>>>>>> Hello.
>>>>>>>
>>>>>>> I've posted documentation of the semantics of the Project Coin
>>>>>>> features as implemented in the JDK 7 developer preview, b130, at:
>>>>>>> http://cr.openjdk.java.net/~darcy/ProjectCoin/ProjectCoin-Documentation-v0.83.html
>>>>>>>
>>>>>>>
>>>>>>> Before sending in comments or questions about a feature to coin-dev,
>>>>>>> please read the discussion section after a feature. Many design
>>>>>>> considerations are discussed in those sections. Additionally, some
>>>>>>> known bugs in the current implementation are noted in the text. In
>>>>>>> particular, javac in the JDK 7 developer preview erroneously accepts
>>>>>>> diamond combined with non-generic classes and accepts some uses of
>>>>>>> diamond with anonymous inner classes. These bugs will be corrected in
>>>>>>> future builds.
>>>>>>>
>>>>>>> Happy reading,
>>>>>>>
>>>>>>> -Joe
>>>>>>>
>>>>>> No comments from the coin-dev readership on the posted documentation?
>>>>>>
>>>>>> -Joe
>>>>>>
>>>>>>
>>>>>>
>
>
>
More information about the coin-dev
mailing list