Skip to content

Commit 1187e35

Browse files
authored
mapstruct#2239 matching generics (mapstruct#2320)
1 parent e7f6813 commit 1187e35

61 files changed

Lines changed: 2640 additions & 478 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

processor/src/main/java/org/mapstruct/ap/internal/model/ForgedMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ public MappingMethodOptions getOptions() {
340340
return basedOn.getOptions();
341341
}
342342

343+
@Override
344+
public List<Type> getTypeParameters() {
345+
return Collections.emptyList();
346+
}
347+
343348
@Override
344349
public String describe() {
345350
// the name of the forged method is never fully qualified, so no need to distinguish

processor/src/main/java/org/mapstruct/ap/internal/model/HelperMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public boolean isObjectFactory() {
128128
return false;
129129
}
130130

131+
@Override
132+
public List<Type> getTypeParameters() {
133+
return Collections.emptyList();
134+
}
135+
131136
/**
132137
* the conversion context is used to format an auxiliary parameter in the method call with context specific
133138
* information such as a date format.

processor/src/main/java/org/mapstruct/ap/internal/model/LifecycleMethodResolver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ private static List<LifecycleCallbackMethodReference> collectLifecycleCallbackMe
141141
callbackMethods,
142142
Collections.emptyList(),
143143
targetType,
144+
method.getReturnType(),
144145
SelectionCriteria.forLifecycleMethods( selectionParameters ) );
145146

146147
return toLifecycleCallbackMethodRefs(

processor/src/main/java/org/mapstruct/ap/internal/model/MappingBuilderContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,13 @@ public interface MappingResolver {
7878
* returns a parameter assignment
7979
*
8080
* @param mappingMethod target mapping method
81-
* @param description
81+
* @param description the description source
8282
* @param targetType return type to match
8383
* @param formattingParameters used for formatting dates and numbers
8484
* @param criteria parameters criteria in the selection process
8585
* @param sourceRHS source information
8686
* @param positionHint the mirror for reporting problems
87+
* @param forger the supplier of the callback method to forge a method
8788
*
8889
* @return an assignment to a method parameter, which can either be:
8990
* <ol>

processor/src/main/java/org/mapstruct/ap/internal/model/ObjectFactoryMethodResolver.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
*/
66
package org.mapstruct.ap.internal.model;
77

8+
import static org.mapstruct.ap.internal.util.Collections.first;
9+
810
import java.util.ArrayList;
911
import java.util.List;
1012
import java.util.stream.Collectors;
13+
1114
import javax.lang.model.element.ElementKind;
1215
import javax.lang.model.element.ExecutableElement;
1316

@@ -23,8 +26,6 @@
2326
import org.mapstruct.ap.internal.model.source.selector.SelectionCriteria;
2427
import org.mapstruct.ap.internal.util.Message;
2528

26-
import static org.mapstruct.ap.internal.util.Collections.first;
27-
2829
/**
2930
*
3031
* @author Sjaak Derksen
@@ -129,11 +130,13 @@ public static List<SelectedMethod<SourceMethod>> getMatchingFactoryMethods( Meth
129130
new MethodSelectors( ctx.getTypeUtils(), ctx.getElementUtils(), ctx.getTypeFactory(), ctx.getMessager() );
130131

131132
return selectors.getMatchingMethods(
132-
method,
133-
getAllAvailableMethods( method, ctx.getSourceModel() ),
134-
java.util.Collections.emptyList(),
135-
alternativeTarget,
136-
SelectionCriteria.forFactoryMethods( selectionParameters ) );
133+
method,
134+
getAllAvailableMethods( method, ctx.getSourceModel() ),
135+
java.util.Collections.emptyList(),
136+
alternativeTarget,
137+
alternativeTarget,
138+
SelectionCriteria.forFactoryMethods( selectionParameters )
139+
);
137140
}
138141

139142
public static MethodReference getBuilderFactoryMethod(Method method, BuilderType builder ) {

0 commit comments

Comments
 (0)