On Tue, 16 Aug 2022 07:17:41 GMT, Hannes Greule <d...@openjdk.org> wrote:

> Sorry, it looks like there is no way to access the synthetic/mandated 
> information using the annotation processing API. Am I missing something?

For reasons of providing a minimal core language model that could be reused, 
less essential functionality is split in the language model API to be provided 
by an implementation of javax.lang.model.util.Elements.

So if you subclass JavacTestingAbstractProcessor files that test directory, you 
could use

eltUtils.getOrigin(elementForParameter)

to see if an element is marked as javax.lang.model.util.Enum 
Elements.Origin.{MANDATED, SYNTHETIC}.

Many of the annotation processing tests use a pattern of using a 
runtime-retention annotation to encode what the expected answer is. In this 
case, I'd recommend a method/constructor annotation to hold the expected origin 
of the parameters.

(The annotation processing API does filter out some SYNTHETIC constructs, but I 
don't recall if that is done at a parameter level.)

HTH

-------------

PR: https://git.openjdk.org/jdk/pull/9862

Reply via email to