Skip to content

De-Lombok the project #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gsdatta opened this issue Sep 21, 2020 · 5 comments · Fixed by #175
Closed

De-Lombok the project #174

gsdatta opened this issue Sep 21, 2020 · 5 comments · Fixed by #175
Assignees
Milestone

Comments

@gsdatta
Copy link
Contributor

gsdatta commented Sep 21, 2020

Hi, would you be open to using delombok (either at build time or on the entire codebase) from this project? Lombok makes it incompatible with Kotlin (see https://stackoverflow.com/questions/35517325/kotlin-doesnt-see-java-lombok-accessors/35530223#35530223) from the Kotlin team.

Lombok provides already a de-lombok tool https://projectlombok.org/features/delombok that could be used for this, which would then make it compatible with Kotlin.

@quen2404
Copy link
Member

quen2404 commented Sep 22, 2020

Hi @gsdatta, lombok was using to simplify development. But if this tool is problematic for Kotlin users, we can remove it :)
I will try to use delombok ;)

@quen2404 quen2404 self-assigned this Sep 22, 2020
@quen2404 quen2404 mentioned this issue Sep 22, 2020
@gsdatta
Copy link
Contributor Author

gsdatta commented Sep 22, 2020

Thanks @quen2404!

@joschi
Copy link
Contributor

joschi commented Sep 23, 2020

Lombok makes it incompatible with Kotlin

@gsdatta Wouldn't this only affect you if you wanted to use the annotated POJOs as source files in your project? It should work without a problem if you're using org.openapitools.openapidiff:openapi-diff-core as a dependency in your projects.

Did you run into the problem you've described with openapi-diff?

@joschi
Copy link
Contributor

joschi commented Oct 5, 2020

@gsdatta Any additional input?

@hiddewie
Copy link
Contributor

I think I ran into this problem today in Kotlin when deserializing a full ChangedOpenApi object which is exposed over HTTP as JSON. There is no contructor available, which would normally be added by Lombok (@Data).

Using Spring Boot 2.3, Jackson Serialization (with Kotlin support).

Example test case:

        webClient.post()
            .uri("/diff")
            .bodyValue(diffRequest)
            .exchange()
            .expectStatus().is2xxSuccessful
            .returnResult(ChangedOpenApi::class.java)
            .responseBody
            .blockFirst()!! // Fail with NullPointer if there is no response

Example test output:

xxxxxxxxxxxxxxx.OpenApiDiffTest > Diff changed summary() FAILED                                                                                                               
    org.springframework.core.codec.CodecException: Type definition error: [simple type, class com.qdesrame.openapi.diff.core.model.ChangedOperation]; nested exception is com.fasterx
ml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.qdesrame.openapi.diff.core.model.ChangedOperation` (no Creators, like default constructor, exis
t): cannot deserialize from Object value (no delegate- or property-based Creator)                                                                                                    
     at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.qdesrame.openapi.diff.core.model.ChangedOpenApi["changedOperations"]->java.util.ArrayList[0])          
        at org.springframework.http.codec.json.AbstractJackson2Decoder.processException(AbstractJackson2Decoder.java:211)                                                            
                                                                                                                                                                                     
        Caused by:                                                                                                                                                                   
        com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.qdesrame.openapi.diff.core.model.ChangedOperation` (no Creators, like defaul
t constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)                                                                                 
         at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.qdesrame.openapi.diff.core.model.ChangedOpenApi["changedOperations"]->java.util.ArrayList[0])      
            at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)                                                                
            at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1615)                                                           
            at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)                                                                          
            at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1077)                                                     
            at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1332)                                        
            at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:331)                                                                
            at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:164)                                                                          

@joschi joschi added this to the Release 2.0.0 milestone Oct 16, 2020
joschi pushed a commit that referenced this issue Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants