Use case
While trying the latest beta I've noticed that IDE adds a Overriding method parameters are not annotated warning to all null marked mappers because the generated implementations don't include any annotation at all:
Generated Code
For example, here:
@Mapper
@NullMarked // or @NullMarked in package-info.java
public interface NullMarkedMapper {
@Mapping(target = "foo", source = "source1.foo")
@Mapping(target = "bar", source = "source1.bar")
@Mapping(target = "baz", source = "source2.baz")
Target map(Source1 source1, @Nullable Source2 source2);
}
Generated code could be:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "0000-00-00T00:00:00+0000",
comments = "version: , compiler: javac, environment: Java 21"
)
@NullMarked
public class NullMarkedMapperImpl implements NullMarkedMapper {
@Override
public Target map(Source1 source1, @Nullable Source2 source2) {
Long baz = null;
if ( source2 != null ) {
baz = source2.getBaz();
}
String foo = null;
foo = source1.getFoo();
boolean bar = false;
bar = source1.isBar();
Target target = new Target( foo, bar, baz );
return target;
}
}
Possible workarounds
Right now I'm ignoring the warning because it's not a compilation issue
MapStruct Version
1.7.0.Beta2
Use case
While trying the latest beta I've noticed that IDE adds a
Overriding method parameters are not annotatedwarning to all null marked mappers because the generated implementations don't include any annotation at all:Generated Code
For example, here:
Generated code could be:
Possible workarounds
Right now I'm ignoring the warning because it's not a compilation issue
MapStruct Version
1.7.0.Beta2