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

TypeConversion seems to fail when going to 1.2.0.Beta1 #1121

Closed
iersel opened this Issue Mar 3, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@iersel

iersel commented Mar 3, 2017

When going to MapStruct 1.2.0.Beta1 we get the following errors:

[ERROR] Can't map property "java.math.BigInteger numberOfLayerComponents" to "java.lang.Integer numberOfLayerComponents". Consider to declare/implement a mapping method: "java.lang.Integer map(java.math.BigInteger value)".

Seems that typeconversion no longer works between Integer and BigDecimal

While it compiled on 1.1.0.Final without a problem.

@iersel

This comment has been minimized.

Show comment
Hide comment
@iersel

iersel Mar 3, 2017

Note: MapStruct used to generate:

        if ( sources.getNumberOfLayerComponents() != null ) {
            targets.setNumberConstituents( BigDecimal.valueOf( sources.getNumberOfLayerComponents() ) );
        }

iersel commented Mar 3, 2017

Note: MapStruct used to generate:

        if ( sources.getNumberOfLayerComponents() != null ) {
            targets.setNumberConstituents( BigDecimal.valueOf( sources.getNumberOfLayerComponents() ) );
        }
@iersel

This comment has been minimized.

Show comment
Hide comment
@iersel

iersel Mar 3, 2017

We are using an update method (with @MappingTarget)

iersel commented Mar 3, 2017

We are using an update method (with @MappingTarget)

@agudian agudian added this to the 1.2-next milestone Mar 3, 2017

@agudian agudian added the bug label Mar 3, 2017

@agudian

This comment has been minimized.

Show comment
Hide comment
@agudian

agudian Mar 3, 2017

Member

Great, thanks for reporting! We'll need to look into it for the next release.

Member

agudian commented Mar 3, 2017

Great, thanks for reporting! We'll need to look into it for the next release.

@sjaakd sjaakd self-assigned this Mar 3, 2017

@sjaakd

This comment has been minimized.

Show comment
Hide comment
@sjaakd

sjaakd Mar 3, 2017

Contributor

@iersel I can't reproduce it. Lets have a better look on tuesday.

Contributor

sjaakd commented Mar 3, 2017

@iersel I can't reproduce it. Lets have a better look on tuesday.

@sjaakd

This comment has been minimized.

Show comment
Hide comment
@sjaakd

sjaakd Mar 7, 2017

Contributor

I've managed to reproduce it. It seems to happen when source and target are in a different jar then the mapper. Need to check how to set this up in unit test.Perhaps using bean-style objects in the java lib (and hope it works)? Candidates?

Contributor

sjaakd commented Mar 7, 2017

I've managed to reproduce it. It seems to happen when source and target are in a different jar then the mapper. Need to check how to set this up in unit test.Perhaps using bean-style objects in the java lib (and hope it works)? Candidates?

@sjaakd

This comment has been minimized.

Show comment
Hide comment
@sjaakd

sjaakd Mar 7, 2017

Contributor

problem is most likely in Type#hashCode which uses TypeMirror#hashCode. JavaDoc TypeMirror: Types should be compared using the utility methods in Types. There is no guarantee that any particular type will always be represented by the same object.

Ergo: if they are in different jar's these are most likely not the same objects.. Verifying now..

Contributor

sjaakd commented Mar 7, 2017

problem is most likely in Type#hashCode which uses TypeMirror#hashCode. JavaDoc TypeMirror: Types should be compared using the utility methods in Types. There is no guarantee that any particular type will always be represented by the same object.

Ergo: if they are in different jar's these are most likely not the same objects.. Verifying now..

sjaakd added a commit to sjaakd/mapstruct that referenced this issue Mar 7, 2017

sjaakd added a commit to sjaakd/mapstruct that referenced this issue Mar 8, 2017

sjaakd added a commit to sjaakd/mapstruct that referenced this issue Mar 8, 2017

sjaakd added a commit to sjaakd/mapstruct that referenced this issue Mar 8, 2017

@sjaakd

This comment has been minimized.

Show comment
Hide comment
@sjaakd

sjaakd Mar 8, 2017

Contributor

Should be solved..

Contributor

sjaakd commented Mar 8, 2017

Should be solved..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment