eliminate duplicate error messages
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
526ab68264
commit
e37ca54981
|
@ -367,6 +367,10 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
}
|
||||
|
||||
primaryEntity = primaryEntity( lifecycleMethods );
|
||||
|
||||
if ( !lifecycleMethods.isEmpty() ) {
|
||||
validateStatelessSessionType();
|
||||
}
|
||||
}
|
||||
else {
|
||||
determineAccessTypeForHierarchy( element, context );
|
||||
|
@ -407,6 +411,14 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
initialized = true;
|
||||
}
|
||||
|
||||
private void validateStatelessSessionType() {
|
||||
if ( !usingStatelessSession(sessionType) ) {
|
||||
message( element,
|
||||
"repository must be backed by a 'StatelessSession'",
|
||||
Diagnostic.Kind.ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable TypeElement primaryEntity(List<ExecutableElement> lifecycleMethods) {
|
||||
for (TypeMirror typeMirror : element.getInterfaces()) {
|
||||
final DeclaredType declaredType = (DeclaredType) typeMirror;
|
||||
|
@ -1151,14 +1163,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
|
||||
private void addLifecycleMethod(ExecutableElement method) {
|
||||
final TypeMirror returnType = ununi(method.getReturnType());
|
||||
if ( !HIB_STATELESS_SESSION.equals(sessionType)
|
||||
&& !MUTINY_STATELESS_SESSION.equals(sessionType)
|
||||
&& !UNI_MUTINY_STATELESS_SESSION.equals(sessionType) ) {
|
||||
message( method,
|
||||
"repository must be backed by a 'StatelessSession'",
|
||||
Diagnostic.Kind.ERROR );
|
||||
}
|
||||
else if ( method.getParameters().size() != 1 ) {
|
||||
if ( method.getParameters().size() != 1 ) {
|
||||
message( method,
|
||||
"must have exactly one parameter",
|
||||
Diagnostic.Kind.ERROR );
|
||||
|
|
Loading…
Reference in New Issue