Correct annotation processing retrieval methods to handle inheritance.
Description
The methods for looking up annotations during annotation processing, introduced in , do not handle inheritance. Primarily com.globalmentor.java.model.ModelElements.elementAnnotationMirrorsForClass(Element element, Class<? extends Annotation> annotationClass) and related methods only look for declared annotations on the element. But reflection methods typically by default look for present annotations (i.e. looking up the inheritance hierarchy if the element is a class), and have separate methods with “declared” in the method name for restricting the lookup to annotations declared on the element.
Update these methods to support present annotations (i.s. supporting inheritance) by default, and create separate methods for restricting the search to declared annotations.
This will require updating the signature to several methods to provide an Elements utility instance, e.g. com.globalmentor.java.model.ModelElements.elementAnnotationMirrorsForClass(Elements elements, Element element, Class<? extends Annotation> annotationClass). Technically this is a breaking change for a method that has been published for over a year, but it’s not likely it’s used in the wild outside Flange at this time.
The methods for looking up annotations during annotation processing, introduced in , do not handle inheritance. Primarily
com.globalmentor.java.model.ModelElements.elementAnnotationMirrorsForClass(Element element, Class<? extends Annotation> annotationClass)
and related methods only look for declared annotations on the element. But reflection methods typically by default look for present annotations (i.e. looking up the inheritance hierarchy if the element is a class), and have separate methods with “declared” in the method name for restricting the lookup to annotations declared on the element.Update these methods to support present annotations (i.s. supporting inheritance) by default, and create separate methods for restricting the search to declared annotations.