mapstruct / mapstruct/mapstruct-examples

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

Đang mở
#142 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Java
Star
1.4k
Fork
504
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với mapstruct-protobuf3/usage/pom.xml và kiểm tra cấu hình annotationProcessorPaths được nêu trong issue. Build lại ví dụ mapstruct-protobuf3 và chạy mapstruct-protobuf3/usage/src/test/.../ProtobufTest.java, kiểm tra mã UserMapperImpl.java được sinh ra và xác nhận rằng test hoàn tất mà không có UnsupportedOperationException.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
build-system, testing
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.