#1889 Remove unused parameters from classes TargetTypeSelector, ValueMapping, MethodRetrievalProcessor (#1890)

This commit is contained in:
Andrei Arlou 2019-09-14 04:12:38 +03:00 committed by GitHub
parent 2043506179
commit c044a87969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 10 deletions

View File

@ -36,7 +36,7 @@ public class ValueMapping {
boolean anyFound = false; boolean anyFound = false;
for ( ValueMappingPrism mappingPrism : mappingsAnnotation.value() ) { for ( ValueMappingPrism mappingPrism : mappingsAnnotation.value() ) {
ValueMapping mapping = fromMappingPrism( mappingPrism, method, messager ); ValueMapping mapping = fromMappingPrism( mappingPrism );
if ( mapping != null ) { if ( mapping != null ) {
if ( !mappings.contains( mapping ) ) { if ( !mappings.contains( mapping ) ) {
@ -68,8 +68,7 @@ public class ValueMapping {
} }
} }
public static ValueMapping fromMappingPrism(ValueMappingPrism mappingPrism, ExecutableElement element, public static ValueMapping fromMappingPrism( ValueMappingPrism mappingPrism ) {
FormattingMessager messager) {
return new ValueMapping( mappingPrism.source(), mappingPrism.target(), mappingPrism.mirror, return new ValueMapping( mappingPrism.source(), mappingPrism.target(), mappingPrism.mirror,
mappingPrism.values.source(), mappingPrism.values.target() ); mappingPrism.values.source(), mappingPrism.values.target() );

View File

@ -31,7 +31,7 @@ public class MethodSelectors {
new MethodFamilySelector(), new MethodFamilySelector(),
new TypeSelector( typeFactory, messager ), new TypeSelector( typeFactory, messager ),
new QualifierSelector( typeUtils, elementUtils ), new QualifierSelector( typeUtils, elementUtils ),
new TargetTypeSelector( typeUtils, elementUtils ), new TargetTypeSelector( typeUtils ),
new XmlElementDeclSelector( typeUtils ), new XmlElementDeclSelector( typeUtils ),
new InheritanceSelector(), new InheritanceSelector(),
new CreateOrUpdateSelector(), new CreateOrUpdateSelector(),

View File

@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types; import javax.lang.model.util.Types;
import org.mapstruct.ap.internal.model.common.Type; import org.mapstruct.ap.internal.model.common.Type;
@ -27,7 +26,7 @@ public class TargetTypeSelector implements MethodSelector {
private final Types typeUtils; private final Types typeUtils;
public TargetTypeSelector( Types typeUtils, Elements elementUtils ) { public TargetTypeSelector( Types typeUtils ) {
this.typeUtils = typeUtils; this.typeUtils = typeUtils;
} }

View File

@ -200,7 +200,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
} }
// otherwise add reference to existing mapper method // otherwise add reference to existing mapper method
else if ( isValidReferencedMethod( parameters ) || isValidFactoryMethod( method, parameters, returnType ) else if ( isValidReferencedMethod( parameters ) || isValidFactoryMethod( method, parameters, returnType )
|| isValidLifecycleCallbackMethod( method, returnType ) ) { || isValidLifecycleCallbackMethod( method ) ) {
return getReferencedMethod( usedMapper, methodType, method, mapperToImplement, parameters ); return getReferencedMethod( usedMapper, methodType, method, mapperToImplement, parameters );
} }
else { else {
@ -276,7 +276,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
contextParam.getType().getTypeElement(), contextParam.getType().getTypeElement(),
mapperToImplement, mapperToImplement,
mapperConfig, mapperConfig,
Collections.<SourceMethod> emptyList() ); Collections.emptyList() );
List<SourceMethod> contextProvidedMethods = new ArrayList<>( contextParamMethods.size() ); List<SourceMethod> contextProvidedMethods = new ArrayList<>( contextParamMethods.size() );
for ( SourceMethod sourceMethod : contextParamMethods ) { for ( SourceMethod sourceMethod : contextParamMethods ) {
@ -318,7 +318,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
.build(); .build();
} }
private boolean isValidLifecycleCallbackMethod(ExecutableElement method, Type returnType) { private boolean isValidLifecycleCallbackMethod(ExecutableElement method) {
return Executables.isLifecycleCallbackMethod( method ); return Executables.isLifecycleCallbackMethod( method );
} }
@ -530,7 +530,7 @@ public class MethodRetrievalProcessor implements ModelElementProcessor<Void, Lis
ValueMappingsPrism mappingsAnnotation = ValueMappingsPrism.getInstanceOn( method ); ValueMappingsPrism mappingsAnnotation = ValueMappingsPrism.getInstanceOn( method );
if ( mappingAnnotation != null ) { if ( mappingAnnotation != null ) {
ValueMapping valueMapping = ValueMapping.fromMappingPrism( mappingAnnotation, method, messager ); ValueMapping valueMapping = ValueMapping.fromMappingPrism( mappingAnnotation );
if ( valueMapping != null ) { if ( valueMapping != null ) {
valueMappings.add( valueMapping ); valueMappings.add( valueMapping );
} }