@Override Type[] getGenericExceptionTypes() { return method.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return method.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return method.getGenericExceptionTypes(); }
@Override Type[] getGenericExceptionTypes() { return method.getGenericExceptionTypes(); }
public static List<Type> callGetGenericExceptionTypes(Method 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); }
Type[] gxType = m.getGenericExceptionTypes(); if (xType.length != 0) { info.append("\n");
@Override @CachedReturnPlugin.Enhance("resolved") protected TypeDescription.Generic resolve() { java.lang.reflect.Type[] type = method.getGenericExceptionTypes(); return erasure.length == type.length ? Sort.describe(type[index], getAnnotationReader()) : asRawType(); }
Type[] exceptions = m.getGenericExceptionTypes(); if (exceptions.length > 0) { sb.append(" throws ");
for (Type err : method.getGenericExceptionTypes()) if (err != AvroRemoteException.class) errs.add(getSchema(err, names));
for (Type err : method.getGenericExceptionTypes()) if (err != AvroRemoteException.class) errs.add(getSchema(err, names));
ClassNode ret = makeClassNode(compileUnit, m.getGenericReturnType(), m.getReturnType()); Parameter[] params = makeParameters(compileUnit, m.getGenericParameterTypes(), m.getParameterTypes(), m.getParameterAnnotations()); ClassNode[] exceptions = makeClassNodes(compileUnit, m.getGenericExceptionTypes(), m.getExceptionTypes()); MethodNode mn = new MethodNode(m.getName(), m.getModifiers(), ret, params, exceptions, null); mn.setSynthetic(m.isSynthetic());
/** * 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 buildMethod(Method method, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getMethod(method); if (methodInfo == null) { methodInfo = new MethodImpl(method); buildingCache.setGenericDeclaration(method, methodInfo); buildMethodOrConstructor(methodInfo, method.getGenericReturnType(), method.getGenericParameterTypes(), method.getGenericExceptionTypes(), method.getDeclaringClass(), buildingCache); } return methodInfo; }
private MethodInfo buildMethod(Method method, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getMethod(method); if (methodInfo == null) { methodInfo = new MethodImpl(method); buildingCache.setGenericDeclaration(method, methodInfo); buildMethodOrConstructor(methodInfo, method.getGenericReturnType(), method.getGenericParameterTypes(), method.getGenericExceptionTypes(), method.getDeclaringClass(), buildingCache); } return methodInfo; }
private MethodInfo buildMethod(Method method, BuildingCache buildingCache) { if (buildingCache == null) { buildingCache = new BuildingCache(); } MethodImpl methodInfo = buildingCache.getMethod(method); if (methodInfo == null) { methodInfo = new MethodImpl(method); buildingCache.setGenericDeclaration(method, methodInfo); buildMethodOrConstructor(methodInfo, method.getGenericReturnType(), method.getGenericParameterTypes(), method.getGenericExceptionTypes(), method.getDeclaringClass(), buildingCache); } return methodInfo; }
private static Stream<Type> allTypesOfMethodSignature(final Method method) { return Stream.concat( Stream.concat( Arrays.stream(method.getGenericParameterTypes()), Stream.of(method.getGenericReturnType()) ), Arrays.stream(method.getGenericExceptionTypes()) ); }
private List<ThriftStruct> buildThriftExceptions(Method method, List<ThriftStruct> structs, List<ThriftEnum> enums) { Type[] ts = method.getGenericExceptionTypes(); List<ThriftStruct> tsList = new ArrayList<ThriftStruct>(); for (Type t : ts) { ThriftStruct ths = thriftStructBuilder.buildThriftStruct((Class<?>)t, structs, enums); tsList.add(ths); } return tsList; }
private String signature(Method method) { var arglist = Arrays.stream(method.getGenericParameterTypes()) .map(t -> normalize(t.getTypeName())) .collect(Collectors.joining(",")); var exceptionlist = Arrays.stream(method.getGenericExceptionTypes()) .map(t -> normalize(t.getTypeName())) .collect(Collectors.joining(",")); return method.getName() + "(" + arglist + ")" + (exceptionlist.length() == 0 ? "" : " throws " + exceptionlist); }
@Override protected TypeDescription.Generic resolve() { java.lang.reflect.Type[] type = method.getGenericExceptionTypes(); return erasure.length == type.length ? Sort.describe(type[index], getAnnotationReader()) : asRawType(); }