private static DefDescriptor<TypeDef> getReturnTypeDescriptor(Method method) throws QuickFixException {
int modifiers = method.getModifiers();
if (!Modifier.isPublic(modifiers) || Modifier.isStatic(modifiers) || method.getParameterTypes().length > 0) {
throw new InvalidDefinitionException(String.format("@AuraEnabled annotation found on invalid method %s",
method.getName()), new Location("java://" + method.getDeclaringClass().getCanonicalName(), 0));
}
Type type = method.getAnnotation(Type.class);
if (type == null) {
//
// FIXME: need better checks here, including doing things like
// List<Type>, arrays also need to be handled here.
//
if (Void.TYPE.equals(method.getGenericReturnType())) {
throw new InvalidDefinitionException(String.format("@AuraEnabled annotation found on void method %s",
method.getName()), new Location("java://" + method.getDeclaringClass().getCanonicalName(), 0));
}
return DefDescriptorImpl.getInstance("java://" + method.getReturnType().getName(), TypeDef.class);
} else {
return DefDescriptorImpl.getInstance(type.value(), TypeDef.class);
}