Documentation of Project Coin features as implemented in the JDK 7 developer preview
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Mar 9 06:39:20 PST 2011
On 09/03/11 14:35, Eamonn McManus wrote:
>> 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:
> I don't think the compiler can deal with diamond "as if it were a token".
Read: we introduce a '<>' token (which I think was clear form the context)
> Either it's a token or it's not. So, either we introduce a <> token
> (which I personally think would be a bad idea) or the compiler has to
> accept < >. It's not supposed to be in the business of telling you
> whether your code is nicely formatted.
I think there are valid arguments both ways.
Maurizio
> Éamonn
>
> On 9/3/11 3: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
>>> É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