jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java
changeset 15534 19228f4aedb4
parent 15511 8f45487ac694
child 15659 e575dab44ff5
--- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Mon Feb 04 11:58:43 2013 -0800
+++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java	Mon Feb 04 17:56:29 2013 -0800
@@ -91,6 +91,9 @@
      * <p>The truth value returned by this method is equivalent to:
      * {@code getAnnotation(annotationClass) != null}
      *
+     * <p>The body of the default method is specified to be the code
+     * above.
+     *
      * @param annotationClass the Class object corresponding to the
      *        annotation type
      * @return true if an annotation for the specified annotation
@@ -98,7 +101,9 @@
      * @throws NullPointerException if the given annotation class is null
      * @since 1.5
      */
-     boolean isAnnotationPresent(Class<? extends Annotation> annotationClass);
+    default boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
+        return getAnnotation(annotationClass) != null;
+    }
 
    /**
      * Returns this element's annotation for the specified type if