JDK-8137066 : Provide an abstract class to improve the new doclet usability.
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2015-09-23
  • Updated: 2019-11-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
The basis of the new doclet are interfaces; primarily, jdk.javadoc.Doclet.
It is laborious for a casual implementer of this interface to provide all the
interface methods, providing an AbstractDoclet would help such a user
by removing the need to implement all the boiler plate required.

Joe's comments:
"The code to create the "someoption" option in the example program is rather verbose. I encourage the doclet team to explore supporting coding patterns similar to those enabled by the SupportedAnnotationTypes, SupportedOptions, and SupportedSourceVersion annotation types which can be used on annotation processors. In brief, the utility AbstractProcessor class can read annotations on concrete subclasses and act on that information. This cut down greatly on annotation processing boilerplate which we suffered through with apt. 
Digressing a bit, to adopt the AbstractDoclet pattern and annotations, here's what a doclet might look like

@DocletName("Fred")
@DocletOptions({@DocletOption(count=1, name="Bob", ...)})
@SupportedSourceVersion(RELEASE_9) // Use existing annotation from javax.annotation.processing
@DefaultLocale("ENGLISH", "US",) // Map this to one, two, and three arg Locale constructors
public class Joe_s_Doclet extends AbstactDoclet {
  @Override
  boolean run(Environment env) {...}


 // Code from the superclass handles returning the name, supported source version, etc.
} "

Jon's suggestions:
"The impl for AbstractDoclet.getName could be the simple name of the class

@Override
public String getName() {
     return getClass().getSimpleName();
}"