review request for 8010225 test in typeAnnotations/failures do not test TYPE_USE

Alex Buckley alex.buckley at oracle.com
Mon Sep 16 17:20:57 PDT 2013


On 9/16/2013 2:42 PM, Steve Sides wrote:
> On 9/13/2013 10:42 AM, Alex Buckley wrote:
>> - AnnotationVersion: The @summary is imprecise - the test is about the
>> receiver parameter 'this', not type annotations in general. In SE 6
>> and 7 and 8, the annotation type 'A' with no
> I'm not so sure I agree with that. Due to the 3 @compile lines, the test
> is about allowing type-annotations only with jdk8. The fact that he put
> the annotation on 'this' appears to me to be incidental.  It may be odd
> that he chose 'this' as opposed to maybe 'String' or some other more
> common usage, but it does seem to be just a usage to make the general
> point and elicit the diagnostic
> "compiler.err.type.annotations.not.supported.in.source: 1.7", and not to
> test that specific usage.

This test aims to show that "type annotations" didn't exist and now do 
exist. In other words, that an annotation was not permitted in some 
type-oriented location in 6/7 but is permitted in that location in 8. It 
is poor form to choose a location in 8 which didn't exist in 6/7 - 
especially when that location is frankly very obscure. I would suggest 
putting the @A on something simple like an 'extends' clause.

In addition, ElementType.TYPE_USE didn't exist in 6/7 so a reader might 
ask why javac doesn't complain about that rather than the syntax error 
of the 'this' parameter. This is why I also suggested having a companion 
test where a ElementType from 6/7 was used.

Alex


More information about the type-annotations-dev mailing list