mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1889 Remove unused parameters from classes TargetTypeSelector, ValueMapping, MethodRetrievalProcessor (#1890)
This commit is contained in:
parent
2043506179
commit
c044a87969
@ -36,7 +36,7 @@ public class ValueMapping {
|
||||
|
||||
boolean anyFound = false;
|
||||
for ( ValueMappingPrism mappingPrism : mappingsAnnotation.value() ) {
|
||||
ValueMapping mapping = fromMappingPrism( mappingPrism, method, messager );
|
||||
ValueMapping mapping = fromMappingPrism( mappingPrism );
|
||||
if ( mapping != null ) {
|
||||
|
||||
if ( !mappings.contains( mapping ) ) {
|
||||
@ -68,8 +68,7 @@ public class ValueMapping {
|
||||
}
|
||||
}
|
||||
|
||||
public static ValueMapping fromMappingPrism(ValueMappingPrism mappingPrism, ExecutableElement element,
|
||||
FormattingMessager messager) {
|
||||
public static ValueMapping fromMappingPrism( ValueMappingPrism mappingPrism ) {
|
||||
|
||||
return new ValueMapping( mappingPrism.source(), mappingPrism.target(), mappingPrism.mirror,
|
||||
mappingPrism.values.source(), mappingPrism.values.target() );
|
||||
|
@ -31,7 +31,7 @@ public class MethodSelectors {
|
||||
new MethodFamilySelector(),
|
||||
new TypeSelector( typeFactory, messager ),
|
||||
new QualifierSelector( typeUtils, elementUtils ),
|
||||
new TargetTypeSelector( typeUtils, elementUtils ),
|
||||
new TargetTypeSelector( typeUtils ),
|
||||
new XmlElementDeclSelector( typeUtils ),
|
||||
new InheritanceSelector(),
|
||||
new CreateOrUpdateSelector(),
|
||||
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Elements;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import org.mapstruct.ap.internal.model.common.Type;
|
||||
@ -27,7 +26,7 @@ public class TargetTypeSelector implements MethodSelector {
|
||||
|
||||
private final Types typeUtils;
|
||||
|
||||
public TargetTypeSelector( Types typeUtils, Elements elementUtils ) {
|
||||
public TargetTypeSelector( Types typeUtils ) {
|
||||
this.typeUtils = typeUtils;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
|
||||
}
|
||||
// otherwise add reference to existing mapper method
|
||||
else if ( isValidReferencedMethod( parameters ) || isValidFactoryMethod( method, parameters, returnType )
|
||||
|| isValidLifecycleCallbackMethod( method, returnType ) ) {
|
||||
|| isValidLifecycleCallbackMethod( method ) ) {
|
||||
return getReferencedMethod( usedMapper, methodType, method, mapperToImplement, parameters );
|
||||
}
|
||||
else {
|
||||
@ -276,7 +276,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
|
||||
contextParam.getType().getTypeElement(),
|
||||
mapperToImplement,
|
||||
mapperConfig,
|
||||
Collections.<SourceMethod> emptyList() );
|
||||
Collections.emptyList() );
|
||||
|
||||
List<SourceMethod> contextProvidedMethods = new ArrayList<>( contextParamMethods.size() );
|
||||
for ( SourceMethod sourceMethod : contextParamMethods ) {
|
||||
@ -318,7 +318,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
|
||||
.build();
|
||||
}
|
||||
|
||||
private boolean isValidLifecycleCallbackMethod(ExecutableElement method, Type returnType) {
|
||||
private boolean isValidLifecycleCallbackMethod(ExecutableElement method) {
|
||||
return Executables.isLifecycleCallbackMethod( method );
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
|
||||
ValueMappingsPrism mappingsAnnotation = ValueMappingsPrism.getInstanceOn( method );
|
||||
|
||||
if ( mappingAnnotation != null ) {
|
||||
ValueMapping valueMapping = ValueMapping.fromMappingPrism( mappingAnnotation, method, messager );
|
||||
ValueMapping valueMapping = ValueMapping.fromMappingPrism( mappingAnnotation );
|
||||
if ( valueMapping != null ) {
|
||||
valueMappings.add( valueMapping );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user