mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#1948 Fix minor warnings with using collection in package model and class util/workarounds/EclipseAsMemberOfWorkaround (#1949)
This commit is contained in:
parent
fe37b01c65
commit
e8a7832d5b
@ -8,7 +8,6 @@ package org.mapstruct.ap.internal.model;
|
|||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -371,11 +370,8 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Collections.sort(
|
propertyMappings.sort( Comparator.comparingInt( propertyMapping ->
|
||||||
propertyMappings,
|
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) ) );
|
||||||
Comparator.comparingInt( propertyMapping ->
|
|
||||||
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,17 +80,11 @@ public class LifecycleCallbackMethodReference extends MethodReference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Type> getImportTypes() {
|
public Set<Type> getImportTypes() {
|
||||||
return declaringType != null ? Collections.asSet( declaringType ) : java.util.Collections.<Type> emptySet();
|
return declaringType != null ? Collections.asSet( declaringType ) : java.util.Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMappingTargetParameter() {
|
public boolean hasMappingTargetParameter() {
|
||||||
for ( ParameterBinding param : getParameterBindings() ) {
|
return getParameterBindings().stream().anyMatch( ParameterBinding::isMappingTarget );
|
||||||
if ( param.isMappingTarget() ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ public class ObjectFactoryMethodResolver {
|
|||||||
selectors.getMatchingMethods(
|
selectors.getMatchingMethods(
|
||||||
method,
|
method,
|
||||||
getAllAvailableMethods( method, ctx.getSourceModel() ),
|
getAllAvailableMethods( method, ctx.getSourceModel() ),
|
||||||
java.util.Collections.<Type> emptyList(),
|
java.util.Collections.emptyList(),
|
||||||
alternativeTarget,
|
alternativeTarget,
|
||||||
SelectionCriteria.forFactoryMethods( selectionParameters ) );
|
SelectionCriteria.forFactoryMethods( selectionParameters ) );
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import org.mapstruct.ap.internal.model.common.Parameter;
|
|||||||
*/
|
*/
|
||||||
public class ParameterProvidedMethods {
|
public class ParameterProvidedMethods {
|
||||||
private static final ParameterProvidedMethods EMPTY =
|
private static final ParameterProvidedMethods EMPTY =
|
||||||
new ParameterProvidedMethods( Collections.<Parameter, List<SourceMethod>> emptyMap() );
|
new ParameterProvidedMethods( Collections.emptyMap() );
|
||||||
|
|
||||||
private final Map<Parameter, List<SourceMethod>> parameterToProvidedMethods;
|
private final Map<Parameter, List<SourceMethod>> parameterToProvidedMethods;
|
||||||
private final Map<SourceMethod, Parameter> methodToProvidingParameter;
|
private final Map<SourceMethod, Parameter> methodToProvidingParameter;
|
||||||
|
@ -454,13 +454,7 @@ public class SourceMethod implements Method {
|
|||||||
* @return {@code true} if the parameter list contains a parameter annotated with {@code @TargetType}
|
* @return {@code true} if the parameter list contains a parameter annotated with {@code @TargetType}
|
||||||
*/
|
*/
|
||||||
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
|
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
|
||||||
for ( Parameter param : parameters ) {
|
return parameters.stream().anyMatch( Parameter::isTargetType );
|
||||||
if ( param.isTargetType() ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
package org.mapstruct.ap.internal.util.workarounds;
|
package org.mapstruct.ap.internal.util.workarounds;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -73,7 +72,7 @@ final class EclipseAsMemberOfWorkaround {
|
|||||||
candidatesFromInterfaces );
|
candidatesFromInterfaces );
|
||||||
|
|
||||||
// there can be multiple matches for the same method name from adjacent interface hierarchies.
|
// there can be multiple matches for the same method name from adjacent interface hierarchies.
|
||||||
Collections.sort( candidatesFromInterfaces, MostSpecificMethodBindingComparator.INSTANCE );
|
candidatesFromInterfaces.sort( MostSpecificMethodBindingComparator.INSTANCE );
|
||||||
|
|
||||||
if ( !candidatesFromInterfaces.isEmpty() ) {
|
if ( !candidatesFromInterfaces.isEmpty() ) {
|
||||||
// return the most specific match
|
// return the most specific match
|
||||||
|
Loading…
x
Reference in New Issue
Block a user