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