diff options
Diffstat (limited to 'libjava/classpath/java/lang/Package.java')
-rw-r--r-- | libjava/classpath/java/lang/Package.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libjava/classpath/java/lang/Package.java b/libjava/classpath/java/lang/Package.java index 38bb3240de4..1141a0722ee 100644 --- a/libjava/classpath/java/lang/Package.java +++ b/libjava/classpath/java/lang/Package.java @@ -345,14 +345,13 @@ public class Package * <code>null</code> if no such annotation exists. * @since 1.5 */ - /* FIXME[GENERICS]: <T extends Annotation> T getAnnotation(Class <T>) */ - public Annotation getAnnotation(Class annotationClass) + public <A extends Annotation> A getAnnotation(Class<A> annotationClass) { - Annotation foundAnnotation = null; + A foundAnnotation = null; Annotation[] annotations = getAnnotations(); - for (int i = 0; i < annotations.length; i++) - if (annotations[i].annotationType() == annotationClass) - foundAnnotation = annotations[i]; + for (Annotation annotation : annotations) + if (annotation.annotationType() == annotationClass) + foundAnnotation = (A) annotation; return foundAnnotation; } @@ -406,8 +405,7 @@ public class Package * @return true if an annotation exists for the specified type. * @since 1.5 */ - /* FIXME[GENERICS]: Signature is Class<? extends Annotation> */ - public boolean isAnnotationPresent(Class + public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) { return getAnnotation(annotationClass) != null; |