/** * Returns the exception type declared to be thrown by the get method of {@code interfaceType}. */ private List<Class<? extends Throwable>> getExceptionType(Class<P> interfaceType) { try { Method getMethod = interfaceType.getMethod("get"); List<TypeLiteral<?>> exceptionLiterals = TypeLiteral.get(interfaceType).getExceptionTypes(getMethod); List<Class<? extends Throwable>> results = Lists.newArrayList(); for (TypeLiteral<?> exLiteral : exceptionLiterals) { results.add(exLiteral.getRawType().asSubclass(Throwable.class)); } return results; } catch (SecurityException e) { throw new IllegalStateException("Not allowed to inspect exception types", e); } catch (NoSuchMethodException e) { throw new IllegalStateException("No 'get'method available", e); } }
/** * Returns this method's exception types, if appropriate parametrized with * the declaring class's type parameters. * * @return exception types */ public List<TypeLiteral<?>> getExceptionTypes() { return getDeclaringType().getExceptionTypes(getMember()); }
binder, cxtorLiteral.getExceptionTypes(cxtor), exceptionTypes, interfaceType);
List<TypeLiteral<?>> exceptionTypes = typeLiteral.getExceptionTypes(method);