[英]Javadoc warning: no @param for type when using Lombok @Builder
when generating javadoc from sources (delomboked) I receive following warnings for the builder classes generated by the Lombok's @Builder
从源(delomboked)生成 javadoc 时,我收到以下由 Lombok 的
@Builder
生成的构建器类的警告
[ERROR] Error while creating javadoc report:
Exit code: 1 - /path/to/project/ProjectData.java:85: warning: no @param for type
public ProjectData.ProjectDataBuilder type(final ProjectType type) {
Here is a part of delomboked class causing warning:这是导致警告的 delomboked class 的一部分:
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
public ProjectData.ProjectDataBuilder type(final ProjectType type) {
this.type = type;
return this;
}
And here is what is assumed a proper, no warning-producing javadoc - with @param
present这是假定的正确的、不产生警告的 javadoc - 存在
@param
/**
* @param type some meaningful description
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
public ProjectData.ProjectDataBuilder type(final ProjectType type) {
this.type = type;
return this;
}
Is there a way to make de-lombok generate these as well?有没有办法让 de-lombok 也生成这些? There are a lot of such warning in my project and they kind of clouds all the relevant actual errors.
我的项目中有很多这样的警告,它们掩盖了所有相关的实际错误。
With the latest Lombok versions¹, delombok will copy the @param
placed in the field Javadoc to the corresponding builder method.使用最新的 Lombok 版本¹,delombok 会将放置在字段 Javadoc 中的
@param
复制到相应的构建器方法。
This is an extension of the existing @Getter/@Setter
feature, which already moved @param
/ @return
to the corresponding setter/getter.这是现有
@Getter/@Setter
功能的扩展,该功能已将@param
/ @return
移动到相应的 setter/getter。
You can also optionally put fully custom documentation using -- SETTER --
/ -- GETTER --
(the @param
and @return
tags must then be in the corresponding section in that case):您还可以选择使用
-- SETTER --
/ -- GETTER --
@param
完全自定义的文档(在这种情况下,@param 和@return
标记必须在相应的部分中):
@Builder
@Data
@AllArgsConstructor
public class LombokJavadoc {
/**
* my nice field
*
* -- SETTER --
* sets the something
*
* @param something a nice value
* -- GETTER --
* access for something
*
* @return a nice value
*/
private String something;
}
Generates:生成:
public class LombokJavadoc {
/**
* my nice field
*/
private String something;
@java.lang.SuppressWarnings("all")
public static class LombokJavadocBuilder {
[…]
/**
* sets the something
*
* @param something a nice value
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
public LombokJavadoc.LombokJavadocBuilder something(final String something) {
this.something = something;
return this;
}
}
[…]
/**
* access for something
*
* @return a nice value
*/
@java.lang.SuppressWarnings("all")
public String getSomething() {
return this.something;
}
/**
* sets the something
*
* @param something a nice value
*/
@java.lang.SuppressWarnings("all")
public void setSomething(final String something) {
this.something = something;
}
[…]
}
¹ This appears to actually have been implemented in PR #2008 , which was part of v1.18.6 ¹ 这似乎实际上已在 PR #2008中实现,它是v1.18.6的一部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.