Javac Tree API suggestions to more closely model source code
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Sep 30 18:24:57 UTC 2014
On 09/29/2014 06:19 PM, Harry Terkelsen wrote:
> Cannot tell if an argument VariableTree is varargs. This required
> casting to JCTree, which feels hacky:
> JCModifiers mods = (JCModifiers) node.getModifiers();
> return (mods.flags & VARARGS) != 0;
varargs-ness is a property of an executable element, not of a variable
declaration.
The method you are looking for is
javax.lang.model.element.ExecutableElement#isVarArgs()
-- Jon
More information about the compiler-dev
mailing list