#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;
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() );

View File

@ -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(),

View File

@ -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;
}

View File

@ -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 );
}