protected void checkProducerMethod ( EnhancedAnnotatedMethod < T , ? super X > method ) { if ( method . getEnhancedParameters ( Observes . class ) . size ( ) > 0 ) { throw BeanLogger . LOG . inconsistentAnnotationsOnMethod ( PRODUCER_ANNOTATION , "@Observes" , this . method , Formats . formatAsStackTraceElement ( method . getJavaMember ( ) ) ) ; } else if ( method . getEnhancedParameters ( ObservesAsync . class ) . size ( ) > 0 ) { throw BeanLogger . LOG . inconsistentAnnotationsOnMethod ( PRODUCER_ANNOTATION , "@ObservesAsync" , this . method , Formats . formatAsStackTraceElement ( method . getJavaMember ( ) ) ) ; } else if ( method . getEnhancedParameters ( Disposes . class ) . size ( ) > 0 ) { throw BeanLogger . LOG . inconsistentAnnotationsOnMethod ( PRODUCER_ANNOTATION , "@Disposes" , this . method , Formats . formatAsStackTraceElement ( method . getJavaMember ( ) ) ) ; } else if ( getDeclaringBean ( ) instanceof SessionBean < ? > && ! Modifier . isStatic ( method . slim ( ) . getJavaMember ( ) . getModifiers ( ) ) ) { boolean methodDeclaredOnTypes = false ; for ( Type type : getDeclaringBean ( ) . getTypes ( ) ) { Class < ? > clazz = Reflections . getRawType ( type ) ; try { AccessController . doPrivileged ( new GetMethodAction ( clazz , method . getName ( ) , method . getParameterTypesAsArray ( ) ) ) ; methodDeclaredOnTypes = true ; break ; } catch ( PrivilegedActionException ignored ) { } } if ( ! methodDeclaredOnTypes ) { throw BeanLogger . LOG . methodNotBusinessMethod ( "Producer" , this , getDeclaringBean ( ) , Formats . formatAsStackTraceElement ( method . getJavaMember ( ) ) ) ; } } }
Validates the producer method