This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3337bf43ab961752a16ea5afe545e1c8bbdd804f Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Fri Feb 11 12:52:26 2022 +0100 (chores) camel-maven-package-plugin: remove unused and/or dead code --- .../maven/packaging/generics/GenericsUtil.java | 112 --------------------- 1 file changed, 112 deletions(-) diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/generics/GenericsUtil.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/generics/GenericsUtil.java index 7cc64e0..443634f 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/generics/GenericsUtil.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/generics/GenericsUtil.java @@ -17,7 +17,6 @@ package org.apache.camel.maven.packaging.generics; import java.lang.reflect.Array; -import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; import java.lang.reflect.GenericDeclaration; @@ -43,55 +42,6 @@ public final class GenericsUtil { private GenericsUtil() { } - public static boolean satisfiesDependency( - boolean isDelegateOrEvent, boolean isProducer, Type injectionPointType, Type beanType) { - if (beanType instanceof TypeVariable || beanType instanceof WildcardType || beanType instanceof GenericArrayType) { - return isAssignableFrom(isDelegateOrEvent, isProducer, injectionPointType, beanType); - } else { - Type injectionPointRawType = injectionPointType instanceof ParameterizedType - ? ((ParameterizedType) injectionPointType).getRawType() : injectionPointType; - Type beanRawType = beanType instanceof ParameterizedType ? ((ParameterizedType) beanType).getRawType() : beanType; - - if (ClassUtil.isSame(injectionPointRawType, beanRawType)) { - return isAssignableFrom(isDelegateOrEvent, isProducer, injectionPointType, beanType); - } - } - - return false; - } - - public static boolean satisfiesDependencyRaw( - boolean isDelegateOrEvent, boolean isProducer, Type injectionPointType, Type beanType) { - if (beanType instanceof TypeVariable || beanType instanceof WildcardType || beanType instanceof GenericArrayType) { - return isAssignableFrom(isDelegateOrEvent, isProducer, injectionPointType, beanType); - } else { - Type injectionPointRawType = injectionPointType instanceof ParameterizedType - ? ((ParameterizedType) injectionPointType).getRawType() : injectionPointType; - Type beanRawType = beanType instanceof ParameterizedType ? ((ParameterizedType) beanType).getRawType() : beanType; - - if (ClassUtil.isSame(injectionPointRawType, beanRawType)) { - return isAssignableFrom(isDelegateOrEvent, isProducer, injectionPointRawType, beanRawType); - } else { - Class bean = (Class) beanType; - if (bean.getSuperclass() != null && ClassUtil.isRawClassEquals(injectionPointType, bean.getSuperclass())) { - return true; - } - - Class<?>[] interfaces = bean.getInterfaces(); - if (interfaces == null || interfaces.length == 0) { - return false; - } - - for (Class<?> clazz : interfaces) { - if (ClassUtil.isRawClassEquals(injectionPointType, clazz)) { - return true; - } - } - } - } - - return false; - } /** * 5.2.3 and 5.2.4 @@ -402,10 +352,6 @@ public final class GenericsUtil { } - public static boolean containTypeVariable(Collection<? extends Type> types) { - return containTypeVariable(types.toArray(new Type[types.size()])); - } - public static boolean containTypeVariable(Type[] types) { for (Type type : types) { if (containsTypeVariable(type)) { @@ -416,30 +362,6 @@ public final class GenericsUtil { } /** - * @param type to check - * @return {@code true} if the given type contains a {@link WildcardType} {@code false} otherwise - */ - public static boolean containsWildcardType(Type type) { - if (!(type instanceof ParameterizedType)) { - return false; - } - - for (Type typeArgument : getParameterizedType(type).getActualTypeArguments()) { - if (ClassUtil.isParameterizedType(typeArgument)) { - if (containsWildcardType(typeArgument)) { - return true; - } - } else { - if (ClassUtil.isWildCardType(typeArgument)) { - return true; - } - } - } - - return false; - } - - /** * Resolves the actual type of the specified field for the type hierarchy specified by the given subclass */ public static Type resolveType(Class<?> subclass, Field field) { @@ -447,21 +369,6 @@ public final class GenericsUtil { } /** - * Resolves the actual return type of the specified method for the type hierarchy specified by the given subclass - */ - public static Type resolveReturnType(Class<?> subclass, Method method) { - return resolveType(method.getGenericReturnType(), subclass, newSeenList()); - } - - /** - * Resolves the actual parameter generics of the specified constructor for the type hierarchy specified by the given - * subclass - */ - public static Type[] resolveParameterTypes(Class<?> subclass, Constructor<?> constructor) { - return resolveTypes(constructor.getGenericParameterTypes(), subclass); - } - - /** * Resolves the actual parameter generics of the specified method for the type hierarchy specified by the given * subclass */ @@ -469,17 +376,6 @@ public final class GenericsUtil { return resolveTypes(method.getGenericParameterTypes(), subclass); } - /** - * Resolves the actual type of the specified type for the type hierarchy specified by the given subclass - */ - public static Type resolveType(Type type, Class<?> subclass, Member member) { - return resolveType(type, subclass, newSeenList()); - } - - public static Type resolveType(Type type, Class<?> subclass, Member member, Collection<TypeVariable<?>> seen) { - return resolveType(type, subclass, seen); - } - public static Type resolveType(Type type, Type actualType, Collection<TypeVariable<?>> seen) { if (type instanceof Class) { return type; @@ -535,10 +431,6 @@ public final class GenericsUtil { return resolvedTypeArguments; } - public static Set<Type> getTypeClosure(Class<?> type) { - return getTypeClosure(type, type); - } - public static Set<Type> getTypeClosure(Type actualType) { return getTypeClosure(actualType, actualType); } @@ -895,8 +787,4 @@ public final class GenericsUtil { return new OwbGenericArrayTypeImpl(componentType); } } - - public static Type resolveType(ParameterizedType parameterizedType, Type metadataType) { - return resolveType(parameterizedType, metadataType, newSeenList()); - } }
