を解決することはできません私はスーパーロンボク+のIntelliJは:スーパークラスのメソッド
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ErrorResponse {
@JsonProperty
private String message;
}
を持っていると私はこの
ようなオブジェクトを作成するためのビルダーを使用する場合、私は1@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder(builderMethodName = "_builder") // add custom builder name to avoid compilation issue 'return type is not compatible...'
@EqualsAndHashCode(callSuper=true)
public class AskQuestionErrorResponse extends ErrorResponse {
@JsonProperty
private String status;
@Builder(builderMethodName = "_builder") // add custom builder name to avoid compilation issue 'return type is not compatible...'
private AskQuestionErrorResponse(String status, String message){
super(message);
this.status = status;
}
}
子供を持っています
AskQuestionErrorResponse._builder()
.status(1)
.message("my message here").build()
Intellijが私にmessage
と表示され、問題が発生しました。cannot resolve method 'message(java.lang.String)'
とにかくプロジェクトコンパイルこのエラーでも実行されます。
私はすでに歳差運動を行っています。
私はこの
AskQuestionErrorResponse._builder()
.status(ex.getStatus().getValue()
//.message(ex.getMessage()
).build()
のようなスーパークラスからフィールドをコメントする場合、それは動作します。それはスーパークラスのメンバーが表示されないようです。私もmavenをきれいにしてインストールして、プロジェクトを再構築しようとしました。
注釈プロセッサがPreferences
に有効とDefault preferences
お役に立てば幸いです。 'AskQuestionErrorResponse._builder()。status(ex.getStatus()。getValue())。スーパークラスのフィールドを持たないbuild()'が完全に動作する – Vitalii
https://stackoverflow.com/questions/に役立ついくつかの追加情報があります。 24006937/lombok-annotations-do-not-compile-under-intellij-idea?rq = 1 – Mark
@Builderアノテーションに問題があるようです。可能な(しかし完全ではない)回避策については、https://reinhard.codes/2015/09/16/lomboks-builder-annotation-and-inheritance/で説明します。 – Mark