javac8 annotation processors don't visit parameter annotations

Joseph Darcy joe.darcy at
Thu Mar 6 02:25:37 UTC 2014



Yes, the visitExecutable implementation in a scanner should traverse the 
parameters of the executable, as done in the ElementScanner superclass.

Thanks for catching this Liam and sending in a patch,


On 3/5/2014 1:49 PM, Liam Miller-Cushon wrote:
> There appears to be a javac8 bug that prevents annotation processors 
> from visiting annotations on parameters. When repeated annotations 
> were implemented [1][2] the annotation scanners in 
> JavacProcessingEnvironment and JavacRoundEnvironment were modified and 
> the following override was added:
> @Override
> public Set<TypeElement> visitExecutable(ExecutableElement e, 
> Set<TypeElement> p) {
>   // Type parameters are not considered to be enclosed by an executable
>   scan(e.getTypeParameters(), p);
>   return scan(e.getEnclosedElements(), p);
> }
> MethodSymbols don't have any enclosed elements, but they do have 
> parameters (which currently aren't being visited). I think that line 
> was meant to match the base implementation in ElementScanner:
> return scan(e.getParameters(), p);
> [1]
> [2]

More information about the compiler-dev mailing list