Search code examples
javaconstructorjavadocdoclet

Can Javadoc doclets identify a nullary constructor (compiler-created default constructor)?


In creating a software application, I'm creating a doclet to be plugged into Javdoc. One problem I'm having with the use of Javadoc and the RootDoc that is created is that it includes nullary constructors created by the compiler. Is there a way to prevent this from happening or identifying them via the RootDoc provided to my doclet? I thought I made headway on this last night when I discovered the isSynthetic method, but nullary constructors are apparently not synthetic.


Solution

  • Further investigation indicates that SourcePosition returned for the enclosing ClassDoc has the same line and column numbers as the SourcePosition returned for the generated default constructor (an undocumented feature!). I'm successfully using this as a discriminator.