mapstruct / mapstruct/mapstruct-examples

mapstruct-protobuf3 use lombok:UnsupportedOperationException(Collections$UnmodifiableCollection)

未关闭
#142 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
1.4k
派生
504
PR 合并指标
30 天内没有已合并 PR

描述

modify mapstruct-protobuf3/usage/pom.xml plugin config,



org.mapstruct
mapstruct-processor
${org.mapstruct.version}


org.projectlombok
lombok
${org.projectlombok.version}


org.projectlombok
lombok-mapstruct-binding
${lombok-mapstruct-binding.version}



org.mapstruct.examples.spi
protobuf-spi-impl
1.0.0


`

rebuild the mapstruct-protobuf3, run the test,report an error
`java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.addAll(Collections.java:1065)
at org.mapstruct.example.mapper.UserMapperImpl.map(UserMapperImpl.java:34)
at org.mapstruct.example.ProtobufTest.test(ProtobufTest.java:33),`

Partially generated code

```
if ( userDTO.getMainDepartmentsList() != null ) {
List list = departmentListToDepartmentDTOList( user.getMainDepartments() );
if ( list != null ) {
userDTO.getMainDepartmentsList().addAll( list );
}

}
if ( userDTO.getDepartmentsList() != null ) {

List list1 = departmentListToDepartmentDTOList( user.getDepartments() );
if ( list1 != null ) {
userDTO.getDepartmentsList().addAll( list1 );
}
```

recover mapstruct-protobuf3/usage/pom.xml plugin config, run test success.
Is there any way to solve this problem?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 mapstruct-protobuf3/usage/pom.xml 开始,检查 issue 中所示的 annotationProcessorPaths 配置。重新构建 mapstruct-protobuf3 示例并运行 mapstruct-protobuf3/usage/src/test/.../ProtobufTest.java,检查生成的 UserMapperImpl.java 代码,并确认测试在没有 UnsupportedOperationException 的情况下完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
build-system, testing
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。