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.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -371,11 +370,8 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
|
||||
);
|
||||
}
|
||||
else {
|
||||
Collections.sort(
|
||||
propertyMappings,
|
||||
Comparator.comparingInt( propertyMapping ->
|
||||
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) )
|
||||
);
|
||||
propertyMappings.sort( Comparator.comparingInt( propertyMapping ->
|
||||
graphAnalyzer.getTraversalSequence( propertyMapping.getName() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,17 +80,11 @@ public class LifecycleCallbackMethodReference extends MethodReference {
|
||||
|
||||
@Override
|
||||
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() {
|
||||
for ( ParameterBinding param : getParameterBindings() ) {
|
||||
if ( param.isMappingTarget() ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return getParameterBindings().stream().anyMatch( ParameterBinding::isMappingTarget );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ public class ObjectFactoryMethodResolver {
|
||||
selectors.getMatchingMethods(
|
||||
method,
|
||||
getAllAvailableMethods( method, ctx.getSourceModel() ),
|
||||
java.util.Collections.<Type> emptyList(),
|
||||
java.util.Collections.emptyList(),
|
||||
alternativeTarget,
|
||||
SelectionCriteria.forFactoryMethods( selectionParameters ) );
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.mapstruct.ap.internal.model.common.Parameter;
|
||||
*/
|
||||
public class ParameterProvidedMethods {
|
||||
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<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}
|
||||
*/
|
||||
public static boolean containsTargetTypeParameter(List<Parameter> parameters) {
|
||||
for ( Parameter param : parameters ) {
|
||||
if ( param.isTargetType() ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return parameters.stream().anyMatch( Parameter::isTargetType );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,6 @@
|
||||
package org.mapstruct.ap.internal.util.workarounds;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -73,7 +72,7 @@ final class EclipseAsMemberOfWorkaround {
|
||||
candidatesFromInterfaces );
|
||||
|
||||
// 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() ) {
|
||||
// return the most specific match
|
||||
|
Loading…
x
Reference in New Issue
Block a user