Commit ce6f7cc5 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Return a more specific type from AnnotationFactory.createAnnotation."

parents 4323ab38 47f7d00f
......@@ -89,11 +89,11 @@ public final class AnnotationFactory implements InvocationHandler, Serializable
* @param elements name-value pairs representing elements of the annotation
* @return a new annotation instance
*/
public static Annotation createAnnotation(Class<? extends Annotation> annotationType,
AnnotationMember[] elements) {
public static <A extends Annotation> A createAnnotation(Class<? extends Annotation> annotationType,
AnnotationMember[] elements) {
AnnotationFactory factory = new AnnotationFactory(annotationType, elements);
return (Annotation) Proxy.newProxyInstance(annotationType.getClassLoader(),
new Class[]{annotationType}, factory);
return (A) Proxy.newProxyInstance(annotationType.getClassLoader(),
new Class[]{annotationType}, factory);
}
private final Class<? extends Annotation> klazz;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment