Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,14 @@
Type sourceType = typeFactory.getType( subclassMappingOptions.getSource() );
Type targetType = typeFactory.getType( subclassMappingOptions.getTarget() );

String sourceArgument = method.getSourceParameters()
.stream().filter( parameter -> ctx.getTypeUtils().isAssignable(
sourceType.getTypeMirror(), parameter.getType().getTypeMirror() ) )
.findFirst().map( Parameter::getName ).orElseThrow(
() -> new IllegalArgumentException( "No source parameter found." ) );

SourceRHS rightHandSide = new SourceRHS(
"subclassMapping",
"(" + sourceType.createReferenceName() + ") " + sourceArgument,
sourceType,
Collections.emptySet(),
"SubclassMapping for " + sourceType.getFullyQualifiedName() );
Expand All @@ -615,18 +621,6 @@
sourceType,
targetType,
mappingReferences ) );
String sourceArgument = null;
for ( Parameter parameter : method.getSourceParameters() ) {
if ( ctx
.getTypeUtils()
.isAssignable( sourceType.getTypeMirror(), parameter.getType().getTypeMirror() ) ) {
sourceArgument = parameter.getName();
if ( assignment != null ) {
assignment.setSourceLocalVarName(
"(" + sourceType.createReferenceName() + ") " + sourceArgument );
}
}
}
return new SubclassMapping( sourceType, sourceArgument, targetType, assignment );
}

Expand Down Expand Up @@ -1445,7 +1439,7 @@
mapping.getMirror(),
mapping.getTargetAnnotationValue(),
msg,
args

Check warning on line 1442 in processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java

View workflow job for this annotation

GitHub Actions / Linux JDK 17

non-varargs call of varargs method with inexact argument type for last parameter;

Check warning on line 1442 in processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java

View workflow job for this annotation

GitHub Actions / Linux JDK 21

non-varargs call of varargs method with inexact argument type for last parameter;

Check warning on line 1442 in processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java

View workflow job for this annotation

GitHub Actions / Linux JDK 8

non-varargs call of varargs method with inexact argument type for last parameter;

Check warning on line 1442 in processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java

View workflow job for this annotation

GitHub Actions / Linux JDK 26

non-varargs call of varargs method with inexact argument type for last parameter;

Check warning on line 1442 in processor/src/main/java/org/mapstruct/ap/internal/model/BeanMappingMethod.java

View workflow job for this annotation

GitHub Actions / Linux JDK 25

non-varargs call of varargs method with inexact argument type for last parameter;
);
return true;
}
Expand Down
Loading