From 7af107c9f2707a54467d631ae33d47e6a0cd5940 Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Sat, 14 Sep 2019 03:24:43 +0300 Subject: [PATCH] #1883 Remove not used method "asCollectionOrMap" from TypeFactory (#1884) --- .../ap/internal/model/common/TypeFactory.java | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/processor/src/main/java/org/mapstruct/ap/internal/model/common/TypeFactory.java b/processor/src/main/java/org/mapstruct/ap/internal/model/common/TypeFactory.java index 1ec8077a8..0647834b8 100644 --- a/processor/src/main/java/org/mapstruct/ap/internal/model/common/TypeFactory.java +++ b/processor/src/main/java/org/mapstruct/ap/internal/model/common/TypeFactory.java @@ -380,7 +380,7 @@ public class TypeFactory { Iterator varIt = parameters.iterator(); Iterator typesIt = parameterTypes.iterator(); - for ( ; varIt.hasNext(); ) { + while ( varIt.hasNext() ) { VariableElement parameter = varIt.next(); TypeMirror parameterType = typesIt.next(); @@ -549,38 +549,6 @@ public class TypeFactory { return arrayType.getComponentType(); } - /** - * Converts any collection type, e.g. {@code List} to {@code Collection} and any map type, e.g. - * {@code HashMap} to {@code Map}. - * - * @param collectionOrMap any collection or map type - * @return the type representing {@code Collection} or {@code Map}, if the argument type is a subtype of - * {@code Collection} or of {@code Map} respectively. - */ - public Type asCollectionOrMap(Type collectionOrMap) { - List originalParameters = collectionOrMap.getTypeParameters(); - TypeMirror[] originalParameterMirrors = new TypeMirror[originalParameters.size()]; - int i = 0; - for ( Type param : originalParameters ) { - originalParameterMirrors[i++] = param.getTypeMirror(); - } - - if ( collectionOrMap.isCollectionType() - && !"java.util.Collection".equals( collectionOrMap.getFullyQualifiedName() ) ) { - return getType( typeUtils.getDeclaredType( - elementUtils.getTypeElement( "java.util.Collection" ), - originalParameterMirrors ) ); - } - else if ( collectionOrMap.isMapType() - && !"java.util.Map".equals( collectionOrMap.getFullyQualifiedName() ) ) { - return getType( typeUtils.getDeclaredType( - elementUtils.getTypeElement( "java.util.Map" ), - originalParameterMirrors ) ); - } - - return collectionOrMap; - } - /** * creates a void return type *