mapstruct-protobuf3 use lombok:UnsupportedOperationException(Collections$UnmodifiableCollection)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, testing
Research direction
Start with mapstruct-protobuf3/usage/pom.xml and inspect the annotationProcessorPaths configuration shown in the issue. Rebuild the mapstruct-protobuf3 example and run mapstruct-protobuf3/usage/src/test/.../ProtobufTest.java, checking the generated UserMapperImpl.java code and confirming that the test completes without UnsupportedOperationException.
Written by the indexing model from the issue text.
Description
modify mapstruct-protobuf3/usage/pom.xml plugin config,
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>${lombok-mapstruct-binding.version}</version>
</path>
<path>
<!-- Add your SPI implementation. -->
<groupId>org.mapstruct.examples.spi</groupId>
<artifactId>protobuf-spi-impl</artifactId>
<version>1.0.0</version>
</path>
</annotationProcessorPaths>
`
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<UserProtos.DepartmentDTO> list = departmentListToDepartmentDTOList( user.getMainDepartments() );
if ( list != null ) {
userDTO.getMainDepartmentsList().addAll( list );
}
}
if ( userDTO.getDepartmentsList() != null ) {
List<UserProtos.DepartmentDTO> 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?
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 504
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapstruct/mapstruct-examples
-
Java 21 support Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mapstruct/mapstruct-examples#153 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapstruct/mapstruct-examples#149 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 15/100
mapstruct/mapstruct-examples#138 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapstruct/mapstruct-examples#128 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mapstruct/mapstruct-examples#127 ·
All issues in mapstruct/mapstruct-examples
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100