produce meaningful error if reactive repo method does not return Uni
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
4bbc0e4db5
commit
5ab2d83bd8
|
@ -1149,9 +1149,18 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
}
|
||||
|
||||
private TypeMirror ununiIfPossible(ExecutableElement method, TypeMirror returnType) {
|
||||
final TypeMirror result = ununi(returnType);
|
||||
if ( result != returnType && repository && !usingReactiveSession(sessionType) ) {
|
||||
message(method, "not backed by a reactive session", Diagnostic.Kind.ERROR);
|
||||
final TypeMirror result = ununi( returnType );
|
||||
if ( repository ) {
|
||||
if ( usingReactiveSession( sessionType ) ) {
|
||||
if ( result == returnType ) {
|
||||
message( method, "backed by a reactive session, must return 'Uni'", Diagnostic.Kind.ERROR );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( result != returnType ) {
|
||||
message( method, "not backed by a reactive session, must not return 'Uni'", Diagnostic.Kind.ERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1482,7 +1491,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
}
|
||||
}
|
||||
else if ( returnType.getKind() == TypeKind.DECLARED ) {
|
||||
final DeclaredType declaredType = (DeclaredType) ununiIfPossible(method, returnType);
|
||||
final DeclaredType declaredType = (DeclaredType) returnType;
|
||||
final TypeElement entity = (TypeElement) declaredType.asElement();
|
||||
if ( !containsAnnotation( entity, ENTITY ) ) {
|
||||
message( method,
|
||||
|
|
Loading…
Reference in New Issue