mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 08:18:29 +00:00
Ignore javadoc copy errors for constructors
Lombok should not crash if it cannot copy or generate javadoc for generated code. We have already added this try...catch to all other javadoc copy methods.
This commit is contained in:
1 parent
f19a7e865a
commit
b960d0d02a
1 file changed
+20
-18
@@ -588,25 +588,27 @@ public class HandleConstructor {
|
||||
}
|
||||
|
||||
private void generateConstructorJavadoc(EclipseNode typeNode, EclipseNode constructorNode, Collection<EclipseNode> fields) {
|
||||
if (fields.isEmpty()) return;
|
||||
try {
|
||||
if (fields.isEmpty()) return;
|
||||
|
||||
String constructorJavadoc = getConstructorJavadocHeader(typeNode.getName());
|
||||
boolean fieldDescriptionAdded = false;
|
||||
for (EclipseNode fieldNode : fields) {
|
||||
String paramName = String.valueOf(removePrefixFromField(fieldNode));
|
||||
String fieldJavadoc = getDocComment(fieldNode);
|
||||
String paramJavadoc = getConstructorParameterJavadoc(paramName, fieldJavadoc);
|
||||
|
||||
if (paramJavadoc == null) {
|
||||
paramJavadoc = "@param " + paramName;
|
||||
} else {
|
||||
fieldDescriptionAdded = true;
|
||||
String constructorJavadoc = getConstructorJavadocHeader(typeNode.getName());
|
||||
boolean fieldDescriptionAdded = false;
|
||||
for (EclipseNode fieldNode : fields) {
|
||||
String paramName = String.valueOf(removePrefixFromField(fieldNode));
|
||||
String fieldJavadoc = getDocComment(fieldNode);
|
||||
String paramJavadoc = getConstructorParameterJavadoc(paramName, fieldJavadoc);
|
||||
|
||||
if (paramJavadoc == null) {
|
||||
paramJavadoc = "@param " + paramName;
|
||||
} else {
|
||||
fieldDescriptionAdded = true;
|
||||
}
|
||||
|
||||
constructorJavadoc = addJavadocLine(constructorJavadoc, paramJavadoc);
|
||||
}
|
||||
|
||||
constructorJavadoc = addJavadocLine(constructorJavadoc, paramJavadoc);
|
||||
}
|
||||
if (fieldDescriptionAdded) {
|
||||
setDocComment(typeNode, constructorNode, constructorJavadoc);
|
||||
}
|
||||
if (fieldDescriptionAdded) {
|
||||
setDocComment(typeNode, constructorNode, constructorJavadoc);
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user