src/main/java/io/github/classgraph/ClassInfo.java
static ClassInfo addScannedClass(final String className, final int classModifiers,
            final boolean isExternalClass, final Map<String, ClassInfo> classNameToClassInfo,
            final ClasspathElement classpathElement, final Resource classfileResource) {
        ClassInfo classInfo = classNameToClassInfo.get(className);
        if (classInfo == null) {
            // This is the first time this class has been seen, add it
            classNameToClassInfo.put(className,
                    classInfo = new ClassInfo(className, classModifiers, classfileResource));
        } else {
            // There was a previous placeholder ClassInfo class added, due to the class being referred
            // to as a superclass, interface or annotation. The isScannedClass field should be false
            // in this case, since the actual class definition wasn't reached before now.
            if (classInfo.isScannedClass) {
                // The class should not have been scanned more than once, because of classpath masking
                throw new IllegalArgumentException("Class " + className
                        + " should not have been encountered more than once due to classpath masking --"
                        + " please report this bug at: https://github.com/classgraph/classgraph/issues");
            }
        }

        // Mark the class as scanned
        classInfo.isScannedClass = true;

        // Mark the class as non-external if it is a whitelisted class
        classInfo.isExternalClass = isExternalClass;

        // Remember which classpath element (zipfile / classpath root directory / module) the class was found in
        classInfo.classpathElement = classpathElement;

        // Remember which classloader is used to load the class
        classInfo.classLoader = classpathElement.getClassLoader();

        return classInfo;
    }
/**
     * Add a class that has just been scanned (as opposed to just referenced by a scanned class). Not threadsafe,
     * should be run in single threaded context.
     *
     * @param className
     *            the class name
     * @param classModifiers
     *            the class modifiers
     * @param isExternalClass
     *            true if this is an external class
     * @param classNameToClassInfo
     *            the map from class name to class info
     * @param classpathElement
     *            the classpath element
     * @param classfileResource
     *            the classfile resource
     * @return the class info
     */
Add a class that has just been scanned (as opposed to just referenced by a scanned class). Not threadsafe,
should be run in single threaded context.


Add a class that has just been scanned ( as opposed to just referenced by a scanned class ) . Not threadsafe should be run in single threaded context .
static ClassInfo addScannedClass(final String className, final int classModifiers,
            final boolean isExternalClass, final Map<String, ClassInfo> classNameToClassInfo,
            final ClasspathElement classpathElement, final Resource classfileResource) {
        ClassInfo classInfo = classNameToClassInfo.get(className);
        if (classInfo == null) {
            classNameToClassInfo.put(className,
                    classInfo = new ClassInfo(className, classModifiers, classfileResource));
        } else {
            if (classInfo.isScannedClass) {
                throw new IllegalArgumentException("Class " + className
                        + " should not have been encountered more than once due to classpath masking --"
                        + " please report this bug at: https://github.com/classgraph/classgraph/issues");
            }
        }
        classInfo.isScannedClass = true;
        classInfo.isExternalClass = isExternalClass;
        classInfo.classpathElement = classpathElement;
        classInfo.classLoader = classpathElement.getClassLoader();
        return classInfo;
    }
static ClassInfo addScannedClass ( final String className , final int classModifiers , final boolean isExternalClass , final Map < String , ClassInfo > classNameToClassInfo , final ClasspathElement classpathElement , final Resource classfileResource ) { ClassInfo classInfo = classNameToClassInfo . get ( className ) ; if ( classInfo == null ) { classNameToClassInfo . put ( className , classInfo = new ClassInfo ( className , classModifiers , classfileResource ) ) ; } else { if ( classInfo . isScannedClass ) { throw new IllegalArgumentException ( "Class " + className + " should not have been encountered more than once due to classpath masking --" + " please report this bug at: https://github.com/classgraph/classgraph/issues" ) ; } } classInfo . isScannedClass = true ; classInfo . isExternalClass = isExternalClass ; classInfo . classpathElement = classpathElement ; classInfo . classLoader = classpathElement . getClassLoader ( ) ; return classInfo ; }
Add a class that has just been scanned (as opposed to just referenced by a scanned class).
Add a class that has just been scanned ( as opposed to just referenced by a scanned class ) .
// This is the first time this class has been seen, add it // There was a previous placeholder ClassInfo class added, due to the class being referred // to as a superclass, interface or annotation. The isScannedClass field should be false // in this case, since the actual class definition wasn't reached before now. // The class should not have been scanned more than once, because of classpath masking // Mark the class as scanned // Mark the class as non-external if it is a whitelisted class // Remember which classpath element (zipfile / classpath root directory / module) the class was found in // Remember which classloader is used to load the class