Skip to content

Instantly share code, notes, and snippets.

@raphw
Created January 12, 2016 00:24
Show Gist options
  • Save raphw/3fa7effa486a7ba8b4f0 to your computer and use it in GitHub Desktop.
Save raphw/3fa7effa486a7ba8b4f0 to your computer and use it in GitHub Desktop.
Type annotations on parameters of multiple type variable bound types are not filtered to their respective bound.
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.AnnotatedParameterizedType;
import java.util.List;
import java.util.concurrent.Callable;
public class Foo<T extends List<@Sample ?> & Callable<@Sample ?>> {
public static void main(String[] args) {
((AnnotatedParameterizedType) Foo.class.getTypeParameters()[0].getAnnotatedBounds()[0]).getAnnotatedActualTypeArguments();
}
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE_USE)
@interface Sample {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment