@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
public static List<Type> callGetGenericExceptionTypes(Constructor thiz) { return Arrays.asList(thiz.getGenericExceptionTypes()); }
/** * Returns the resolved generic exception types thrown by {@code constructor}. * * @param methodOrConstructor a method or constructor defined by this or any supertype. * @since 2.0 */ public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) { Type[] genericExceptionTypes; if (methodOrConstructor instanceof Method) { Method method = (Method) methodOrConstructor; checkArgument( method.getDeclaringClass().isAssignableFrom(rawType), "%s is not defined by a supertype of %s", method, type); genericExceptionTypes = method.getGenericExceptionTypes(); } else if (methodOrConstructor instanceof Constructor) { Constructor<?> constructor = (Constructor<?>) methodOrConstructor; checkArgument( constructor.getDeclaringClass().isAssignableFrom(rawType), "%s does not construct a supertype of %s", constructor, type); genericExceptionTypes = constructor.getGenericExceptionTypes(); } else { throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor); } return resolveAll(genericExceptionTypes); }
@Override @CachedReturnPlugin.Enhance("resolved") protected TypeDescription.Generic resolve() { java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes(); return erasure.length == type.length ? Sort.describe(type[index], getAnnotationReader()) : asRawType(); }
getConstructorParameterAnnotations(ctor) ); ClassNode[] exceptions = makeClassNodes(compileUnit, ctor.getGenericExceptionTypes(), ctor.getExceptionTypes()); classNode.addConstructor(ctor.getModifiers(), params, exceptions, null);
/** * Returns the resolved generic exception types thrown by {@code constructor}. * * @param methodOrConstructor a method or constructor defined by this or any supertype. * @since 2.0 */ public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) { Type[] genericExceptionTypes; if (methodOrConstructor instanceof Method) { Method method = (Method) methodOrConstructor; if (!method.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(method + " is not defined by a supertype of " + type); } genericExceptionTypes = method.getGenericExceptionTypes(); } else if (methodOrConstructor instanceof Constructor) { Constructor<?> constructor = (Constructor<?>) methodOrConstructor; if (!constructor.getDeclaringClass().isAssignableFrom(rawType)) { throw new IllegalArgumentException(constructor + " does not construct a supertype of " + type); } genericExceptionTypes = constructor.getGenericExceptionTypes(); } else { throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor); } return resolveAll(genericExceptionTypes); }
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getConstructor(constructor); if (methodInfo == null) { methodInfo = new MethodImpl(constructor); buildingCache.setGenericDeclaration(constructor, methodInfo); buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(), constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache); } return methodInfo; }
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getConstructor(constructor); if (methodInfo == null) { methodInfo = new MethodImpl(constructor); buildingCache.setGenericDeclaration(constructor, methodInfo); buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(), constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache); } return methodInfo; }
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getConstructor(constructor); if (methodInfo == null) { methodInfo = new MethodImpl(constructor); buildingCache.setGenericDeclaration(constructor, methodInfo); buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(), constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache); } return methodInfo; }
@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return constructor.getGenericExceptionTypes(); }
public Class<?>[] getResolvedTypeParameters(Class<?> concreteClass) { Type t = method != null ? method.getGenericExceptionTypes()[index] : constructor.getGenericExceptionTypes()[index]; return ReflectionUtils.resolveTypeArguments(concreteClass, t); }
@Override protected TypeDescription.Generic resolve() { java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes(); return erasure.length == type.length ? Sort.describe(type[index], getAnnotationReader()) : asRawType(); }
@Override protected TypeDescription.Generic resolve() { java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes(); return erasure.length == type.length ? Sort.describe(type[index], getAnnotationReader()) : asRawType(); }
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getConstructor(constructor); if (methodInfo == null) { methodInfo = new MethodImpl(constructor); buildingCache.setGenericDeclaration(constructor, methodInfo); buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(), constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache); } return methodInfo; }
public Class<?> getResolvedType(Class<?> concreteClass) { Type t = method != null ? method.getGenericExceptionTypes()[index] : constructor.getGenericExceptionTypes()[index]; if (t instanceof TypeVariable<?>) { return ReflectionUtils.resolveTypeVariable(concreteClass, (TypeVariable<?>) t); } return getType(); }
MethodBase(Constructor<?> constructor, ClassInfo<?> declaringType) { super (constructor, declaringType); this.typeParameters = MACollections.wrap((TypeVariable<?>[])constructor.getTypeParameters()); this.parameterTypes = MACollections.wrap(constructor.getParameterTypes()); this.genericParameterTypes = MACollections.wrap(constructor.getGenericParameterTypes()); this.exceptionTypes = MACollections.wrap(constructor.getExceptionTypes()); this.genericExceptionTypes = MACollections.wrap(constructor.getGenericExceptionTypes()); }