436 Name name = ee.getSimpleName();
437 if (name.contentEquals("values") && ee.getParameters().isEmpty()) {
438 utils.removeCommentHelper(ee); // purge previous entry
439 cmtUtils.setEnumValuesTree(ee);
440 } else if (name.contentEquals("valueOf") && ee.getParameters().size() == 1) {
441 // TODO: check parameter type
442 utils.removeCommentHelper(ee); // purge previous entry
443 cmtUtils.setEnumValueOfTree(ee);
444 }
445 }
446 }
447
448 /**
449 * Sets the documentation as needed for the mandated parts of a record type.
450 * This includes the canonical constructor, methods like {@code equals},
451 * {@code hashCode}, {@code toString}, the accessor methods, and the underlying
452 * field.
453 * @param elem the record element
454 */
455
456 @SuppressWarnings("removal")
457 private void setRecordDocumentation(TypeElement elem) {
458 CommentUtils cmtUtils = configuration.cmtUtils;
459 Set<Name> componentNames = elem.getRecordComponents().stream()
460 .map(Element::getSimpleName)
461 .collect(Collectors.toSet());
462
463 for (ExecutableElement ee : utils.getConstructors(elem)) {
464 if (utils.isCanonicalRecordConstructor(ee)) {
465 if (utils.getFullBody(ee).isEmpty()) {
466 utils.removeCommentHelper(ee); // purge previous entry
467 cmtUtils.setRecordConstructorTree(ee);
468 }
469 // only one canonical constructor; no longer need to keep looking
470 break;
471 }
472 }
473
474 for (VariableElement ve : utils.getFields(elem)) {
475 // The fields for the record component cannot be declared by the
476 // user and so cannot have any pre-existing comment.
|
436 Name name = ee.getSimpleName();
437 if (name.contentEquals("values") && ee.getParameters().isEmpty()) {
438 utils.removeCommentHelper(ee); // purge previous entry
439 cmtUtils.setEnumValuesTree(ee);
440 } else if (name.contentEquals("valueOf") && ee.getParameters().size() == 1) {
441 // TODO: check parameter type
442 utils.removeCommentHelper(ee); // purge previous entry
443 cmtUtils.setEnumValueOfTree(ee);
444 }
445 }
446 }
447
448 /**
449 * Sets the documentation as needed for the mandated parts of a record type.
450 * This includes the canonical constructor, methods like {@code equals},
451 * {@code hashCode}, {@code toString}, the accessor methods, and the underlying
452 * field.
453 * @param elem the record element
454 */
455
456 @SuppressWarnings("preview")
457 private void setRecordDocumentation(TypeElement elem) {
458 CommentUtils cmtUtils = configuration.cmtUtils;
459 Set<Name> componentNames = elem.getRecordComponents().stream()
460 .map(Element::getSimpleName)
461 .collect(Collectors.toSet());
462
463 for (ExecutableElement ee : utils.getConstructors(elem)) {
464 if (utils.isCanonicalRecordConstructor(ee)) {
465 if (utils.getFullBody(ee).isEmpty()) {
466 utils.removeCommentHelper(ee); // purge previous entry
467 cmtUtils.setRecordConstructorTree(ee);
468 }
469 // only one canonical constructor; no longer need to keep looking
470 break;
471 }
472 }
473
474 for (VariableElement ve : utils.getFields(elem)) {
475 // The fields for the record component cannot be declared by the
476 // user and so cannot have any pre-existing comment.
|