Skip to content

Bean with getter returning Stream is treating the Stream as an alternative setter #3462

@filiphr

Description

@filiphr

Expected behavior

A getter returning a Stream should not be treated as an alternative setter

Actual behavior

The getter is treated as an alternative setter

Steps to reproduce the problem

public static class Foo {
    List<String> values;
    public List<String> getValues() { return values; }
    public void setValues(List<String> values) { this.values = values; }
}

public static class Bar {
    List<String> values;

    public List<String> getValues() { return this.values; }
    public void setValues(List<String> values) { this.values = values; }

    // This is the root of the problem; try replacing with any non-collection type.
    public Stream<String> getX() {
        throw new UnsupportedOperationException();
    }
}

@Mapper
public interface BarMapper {
    @Mapping(target = "values", source = "values")
    Bar toBar(Foo foo);
}

From #3425

MapStruct Version

1.5.5.Final / 1.6.0.Beta1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions