weld/subsystem/src/main/java/org/jboss/as/weld/deployment/BeanDeploymentArchiveImpl.java
public boolean isAccessible(BeanDeploymentArchive target) {
        if (this == target) {
            return true;
        }

        BeanDeploymentArchiveImpl that = (BeanDeploymentArchiveImpl) target;

        if (that.getModule() == null) {
            /*
             * The target BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader.
             * Everyone can see the bootstrap classloader.
             */
            return true;
        }
        if (module == null) {
            /*
             * This BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader. We assume that a
             * bean whose class is loaded by the bootstrap classloader can only see other beans in the "bootstrap BDA".
             */
            return that.getModule() == null;
        }

        if (module.equals(that.getModule())) {
            return true;
        }

        // basic check whether the module is our dependency
        for (DependencySpec dependency : module.getDependencies()) {
            if (dependency instanceof ModuleDependencySpec) {
                ModuleDependencySpec moduleDependency = (ModuleDependencySpec) dependency;
                if (moduleDependency.getIdentifier().equals(that.getModule().getIdentifier())) {
                    return true;
                }

                // moduleDependency might be an alias - try to load it to get lined module
                Module module = loadModule(moduleDependency);
                if (module != null && module.getIdentifier().equals(that.getModule().getIdentifier())) {
                    return true;
                }
            }
        }

        /*
         * full check - we try to load a class from the target bean archive and check whether its module
         * is the same as the one of the bean archive
         * See WFLY-4250 for more info
         */
        Iterator<String> iterator = target.getBeanClasses().iterator();
        if (iterator.hasNext()) {
            Class<?> clazz = Reflections.loadClass(iterator.next(), module.getClassLoader());
            if (clazz != null) {
                Module classModule = Module.forClass(clazz);
                return classModule != null && classModule.equals(that.getModule());
            }
        }
        return false;
    }
public boolean isAccessible(BeanDeploymentArchive target) {
        if (this == target) {
            return true;
        }

        BeanDeploymentArchiveImpl that = (BeanDeploymentArchiveImpl) target;

        if (that.getModule() == null) {
            /*
             * The target BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader.
             * Everyone can see the bootstrap classloader.
             */
            return true;
        }
        if (module == null) {
            /*
             * This BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader. We assume that a
             * bean whose class is loaded by the bootstrap classloader can only see other beans in the "bootstrap BDA".
             */
            return that.getModule() == null;
        }

        if (module.equals(that.getModule())) {
            return true;
        }

        // basic check whether the module is our dependency
        for (DependencySpec dependency : module.getDependencies()) {
            if (dependency instanceof ModuleDependencySpec) {
                ModuleDependencySpec moduleDependency = (ModuleDependencySpec) dependency;
                if (moduleDependency.getIdentifier().equals(that.getModule().getIdentifier())) {
                    return true;
                }

                // moduleDependency might be an alias - try to load it to get lined module
                Module module = loadModule(moduleDependency);
                if (module != null && module.getIdentifier().equals(that.getModule().getIdentifier())) {
                    return true;
                }
            }
        }

        /*
         * full check - we try to load a class from the target bean archive and check whether its module
         * is the same as the one of the bean archive
         * See WFLY-4250 for more info
         */
        Iterator<String> iterator = target.getBeanClasses().iterator();
        if (iterator.hasNext()) {
            Class<?> clazz = Reflections.loadClass(iterator.next(), module.getClassLoader());
            if (clazz != null) {
                Module classModule = Module.forClass(clazz);
                return classModule != null && classModule.equals(that.getModule());
            }
        }
        return false;
    }
public boolean isAccessible ( BeanDeploymentArchive target ) { if ( this == target ) { return true ; } BeanDeploymentArchiveImpl that = ( BeanDeploymentArchiveImpl ) target ; if ( that . getModule ( ) == null ) { /*
             * The target BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader.
             * Everyone can see the bootstrap classloader.
             */ return true ; } if ( module == null ) { /*
             * This BDA is the bootstrap BDA - it bundles classes loaded by the bootstrap classloader. We assume that a
             * bean whose class is loaded by the bootstrap classloader can only see other beans in the "bootstrap BDA".
             */ return that . getModule ( ) == null ; } if ( module . equals ( that . getModule ( ) ) ) { return true ; } // basic check whether the module is our dependency for ( DependencySpec dependency : module . getDependencies ( ) ) { if ( dependency instanceof ModuleDependencySpec ) { ModuleDependencySpec moduleDependency = ( ModuleDependencySpec ) dependency ; if ( moduleDependency . getIdentifier ( ) . equals ( that . getModule ( ) . getIdentifier ( ) ) ) { return true ; } // moduleDependency might be an alias - try to load it to get lined module Module module = loadModule ( moduleDependency ) ; if ( module != null && module . getIdentifier ( ) . equals ( that . getModule ( ) . getIdentifier ( ) ) ) { return true ; } } } /*
         * full check - we try to load a class from the target bean archive and check whether its module
         * is the same as the one of the bean archive
         * See WFLY-4250 for more info
         */ Iterator < String > iterator = target . getBeanClasses ( ) . iterator ( ) ; if ( iterator . hasNext ( ) ) { Class < ? > clazz = Reflections . loadClass ( iterator . next ( ) , module . getClassLoader ( ) ) ; if ( clazz != null ) { Module classModule = Module . forClass ( clazz ) ; return classModule != null && classModule . equals ( that . getModule ( ) ) ; } } return false ; }
Determines if a class from this {@link BeanDeploymentArchiveImpl} instance can access a class in the
{@link BeanDeploymentArchive} instance represented by the specified <code>BeanDeploymentArchive</code> parameter
according to the Java EE class accessibility requirements.

@param target
@return true if an only if a class this archive can access a class from the archive represented by the specified parameter
Determines if a class from this { @link BeanDeploymentArchiveImpl } instance can access a class in the { @link BeanDeploymentArchive } instance represented by the specified <code > BeanDeploymentArchive< / code > parameter according to the Java EE class accessibility requirements .