GithubHelp home page GithubHelp logo

Comments (10)

bluprince13 avatar bluprince13 commented on June 7, 2024 11

Has anyone found any workarounds other than editing the mapper to force an update?

from mapstruct-idea.

ThanksForAllTheFish avatar ThanksForAllTheFish commented on June 7, 2024 3

It seems you are actually right:

  • if I change the mapper, the generated implementation (SourceTargetMapperImpl) is updated
  • if I change source and target classes, the mapper is NOT updated
  • delegating to gradle, the implementation is updated either way (but since IDEA 2017.2 gradle and IDEA output directories are different, it probably makes sense to use gradle-idea plugin as well so to be able to configure source sets correctly)

from mapstruct-idea.

filiphr avatar filiphr commented on June 7, 2024 1

@ThanksForAllTheFish I have actually had a look into this. Unfortunately, I am not entirely sure if we as a plugin can do something about this. The reason why you are seeing that behaviour is due to the way that compilation works in IDEA.

IDEA Only compiles the classes that have been changed since the last build, and when you change Source or Target only then SourceTargetMapper won't be compiled. Maybe we need to raise an issue with Jetbrains.

I as well am not that well knowledgeable of the internals of IDEA and if someone has an idea or is willing to help out with this I am more than happy to tag along. I've asked on twitter, let's see if we get some more info

from mapstruct-idea.

filiphr avatar filiphr commented on June 7, 2024

@ThanksForAllTheFish I don't think that this is linked to the IntelliJ plugin. In any case, can you check that the generated class contains the new mapping? It might be possible that IntelliJ does not invoke the processor when you change some of the other classes.

Have you tried delegating the build to gradle?

from mapstruct-idea.

ThanksForAllTheFish avatar ThanksForAllTheFish commented on June 7, 2024

Did you have a chance to look at this?

from mapstruct-idea.

lvalladares avatar lvalladares commented on June 7, 2024

Any news on this topic? This keeps happening

from mapstruct-idea.

filiphr avatar filiphr commented on June 7, 2024

@lvalladares the status from my previous comment has not changed. I don't know the internals of IDEA that well in order to know what we can do about this.

from mapstruct-idea.

mkrumpholz avatar mkrumpholz commented on June 7, 2024

Manually recompiling the Mapper interface will regenerate the mapper implementation too. But this is also not the expected way to do it.

There is the possibility to listen on file changes and handle them, i used that in a plugin. But that would be low level on the file system api and not the best way for this use case.

The change on the java class reflected in the psi tree would be the point i would start to look at. Maybe there is something in the api that can track the link between the annotated mapper interfaces (any used bean type in it) and the beans that are changed in structure.

from mapstruct-idea.

filiphr avatar filiphr commented on June 7, 2024

I agree with all you said @mkrumpholz. I've tried looking into this, and I would want to avoid listening on any changes. In my opinion this is the job of the IDE. It should track from where a file was generated and then update recompile the mapper. This is what Eclipse and Gradle does for their incremental compilation.

from mapstruct-idea.

mkrumpholz avatar mkrumpholz commented on June 7, 2024

IDEA keeps track of the changed files, the thing to search and implement may be a trigger to add dependent files to the changelist. I can't provide the code for this as i didn't implement such case yet. Maybe the docs are good enough now to find some more hints on how to implement this? The custom language plugin may be a good starting point as such plugins will go deeper into the wohle apis of IDEA.

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.