Giter Site home page Giter Site logo

Renaming a @Getter annotated field results in a getter inside the mapping definition (instead of the new field name) about mapstruct-idea HOT 4 OPEN

lmartelli avatar lmartelli commented on August 17, 2024
Renaming a @Getter annotated field results in a getter inside the mapping definition (instead of the new field name)

from mapstruct-idea.

Comments (4)

thunderhook avatar thunderhook commented on August 17, 2024

Hi @lmartelli!

Which version of the plugin are you currently using? How does your model look like in detail?

Not able to reproduce this with the following code:

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper
interface Issue197Mapper {
    @Mapping(source="name", target="nom")
    UserDto toDto(User user);
}

class UserDto {
    public String nom;
}

class User {
    String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

from mapstruct-idea.

lmartelli avatar lmartelli commented on August 17, 2024

Hi @lmartelli!

Which version of the plugin are you currently using?

1.7.0

How does your model look like in detail?

I use Lombok to generate getters, sorry for no specifying this in the first place :

import lombok.Getter;

@Getter
static class User {
    private String name2;
}

from mapstruct-idea.

thunderhook avatar thunderhook commented on August 17, 2024

Yes, this is reproducible when using Lombok:

reproducal-rename-lombok

I don't think we can fix this on our end. We just provide elements that can be renamed in the MapstructSourceTargetParameterRenameHandler. How those parameters are used by the PsiElementRenameHandler is beyond our control. At least to my knowledge.

from mapstruct-idea.

filiphr avatar filiphr commented on August 17, 2024

Thanks for the analysis @thunderhook. I'm also not sure what we can do. Perhaps this is some kind of a bug in the Lombok plugin. It works correctly when renaming a field (which triggers method rename) and renaming the getter directly

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.