Lombok在自动生成构造函数时会忽略字段的注释。是否有办法在构造函数输入参数中保留字段的注释?
生成构造函数的类,
@RequiredArgsConstructor(onConstructor = @__(@Inject))
public class Test {
@Named("MyField")
private final String field;
@Named("MyHandler")
private final SomeHandler handler;
}
生成的类:
public class Test {
@Named("MyField")
private final String field;
@Named("MyField")
private final SomeHandler handler;
@Inject
public Test(final String field, final SomeHandler handler) {
this.field = field;
this.handler = handler;
}
}
期望的类:
public class Test {
@Named("MyField")
private final String field;
@Named("MyHandler")
private final SomeHandler handler;
@Inject
public Test(@Named("MyField")final String field,
@Named("MyHandler")final SomeHandler handler) {
this.field = field;
this.handler = handler;
}
}