180 List<DocTree> fullBody =
181 makeDescriptionWithName("doclet.record_constructor_doc.fullbody", te.getSimpleName());
182
183 List<DocTree> tags = new ArrayList<>();
184 java.util.List<? extends VariableElement> parameters = ee.getParameters();
185 for (VariableElement param : ee.getParameters()) {
186 Name name = param.getSimpleName();
187 IdentifierTree id = treeFactory.newIdentifierTree(name);
188 tags.add(treeFactory.newParamTree(false, id,
189 makeDescriptionWithComponent("doclet.record_constructor_doc.param_name", te, name)));
190 }
191
192 DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, tags);
193 dcTreesMap.put(ee, new DocCommentDuo(null, docTree));
194 }
195
196 /**
197 * Generates the description for the standard {@code equals} method for a record.
198 * @param ee the {@code equals} method
199 */
200 @SuppressWarnings("removal")
201 public void setRecordEqualsTree(ExecutableElement ee) {
202 List<DocTree> fullBody = new ArrayList<>();
203 add(fullBody, "doclet.record_equals_doc.fullbody.head");
204 fullBody.add(treeFactory.newTextTree(" "));
205
206 List<? extends RecordComponentElement> comps = ((TypeElement) ee.getEnclosingElement()).getRecordComponents();
207 boolean hasPrimitiveComponents =
208 comps.stream().anyMatch(e -> e.asType().getKind().isPrimitive());
209 boolean hasReferenceComponents =
210 comps.stream().anyMatch(e -> !e.asType().getKind().isPrimitive());
211 if (hasPrimitiveComponents && hasReferenceComponents) {
212 add(fullBody, "doclet.record_equals_doc.fullbody.tail.both");
213 } else if (hasPrimitiveComponents) {
214 add(fullBody, "doclet.record_equals_doc.fullbody.tail.primitive");
215 } else if (hasReferenceComponents) {
216 add(fullBody, "doclet.record_equals_doc.fullbody.tail.reference");
217 }
218 Name paramName = ee.getParameters().get(0).getSimpleName();
219 IdentifierTree id = treeFactory.newIdentifierTree(paramName);
220 List<DocTree> paramDesc =
|
180 List<DocTree> fullBody =
181 makeDescriptionWithName("doclet.record_constructor_doc.fullbody", te.getSimpleName());
182
183 List<DocTree> tags = new ArrayList<>();
184 java.util.List<? extends VariableElement> parameters = ee.getParameters();
185 for (VariableElement param : ee.getParameters()) {
186 Name name = param.getSimpleName();
187 IdentifierTree id = treeFactory.newIdentifierTree(name);
188 tags.add(treeFactory.newParamTree(false, id,
189 makeDescriptionWithComponent("doclet.record_constructor_doc.param_name", te, name)));
190 }
191
192 DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, tags);
193 dcTreesMap.put(ee, new DocCommentDuo(null, docTree));
194 }
195
196 /**
197 * Generates the description for the standard {@code equals} method for a record.
198 * @param ee the {@code equals} method
199 */
200 @SuppressWarnings("preview")
201 public void setRecordEqualsTree(ExecutableElement ee) {
202 List<DocTree> fullBody = new ArrayList<>();
203 add(fullBody, "doclet.record_equals_doc.fullbody.head");
204 fullBody.add(treeFactory.newTextTree(" "));
205
206 List<? extends RecordComponentElement> comps = ((TypeElement) ee.getEnclosingElement()).getRecordComponents();
207 boolean hasPrimitiveComponents =
208 comps.stream().anyMatch(e -> e.asType().getKind().isPrimitive());
209 boolean hasReferenceComponents =
210 comps.stream().anyMatch(e -> !e.asType().getKind().isPrimitive());
211 if (hasPrimitiveComponents && hasReferenceComponents) {
212 add(fullBody, "doclet.record_equals_doc.fullbody.tail.both");
213 } else if (hasPrimitiveComponents) {
214 add(fullBody, "doclet.record_equals_doc.fullbody.tail.primitive");
215 } else if (hasReferenceComponents) {
216 add(fullBody, "doclet.record_equals_doc.fullbody.tail.reference");
217 }
218 Name paramName = ee.getParameters().get(0).getSimpleName();
219 IdentifierTree id = treeFactory.newIdentifierTree(paramName);
220 List<DocTree> paramDesc =
|