private boolean isVetoed()

in webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java [1483:1573]


    private boolean isVetoed(Class<?> implClass)
    {
        if (implClass.getAnnotation(Vetoed.class) != null)
        {
            return true;
        }

        Package pckge = implClass.getPackage();
        if (pckge == null)
        {
            return false;
        }

        do
        {
            // yes we cache result with potentially different classloader but this is not portable by spec
            String name = pckge.getName();
            Boolean packageVetoed = packageVetoCache.get(name);
            if (packageVetoed == null)
            {
                if (pckge.getAnnotation(Vetoed.class) != null)
                {
                    packageVetoCache.put(pckge.getName(), true);
                    return true;
                }
                else
                {
                    packageVetoCache.put(pckge.getName(), false);
                }
            }
            else if (packageVetoed)
            {
                return true;
            }

            if (skipVetoedOnPackages) // we want to avoid loadClass with this property, not cached reflection
            {
                return false;
            }

            ClassLoader classLoader = implClass.getClassLoader();
            if (classLoader == null)
            {
                classLoader = BeansDeployer.class.getClassLoader();
            }

            int idx = name.lastIndexOf('.');
            if (idx > 0)
            {
                String previousPackage = name.substring(0, idx);
                Boolean result = packageVetoCache.get(previousPackage);
                if (result != null)
                {
                    return result;
                }
                while (true)
                {
                    try // not always existing but enables to go further when getPackage is not available (graal)
                    {
                        pckge = classLoader.loadClass(previousPackage +
                                (previousPackage.isEmpty() ? "" :".") + "package-info").getPackage();
                        break;
                    }
                    catch (Exception e)
                    {
                        if (previousPackage.isEmpty())
                        {
                            pckge = null;
                            break;
                        }
                        packageVetoCache.put(previousPackage, false);
                        idx = previousPackage.lastIndexOf('.');
                        if (idx > 0)
                        {
                            previousPackage = previousPackage.substring(0, idx);
                        }
                        else
                        {
                            previousPackage = "";
                        }
                    }
                }
            }
            else
            {
                pckge = null;
            }
        } while (pckge != null);

        return false;
    }