GithubHelp home page GithubHelp logo

Comments (13)

l0co avatar l0co commented on June 13, 2024 1

That's interesting. I've extracted separate testcase and ... you're right. This problem is somehow related to our multi module project structure. However, the warning is shown for both kinds of submodules - these using mapstruct, and these not. We will try to dig into this.

@filiphr Thanks!

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

@lvcyong I don't understand what you mean with this issue.

Can you please clarify?

If you are referring from the compiler output that you get this comes from the Java Annotation Processor running the Mapstruct processor and it seems you have unmapped target properties.

from mapstruct-idea.

l0co avatar l0co commented on June 13, 2024

How to disable this warning?

My clarification: this warning is a little annoying if you want to map entities to views/DTO or views/DTO to entities. In such scenario you will almost always have some unmapped properties (intentionally), because if you want to have all properties mapped between these two objects, why would you use mapstruct? You could just expose your domain object instead.

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

@l0co are you referring to the compilation warning?

This is not linked with the IntelliJ plugin. You have multiple options to avoid this:

from mapstruct-idea.

l0co avatar l0co commented on June 13, 2024

Yes - the compilation warning. Thanks for your hint, I removed all our warnings now. However it would be useful to have an option to disable them by default, as now they can be disabled manually per each mapper only.

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

Have you read about the Configuration options in our documentation? You can disable them via a compiler option. However, I strongly advise against using the compiler option. I always advise to explicitly define what you need too map

from mapstruct-idea.

l0co avatar l0co commented on June 13, 2024

I overlooked these options, thanks!

from mapstruct-idea.

l0co avatar l0co commented on June 13, 2024

Heh, it looks in java 10 the compiler option causes another warning (both gradle and Idea):

Information:javac 10 was used to compile java sources
Information:10.05.18 09:08 - Compilation completed successfully with 1 warning in 3s 64ms
Warning:java: The following options were not recognized by any processor: '[mapstruct.unmappedTargetPolicy]'

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

We haven't really tested MapStruct with Java 10, but it should work. Are you still getting the unmapped target properties, or not?

from mapstruct-idea.

l0co avatar l0co commented on June 13, 2024

Are you still getting the unmapped target properties, or not?

With -Amapstruct.unmappedTargetPolicy=IGNORE there's no more errors about unmapped properties. However there's persistent The following options were not recognized by any processor warning (don't know if it's related to JDK 10). Because of this I've sadly needed to get back to per-mapper annotation option because I've spent almost two hours to get rid of this, without any success (only -Xlint:none works).

FYI: We need to have absolutely no warnings in the build process. Because we heavily use JDK serialization we need to ensure that each Serializable class has serialVersionUID field and we use warnings for that with -Xlint:serial -Werror options. So either first of second class of warnings related to mapstruct is harmful for us.

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

If you don't see any MapStruct warnings with -Amapstruct.unmappedTargetPolicy=IGNORE then there is a processor that consumes that option 😄.

The problem you are seeing might be if you have a multi module project and you set that property for all modules, but you have the MapStruct compiler only for some modules. The other explanation would be that something has changed in JDK 10 and we are not marking that property as consumed, or the JDK 10 compiler has some bug,

from mapstruct-idea.

filiphr avatar filiphr commented on June 13, 2024

@l0co I am not sure if you resolved your problem. However, I think that it might be related to mapstruct/mapstruct#1638. You might want to look into the test compile outputting this as well.

I am going to close this issue for now as there is nothing that the plugin can do

from mapstruct-idea.

steklopod avatar steklopod commented on June 13, 2024

You can do like this:

@Mapper
interface CustomerConverter {
    @Mapping(source = "email", target = "nickname")
    fun toPersonDto(customer: Customer): CustomerDto

    @InheritInverseConfiguration
    @Mapping(target = "age", ignore = true)
    fun fromPersonDto(customerDto: CustomerDto): Customer
}

from mapstruct-idea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.