mapstruct / mapstruct/mapstruct-idea

Converter implementation is not refreshed in IDEA

未關閉
#13 10 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Java
星號
168
分支
41
PR 合併指標
30 天內沒有已合併 PR

描述

Using https://github.com/mapstruct/mapstruct-examples/tree/master/mapstruct-lombok as a reference, I tried to add a field to both Source and Target and then modified the test to cover the new field.

@Test
public void testMapping() {
    Source s = new Source();
    s.setTest( "5" );
    s.setField( "5" );

    Target t = Mappers.getMapper(SourceTargetMapper.class).toTarget( s );
    assertEquals( 5, (long) t.getTesting() );
    assertEquals( "5", t.getField() );
}

However this leads to the test to fail, being t.getField() still null.

Another relevant change I did (which I am not sure about) is to add mapstruct-processor to the compile configuration in build.gradle, ie: compile "org.mapstruct:mapstruct-jdk8:${mapstructVersion}", "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}" as per http://mapstruct.org/documentation/ide-support/

Also removing a field from both objects leads to an error, this time a java.lang.NoSuchMethodError.

Versions used:

  • IDEA 2017.2.5 (with annotation processor manually enabled, no other customization)
  • lombok 1.16.18 (instead of 1.16.14)

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用 mapstruct-lombok 範例及其 Source、Target 和 test 作為重現案例;先檢查 build.gradle 和 IDEA 的 annotation processor 設定。重現新增欄位和移除欄位的情況,然後確認產生的 converter 反映了變更,且 test 不再回報 null 或 NoSuchMethodError。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
developer-experience, tooling
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。