You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Record classes are unmodifiable data class introduced in Java 16 and included in the recent LTS version Java 17. Since records are a new syntax for Java, they generate an ElementKind.RECORD AST element instead of ElementKind.CLASS and are not supported by the current visitor.
Javadoc for a record is the same as a regular class, except it may include @param fields referring to record components:
/** * Example class. * * @param a first component input * @param b second input */publicclassFoo(booleana, Stringb) {
/** Alternate constructor */publicFoo(booleana) {
this(a, null);
}
}
General thoughts:
As best as I can tell, the compiler doesn't attach any docs to the generated fields or methods, or to the primary constructor
There's no way to directly comment the record components
Depending on how an implementation might balance representation vs. intent:
The class docs could be re-applied to the primary constructor, which can be determined by the GENERATED or RECORD flags set on the method (which I think is specified, but I can't find the exact mention in the JVM spec)
@param tags from the primary constructor could be applied to the fields and/or methods
The text was updated successfully, but these errors were encountered:
The 0.13.0 release will add basic support for records. Record class docs will be retained, as well as docs for secondary constructors and other methods and fields defined in the record.
There will also be a new method ClassJavadoc.getRecordComponents() that returns any @param tags from the class docs.
I filed #60 for attaching docs to the canonical constructor and generated component accessors.
@see on classes appears under other #59
* Retain javadoc for record classes.
* Add ClassJavadoc.getRecordComponents() which returns any "param" tags in the class doc.
* ClassJavadoc.getSeeAlso() now returns the "see" tags (previously they were lumped in with getOther())
Record classes are unmodifiable data class introduced in Java 16 and included in the recent LTS version Java 17. Since records are a new syntax for Java, they generate an
ElementKind.RECORD
AST element instead ofElementKind.CLASS
and are not supported by the current visitor.Javadoc for a record is the same as a regular class, except it may include
@param
fields referring to record components:General thoughts:
Depending on how an implementation might balance representation vs. intent:
GENERATED
orRECORD
flags set on the method (which I think is specified, but I can't find the exact mention in the JVM spec)@param
tags from the primary constructor could be applied to the fields and/or methodsThe text was updated successfully, but these errors were encountered: