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 摘要。