Clarification on type use
Paul Benedict
pbenedict at apache.org
Thu Apr 3 20:05:53 UTC 2014
I once heard someone say that TYPE_USE is a parent of TYPE. Thus, wherever
a valid TYPE can appear, a TYPE_USE would also be valid in the same place.
Right/wrong?
On Thu, Apr 3, 2014 at 2:27 PM, Alex Buckley <alex.buckley at oracle.com>wrote:
> Eric, I am on type-annotations-dev, you don't need to cc me every time.
>
> The TYPE_USE enum constant is specified in the javadoc for the
> j.l.a.ElementType enum type: "The constant TYPE_USE corresponds to the 15
> type contexts in JLS 4.11, as well as to two declaration contexts: type
> declarations (including annotation type declarations) and type parameter
> declarations." ["15" should be "16", there's a bug out for that.]
>
> Alex
>
> On 4/3/2014 9:19 AM, Eric McCorkle wrote:
>
>> The following is exerpted from the test
>> langtools/test/tools/javac/annotations/typeAnnotations/
>> TypeUseTarget.java:
>>
>> @A
>> class TypeUseTarget<K extends @A Object> {
>> ...
>> }
>>
>> @Target(ElementType.TYPE_USE)
>> @interface A { }
>>
>>
>> The first use of A seems to be on the class TypeUseTarget. The result
>> with the current implementation is that javac produces a
>> RuntimeInvisibleAnnotations attribute for the class TypeUseTarget.
>>
>> But is this valid? I can't seem to find anything in the type
>> annotations spec that suggests that an annotation with a TYPE_USE target
>> can wind up being a regular annotation on a class (or interface).
>>
>>
--
Cheers,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20140403/bdf3f3d1/attachment.html>
More information about the type-annotations-dev
mailing list