in webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java [1312:1366]
private <X> void checkManagedWebBeansInterceptorConditions(AnnotatedType<X> type)
{
Annotation[] anns = AnnotationUtil.asArray(type.getAnnotations());
Class<?> clazz = type.getJavaClass();
boolean hasClassInterceptors = false;
AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
if (annotationManager.getInterceptorBindingMetaAnnotations(anns).length > 0)
{
hasClassInterceptors = true;
}
else
{
Annotation[] stereoTypes = annotationManager.getStereotypeMetaAnnotations(anns);
for (Annotation stero : stereoTypes)
{
if (annotationManager.hasInterceptorBindingMetaAnnotation(stero.annotationType().getDeclaredAnnotations()))
{
hasClassInterceptors = true;
break;
}
}
}
if(Modifier.isFinal(clazz.getModifiers()) && hasClassInterceptors)
{
// spec section 3.15 unproxyable bean types -> Deployment Error
throw new WebBeansDeploymentException("Final managed bean class with name : " + clazz.getName() + " can not define any InterceptorBindings");
}
Set<AnnotatedMethod<? super X>> methods = webBeansContext.getAnnotatedElementFactory().getFilteredAnnotatedMethods(type);
for(AnnotatedMethod<? super X> methodA : methods)
{
Method method = methodA.getJavaMember();
int modifiers = method.getModifiers();
if (!method.isSynthetic() && !method.isBridge() && !Modifier.isStatic(modifiers) && !Modifier.isPrivate(modifiers) && Modifier.isFinal(modifiers))
{
if (hasClassInterceptors)
{
// spec section 3.15 unproxyable bean types -> Deployment Error
throw new WebBeansDeploymentException("Managed bean class : " + clazz.getName()
+ " can not define non-static, non-private final methods. Because it is annotated with at least one @InterceptorBinding");
}
if (annotationManager.hasInterceptorBindingMetaAnnotation(
AnnotationUtil.asArray(methodA.getAnnotations())))
{
// spec section 3.15 unproxyable bean types -> Deployment Error
throw new WebBeansDeploymentException("Method : " + method.getName() + "in managed bean class : " + clazz.getName()
+ " can not be defined as non-static, non-private and final . Because it is annotated with at least one @InterceptorBinding");
}
}
}
}