Search in sources :

Example 1 with ClassFileInfoException

use of org.jboss.weld.resources.spi.ClassFileInfoException in project core by weld.

the class FastAnnotatedTypeLoader method loadAnnotatedType.

@Override
public <T> SlimAnnotatedTypeContext<T> loadAnnotatedType(String className, String bdaId) {
    try {
        final ClassFileInfo classFileInfo = classFileServices.getClassFileInfo(className);
        // firstly, check if this class is an annotation
        if ((classFileInfo.getModifiers() & BytecodeUtils.ANNOTATION) != 0) {
            // This is an annotation - an annotation may not end up as a managed bean nor be observer by PAT observer. Skip it.
            return null;
        }
        if (classFileInfo.isVetoed()) {
            return null;
        }
        // secondly, let's resolve PAT observers for this class
        Set<ContainerLifecycleEventObserverMethod<?>> observerMethods = Collections.emptySet();
        if (containerLifecycleEvents.isProcessAnnotatedTypeObserved()) {
            observerMethods = resolver.resolveProcessAnnotatedTypeObservers(classFileServices, className);
            if (!observerMethods.isEmpty()) {
                // there are PAT observers for this class, register the class now
                return createContext(className, classFileInfo, observerMethods, bdaId);
            }
        }
        if (Beans.isDecoratorDeclaringInAppropriateConstructor(classFileInfo)) {
            BootstrapLogger.LOG.decoratorWithNonCdiConstructor(classFileInfo.getClassName());
        }
        // lastly, check if this class fulfills CDI managed bean requirements - if it does, add the class
        if (Beans.isTypeManagedBeanOrDecoratorOrInterceptor(classFileInfo, checkTypeModifiers)) {
            return createContext(className, classFileInfo, observerMethods, bdaId);
        }
        return null;
    } catch (ClassFileInfoException e) {
        BootstrapLogger.LOG.exceptionLoadingAnnotatedType(e.getMessage());
        return fallback.loadAnnotatedType(className, bdaId);
    }
}
Also used : ContainerLifecycleEventObserverMethod(org.jboss.weld.event.ContainerLifecycleEventObserverMethod) ClassFileInfoException(org.jboss.weld.resources.spi.ClassFileInfoException) ClassFileInfo(org.jboss.weld.resources.spi.ClassFileInfo)

Aggregations

ContainerLifecycleEventObserverMethod (org.jboss.weld.event.ContainerLifecycleEventObserverMethod)1 ClassFileInfo (org.jboss.weld.resources.spi.ClassFileInfo)1 ClassFileInfoException (org.jboss.weld.resources.spi.ClassFileInfoException)1