Skip to content
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

Support for Java 14+ records #99

Closed
HawkSK opened this issue May 25, 2022 · 6 comments · Fixed by #114
Closed

Support for Java 14+ records #99

HawkSK opened this issue May 25, 2022 · 6 comments · Fixed by #114
Labels
Milestone

Comments

@HawkSK
Copy link

HawkSK commented May 25, 2022

When using a java record as a source, the plugin displays a warning:

Unmapped target property: id

even though the mapstruct framework itself does successfully map the record fields.

Moreover, there is no code completion in the source = "" property of @Mapping.

Source code:

@Mapper
public interface RecordMapper {

    AClass toClass(ARecord r);

    record ARecord(Integer id) {
    }

    class AClass {
        private Integer id;

        public AClass() {}

        public AClass(Integer id) {this.id = id;}

        public Integer getId() {return id;}

        public void setId(Integer id) {this.id = id;}
    }
}

Successfully generated:

public class RecordMapperImpl implements RecordMapper {

    @Override
    public AClass toClass(ARecord r) {
        if ( r == null ) {
            return null;
        }

        AClass aClass = new AClass();

        aClass.setId( r.id() );

        return aClass;
    }
}

JDK: 17
Mapstruct version: 1.4.2.Final
IntelliJ Idea version: 2022.1 (Ultimate Edition)
MapStruct Support Idea version: 1.3.1

@fireRising
Copy link

Is the plugin development abandoned or will this feature be released?

1 similar comment
@Husan
Copy link

Husan commented Oct 26, 2022

Is the plugin development abandoned or will this feature be released?

@ghost
Copy link

ghost commented Nov 11, 2022

Perhaps #109 fixes this

@fireRising
Copy link

@JelleDekker-HeadFWD yes but it's not merged yet. And there is no activity.

@filiphr
Copy link
Member

filiphr commented Nov 12, 2022

@fireRising and @Husan the plugin is not abandoned, it is only that the maintainers of MapStruct (myself included) are doing this in our free time and we don't always have time for everything. The PR is there and it will be merged and a release will be done soonish

@fireRising
Copy link

@filiphr Thanks, looking forward to the release😄

filiphr added a commit that referenced this issue Nov 13, 2022
@filiphr filiphr added this to the 1.4.0 milestone Nov 13, 2022
filiphr added a commit that referenced this issue Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants