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 );
|
primaryEntity = primaryEntity( lifecycleMethods );
|
||||||
|
|
||||||
|
if ( !lifecycleMethods.isEmpty() ) {
|
||||||
|
validateStatelessSessionType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
determineAccessTypeForHierarchy( element, context );
|
determineAccessTypeForHierarchy( element, context );
|
||||||
|
@ -407,6 +411,14 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
||||||
initialized = true;
|
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) {
|
private @Nullable TypeElement primaryEntity(List<ExecutableElement> lifecycleMethods) {
|
||||||
for (TypeMirror typeMirror : element.getInterfaces()) {
|
for (TypeMirror typeMirror : element.getInterfaces()) {
|
||||||
final DeclaredType declaredType = (DeclaredType) typeMirror;
|
final DeclaredType declaredType = (DeclaredType) typeMirror;
|
||||||
|
@ -1151,14 +1163,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
||||||
|
|
||||||
private void addLifecycleMethod(ExecutableElement method) {
|
private void addLifecycleMethod(ExecutableElement method) {
|
||||||
final TypeMirror returnType = ununi(method.getReturnType());
|
final TypeMirror returnType = ununi(method.getReturnType());
|
||||||
if ( !HIB_STATELESS_SESSION.equals(sessionType)
|
if ( method.getParameters().size() != 1 ) {
|
||||||
&& !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 ) {
|
|
||||||
message( method,
|
message( method,
|
||||||
"must have exactly one parameter",
|
"must have exactly one parameter",
|
||||||
Diagnostic.Kind.ERROR );
|
Diagnostic.Kind.ERROR );
|
||||||
|
|
Loading…
Reference in New Issue