diff --git a/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java b/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java index 73e6b557d..1721f978e 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java +++ b/processor/src/main/java/org/mapstruct/ap/model/common/TypeFactory.java @@ -51,6 +51,7 @@ import javax.lang.model.util.Types; import org.mapstruct.ap.prism.MappingTargetPrism; import org.mapstruct.ap.prism.TargetTypePrism; import org.mapstruct.ap.util.AnnotationProcessingException; +import org.mapstruct.ap.util.TypeUtilsJDK6Fix; /** * Factory creating {@link Type} instances. @@ -122,18 +123,9 @@ public class TypeFactory { Type implementationType = getImplementationType( mirror ); - boolean isIterableType = typeUtils.isSubtype( - typeUtils.erasure( mirror ), - typeUtils.erasure( iterableType ) - ); - boolean isCollectionType = typeUtils.isSubtype( - typeUtils.erasure( mirror ), - typeUtils.erasure( collectionType ) - ); - boolean isMapType = typeUtils.isSubtype( - typeUtils.erasure( mirror ), - typeUtils.erasure( mapType ) - ); + boolean isIterableType = TypeUtilsJDK6Fix.isSubType( typeUtils, mirror, iterableType ); + boolean isCollectionType = TypeUtilsJDK6Fix.isSubType( typeUtils, mirror, collectionType ); + boolean isMapType = TypeUtilsJDK6Fix.isSubType( typeUtils, mirror, mapType ); boolean isEnumType; boolean isInterface; diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/MethodMatcher.java b/processor/src/main/java/org/mapstruct/ap/model/source/MethodMatcher.java index 51adbd9b5..24e685e26 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/MethodMatcher.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/MethodMatcher.java @@ -36,6 +36,7 @@ import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; import org.mapstruct.ap.model.common.Type; +import org.mapstruct.ap.util.TypeUtilsJDK6Fix; /** * SourceMethodMatcher $8.4 of the JavaLanguage specification describes a method body as such: @@ -207,8 +208,8 @@ public class MethodMatcher { } else { // check if types are in bound - if ( typeUtils.isSubtype( typeUtils.erasure( t.getLowerBound() ), typeUtils.erasure( p ) ) && - typeUtils.isSubtype( typeUtils.erasure( p ), typeUtils.erasure( t.getUpperBound() ) ) ) { + if ( TypeUtilsJDK6Fix.isSubType( typeUtils, t.getLowerBound(), p) && + TypeUtilsJDK6Fix.isSubType( typeUtils, p, t.getUpperBound() ) ) { genericTypesMap.put( t, p ); return Boolean.TRUE; } @@ -228,7 +229,7 @@ public class MethodMatcher { case DECLARED: // for example method: String method(? extends String) // isSubType checks range [subtype, type], e.g. isSubtype [Object, String]==true - return typeUtils.isSubtype( typeUtils.erasure( p ), extendsBound ); + return TypeUtilsJDK6Fix.isSubType( typeUtils, p, extendsBound ); case TYPEVAR: // for example method: T method(? extends T) @@ -250,8 +251,8 @@ public class MethodMatcher { // for example method: String method(? super String) // to check super type, we can simply reverse the argument, but that would initially yield // a result: