【发布时间】:2021-07-16 10:34:53
【问题描述】:
我正在使用 Gradle 来包含 Lombok,并且按照建议,我正在使用 freefair lombok 插件;
plugins {
id "io.freefair.lombok" version "6.0.0-m2"
// ...
}
给定以下类:
/**
* Request to add a task to an existing todo list.
*
* @author b_muth
*
*/
@Value
public class AddTaskRequest{
/**
* Identifier of the list.
*/
@NonNull UUID todoListId;
/**
* Name of the task to be added.
*/
@NonNull String taskName;
}
我收到以下警告:
C:\...\generated\sources\delombok\...\AddTaskRequest.java:23: warning: no comment
public AddTaskRequest(@NonNull final UUID todoListId, @NonNull final String taskName)
C:\...\generated\sources\delombok\...\AddTaskRequest.java:38: warning: no @return
public UUID getTodoListId() {
还有更多。据我所知,freefair 使用 delombok,但没有在生成的源代码中创建足够的 JavaDoc。这是生成的类的摘录:
/**
* Request to add a task to an existing todo list.
*
* @author b_muth
*/
public final class AddTaskRequest {
/**
* Identifier of the list.
*/
@NonNull
private final UUID todoListId;
/**
* Name of the task to be added.
*/
@NonNull
private final String taskName;
public AddTaskRequest(@NonNull final UUID todoListId, @NonNull final String taskName) {
if (todoListId == null) {
throw new NullPointerException("todoListId is marked non-null but is null");
}
if (taskName == null) {
throw new NullPointerException("taskName is marked non-null but is null");
}
this.todoListId = todoListId;
this.taskName = taskName;
}
/**
* Identifier of the list.
*/
@NonNull
public UUID getTodoListId() {
return this.todoListId;
}
...
}
是否可以阻止这些警告的发生?
【问题讨论】: