Annotation on Intersectingtype

Mohan Radhakrishnan radhakrishnan.mohan at
Fri Jan 24 22:14:19 PST 2014

I am confused.

//Intersection type
    class Test<T extends String & @IntersectionType.TypeUse(value = 2)


How do I apply an annotation on the intersection type itself instead of on
individual bounds ? The code I sent earlier doesn't print the annotation
which might be the bug you are mentioning. It prints the intersection type


On Sat, Jan 25, 2014 at 2:08 AM, Alex Buckley <alex.buckley at>wrote:

> On 1/23/2014 8:24 PM, Mohan Radhakrishnan wrote:
>> Ok. I understand I have to get each bound and get the annotation applied
>> on it. There is no annotation applied on the intersection type itself.
> Well, in theory you should be able to get the bounds' mirrors
> individually, and read their annotations, but it doesn't currently work.
> So, you have to get the intersection type's mirror (representing all the
> bounds in one go) and read the annotations from there - you even sent code
> yesterday showing how to do that. We are working on cleaning up the type
> annotation reflection for a JDK 8 update release.
>  Did you mean  something like this by cast?
>> |Serializable f2|
>> |= (BiPredicate<String,String> & Serializable)|
>> |(s,t) -> s.equalsIgnoreCase(t);|
> Yes. The use of an intersection type in a cast is brand new in SE 8.
> Although, I guess the Language Model doesn't expose individual expressions
> like casts, so the javadoc would have to be worded carefully.
> Alex
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the type-annotations-dev mailing list