Unexpected warning: ''.'' should not be used as a source
まだ誰も着手していません。
評価
調査の方向性
まず FooMapper の例で警告を再現し、MapStruct IntelliJ plugin が source が "." である @Mapping の値をどのように処理するかを調べます。その動作を、MapStruct がこの source 形式をサポートしているというドキュメント上の記載と比較します。有効なマッピングに対して誤った警告が表示されなくなるか、警告の理由が明確に特定できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I often have a use-case when "." is a valid and correct source of my mapping. It is officially supported mapping source, so why the plugin reports it as "should not be used"? Is there any particular reason or maybe it is just a historical burden from the times when MapStruct actually didn't support "." as a source?
Example:
record Failure(String code, String detail) {}
class Foo {
Failure failure;
}
class FooDto {
String failureCode;
String failureDetail;
}
public abstract class FooMapper {
@Mapping(target = "failure", source = ".")
public abstract Foo fromDto(FooDto fooDto);
protected Failure mapFailure(FooDto fooDto) {
return new Failure(fooDto.getFailureCode(), fooDto.getFailureDetail());
}
}
Of course, in this particular case we can just use:
@Mapping(target = "failure.code", source = "failureCode")
@Mapping(target = "failure.detail", source = "failureDetail")
But there are more complex cases when the target object should be created manually, by a custom code, and the only possible source is the whole source object.
- 主要言語
- Java
- スター
- 168
- フォーク
- 41
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mapstruct/mapstruct-idea のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
mapstruct/mapstruct-idea#274 · コメント 2 件 ·
-
feature hack.commit.push
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
mapstruct/mapstruct-idea#267 ·
-
feature hack.commit.push
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
mapstruct/mapstruct-idea#266 ·
-
feature hack.commit.push
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
mapstruct/mapstruct-idea#265 ·
-
hack.commit.push
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
mapstruct/mapstruct-idea#256 ·
mapstruct/mapstruct-idea の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FasterXML/jackson-databind#6229 ·