code: @Override
      public List<AnnotationInfoImpl> getAnnotations() {
          if (annotations != null) {
              return annotations;
          }
  
          // Several cases where superclasses contribute no annotations.  In
          // each of these cases case, simply re-use the declared annotations
          // collection.
          //
          // (One case: All of the inheritable superclass annotations is
          // overridden by the immediate class, is not detected.)
  
          ClassInfoImpl useSuperClass = getSuperclass(); // Null for 'java.lang.Object'; null for interfaces.  
          if (useSuperClass == null) {
                  annotations = declaredAnnotations;
              return annotations;
                      }
  
          // Retrieve *all* annotations of the superclass.  The effect
          // is to recurse across annotations of all superclasses.
  
          List<AnnotationInfoImpl> superAnnos = useSuperClass.getAnnotations();
          if (superAnnos.isEmpty()) {
              annotations = declaredAnnotations;
              return annotations;
                  }
  
          Map<String, AnnotationInfoImpl> allAnnotations =
                          new HashMap<String, AnnotationInfoImpl>(superAnnos.size() + declaredAnnotations.size(), 1.0f);
  
          boolean sawInherited = false;
          for (AnnotationInfoImpl superAnno : superAnnos) {
              if (sawInherited = superAnno.isInherited()) {
                  allAnnotations.put(superAnno.getAnnotationClassName(), superAnno);
              }
                  }
  
          if (!sawInherited) {
              annotations = declaredAnnotations;
              return annotations;
          }
  
          // Make sure to add the declared annotations *after* adding the super class
          // annotations.  The immediate declared annotations have precedence.
  
          // We could test the number of overwritten annotations against the
          // number of inherited annotations.  That case seems infrequent, and
          // is not implemented.
  
          for (AnnotationInfoImpl declaredAnno : declaredAnnotations) {
              AnnotationInfoImpl overwrittenAnno = allAnnotations.put(declaredAnno.getAnnotationClassName(), declaredAnno);
              if (overwrittenAnno != null) {
                  // NO-OP: But maybe we want to log this
              }
          }
  
          annotations = new ArrayList<AnnotationInfoImpl>(allAnnotations.values());
          return annotations;
      }
docs: declared + inherited