Determine whether class is allowed in App Engine Standard.

@param className fully package qualified class name
@return true if this class is allowed in Java 7 on App Engine Standard, false otherwise
960157
public static boolean contains(String className) {
    if (className.startsWith("javax.")) {
      return !isBundledInJre(className) || WHITELIST.contains(className);
    } else if (className.startsWith("java.")
        || className.startsWith("sun.util.")
        || className.startsWith("org.xml.sax.")
        || className.startsWith("org.w3c.dom.")
        || className.startsWith("org.omg.")
        || className.startsWith("org.ietf.jgss.")
        // com.sun and com.oracle packages are tricky. Some are in the JRE. Some aren't.
        || className.startsWith("com.sun.jmx.")
        || className.startsWith("com.sun.jndi.")
        || className.startsWith("com.sun.media.")
        || className.startsWith("com.sun.management.")
        || className.startsWith("com.sun.beans.")
        || className.startsWith("com.sun.corba.")
        || className.startsWith("com.sun.awt.")
        || className.startsWith("com.sun.swing.")
        || className.startsWith("com.sun.rmi.")
        || className.startsWith("com.sun.xml.")
        || className.startsWith("com.sun.java.")
        || className.startsWith("com.sun.org.")
        || className.startsWith("com.sun.rowset.")
        || className.startsWith("com.oracle.net.")
        || className.startsWith("com.oracle.nio.")
        || className.startsWith("com.oracle.util.")) {
      return WHITELIST.contains(className);
    } else { // not a JRE class
      return true;
    }
  }
159379
private boolean isIncluded(String className) {
    if (includes == null || includes.size() == 0) {
      // generate nothing if no include defined - it makes no sense to generate for all classes from classpath
      return false;
    }
    return includes.stream()
        .filter(pattern -> SelectorUtils.matchPath(pattern, className, ".", true))
        .count() > 0;
  }
931691
public static boolean isVetoed(Class<?> javaClass) {
        if (javaClass.isAnnotationPresent(Vetoed.class)) {
            return true;
        }
        return isPackageVetoed(javaClass.getPackage());
    }
151718
public static boolean checkIfClassVersionApplicable(Object cacheEntry, boolean useStructuredCache) {
        if (!useStructuredCache && cacheEntry instanceof CacheEntry) {
            return true;
        }

        if (useStructuredCache && cacheEntry instanceof Map) {
            return true;
        }
        return false;
    }
1033730
public static boolean hasAmazonClasses() {
        boolean result;
        synchronized (AmazonAppstore.class) {
            try {
                ClassLoader localClassLoader = AmazonAppstore.class.getClassLoader();
                localClassLoader.loadClass("com.amazon.android.Kiwi");
                result = true;
            } catch (Throwable localThrowable) {
                Logger.d("hasAmazonClasses() cannot load class com.amazon.android.Kiwi");
                result = false;
            }
        }
        return result;
    }
894008
public boolean exists(String className) {
		if(this.classLoader!=null) {
			if(exists(className, this.classLoader)) {
				LOG.debug("class {} found using class specific class loader", className);
				return true;
			}
			return false;
		}
		if(existsWithDefaultClassLoader(className)) {
			LOG.debug("class {} found using default class loader", className);
			return true;
		}
		if(exists(className, Thread.currentThread().getContextClassLoader())) {
			LOG.debug("class {} found using class loader of current thread", className);
			return true;
		}
		if(exists(className, getClass().getClassLoader())) {
			LOG.debug("class {} found using class loader of current class", className);
			return true;
		}
		return false;
	}
1186016
public static ClassLoader getAppClassLoader(String appName) {
        ClassLoader appClassLoader = APPNAME_CLASSLOADER_MAP.get(appName);
        if (appClassLoader == null) {
            return ClassLoaderUtils.getCurrentClassLoader();
        } else {
            return appClassLoader;
        }
    }
1246289
public boolean matches( Class<?> clazz ) {
        // fully qualified import?
        if( this.target.equals( clazz.getName() ) ) {
            return true;
        }

        // wild card imports
        if( this.target.endsWith( ".*" ) ) {
            String prefix = this.target.substring( 0, this.target.indexOf( ".*" ) );

            // package import: import my.package.*
            if( prefix.equals( clazz.getPackage().getName() ) ) {
                return true;
            }

            // inner class imports with wild card?
            // by looking at the ClassTypeResolver class, it seems we do not support
            // the usage of wild cards when importing static inner classes like the
            // java static imports allow
        }
        return false;
    }
