AnnotationConstants.listener);
if (listener == null) {
return;
}
if (listener instanceof InterfaceType) {
throw new ValidationException(
MessageCode.SLIM3GEN1052,
env,
fieldDeclaration.getPosition());
}
ClassType listenerClassType =
TypeUtil.toClassType((TypeMirror) listener);
if (listenerClassType == null) {
return;
}
ClassDeclaration listenerClassDeclaration =
listenerClassType.getDeclaration();
if (listenerClassDeclaration == null) {
throw new UnknownDeclarationException(
env,
listenerClassDeclaration,
listenerClassType);
}
if (!validateAttributeListenerParameter(
attributeMetaDesc,
classDeclaration,
fieldDeclaration,
listenerClassType)) {
throw new ValidationException(
MessageCode.SLIM3GEN1051,
env,
fieldDeclaration.getPosition(),
listenerClassDeclaration.getQualifiedName(),
TypeUtil
.toClassType(fieldDeclaration.getType())
.getDeclaration()
.getQualifiedName());
}
if (!DeclarationUtil
.hasPublicDefaultConstructor(listenerClassDeclaration)) {
if (classDeclaration.equals(fieldDeclaration.getDeclaringType())) {
throw new ValidationException(
MessageCode.SLIM3GEN1050,
env,
fieldDeclaration.getPosition(),
listenerClassDeclaration.getQualifiedName());
}
throw new ValidationException(
MessageCode.SLIM3GEN1045,
env,
classDeclaration.getPosition(),
listenerClassDeclaration.getQualifiedName());
}