mapstruct / mapstruct/mapstruct-idea
Source value mapped more than once inspection for @ValueMapping
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 168
- 分支
- 41
- PR 合併指標
- 30 天內沒有已合併 PR
描述
For value mappings a source value can only be mapped once. For example
import org.mapstruct.Mapper;
import org.mapstruct.ValueMapping;
@Mapper
public interface ValueMapper {
enum A {
A,B
}
enum B {
A,B
}
@ValueMapping(source = "A", target = "B")
@ValueMapping(source = "A", target = "A")
A from(B b);
}
is invalide as source A is mapped twice. MapStruct report this as
Source value mapping: "A" cannot be mapped more than once.
Currently the plugin does not recognize this as an error. An inspection should be added for this.
For normal mappings there is already an inspection implemented and could be used as an example: https://github.com/mapstruct/mapstruct-idea/blob/main/src/main/java/org/mapstruct/intellij/inspection/TargetPropertyMappedMoreThanOnceInspection.java.
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 src/main/java/org/mapstruct/intellij/inspection/TargetPropertyMappedMoreThanOnceInspection.java 開始,該檔案提供了現有的 inspection 模式。追蹤它如何偵測重複的一般 mapping,然後對 @ValueMapping 的來源值套用相同的方法。完成的標準是能夠識別重複的來源值,並使用預期的錯誤訊息進行回報。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 75/100