848004
public static boolean isJsp21(ServletContext context)
    {
        //if running on GAE, treat like it is JSP 2.0
        if(isRunningOnGoogleAppEngine(context))
        {
            return false;
        }
        
        try 
        {
            // simply check if the class JspApplicationContext is available
            Class.forName("javax.servlet.jsp.JspApplicationContext");
            return true;
        } 
        catch (ClassNotFoundException ex) 
        {
            // expected exception in a JSP 2.0 (or less) environment
        }
        
        return false;
    }
29142
private boolean specificMatching(String className) {

    for (int i = 0; i < processPackages.length; i++) {
      if (className.startsWith(processPackages[i])) {
        // a positive match
        return false;
      }
    }
    // we can ignore this class
    return true;
  }
1005686
public static boolean isClassAvailable(String s)
    {
        final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        try
        {
            classLoader.loadClass(s);
            return true;
        }
        catch (ClassNotFoundException e)
        {
            return false;
        }
    }
320428
public boolean remove(String classname) {
    String		pkgname;
    HashSet<String>	names;

    classname = ClassPathTraversal.cleanUp(classname);
    pkgname   = ClassPathTraversal.extractPackage(classname);
    names     = m_NameCache.get(pkgname);
    if (names != null)
      return names.remove(classname);
    else
      return false;
  }
1243906
public boolean hasClass(String className) {
        final String classAttr = attributes().getIgnoreCase("class");
        final int len = classAttr.length();
        final int wantLen = className.length();

        if (len == 0 || len < wantLen) {
            return false;
        }

        // if both lengths are equal, only need compare the className with the attribute
        if (len == wantLen) {
            return className.equalsIgnoreCase(classAttr);
        }

        // otherwise, scan for whitespace and compare regions (with no string or arraylist allocations)
        boolean inClass = false;
        int start = 0;
        for (int i = 0; i < len; i++) {
            if (Character.isWhitespace(classAttr.charAt(i))) {
                if (inClass) {
                    // white space ends a class name, compare it with the requested one, ignore case
                    if (i - start == wantLen && classAttr.regionMatches(true, start, className, 0, wantLen)) {
                        return true;
                    }
                    inClass = false;
                }
            } else {
                if (!inClass) {
                    // we're in a class name : keep the start of the substring
                    inClass = true;
                    start = i;
                }
            }
        }

        // check the last entry
        if (inClass && len - start == wantLen) {
            return classAttr.regionMatches(true, start, className, 0, wantLen);
        }

        return false;
    }
956766
public static boolean isIgnorableBinName(String className) {
        return (className.startsWith("[", 0)
                || className.startsWith(JAVA_BIN, 0)
                || className.startsWith(JAVAX_BIN, 0)
                || className.startsWith(JDK_BIN, 0)
                || className.startsWith(SUN_BIN, 0)
                || className.startsWith(COM_SUN_BIN, 0)
                || className.startsWith(ORG_XML_SAX_BIN, 0)
                || className.startsWith(ORG_IETF_JGSS_BIN, 0)
                || className.startsWith(ORG_OMG_BIN, 0)
                || className.startsWith(ORG_W3C_BIN, 0)
                || className.startsWith(XTS_BIN, 0)
                || className.startsWith(ORG_MOCKITO_BIN, 0)
                || className.startsWith(ORG_JACOCO_AGENT_BIN, 0));
    }
975875
public String java(GeneratedPackage generatedPackage, String javaClassName) {
        generatedPackageRestriction(generatedPackage);
        return java(generatedPackage.getPackageName(), javaClassName);
    }
448689
public static boolean isClassAvailable(final String className) {
        try {
            final Class<?> clazz = loadClass(className);
            return clazz != null;
        } catch (final ClassNotFoundException | LinkageError e) {
            return false;
        } catch (final Throwable e) {
            LowLevelLogUtil.logException("Unknown error checking for existence of class: " + className, e);
            return false;
        }
    }
875053
private static Class checkClass(String packageName, TypeElement type, Map<String, String> mappedUniName,
            boolean isUniName) {
        String simpleName = getProxyClassName(type.name(), mappedUniName, isUniName);
        String className = packageName + PACKAGE_SPLIT_CHAR + simpleName;

        Class<?> c = null;
        try {
            c = Class.forName(className);
        } catch (ClassNotFoundException e1) {
            // if class not found so should generate a new java source class.
            c = null;
        }

        return c;
    }