Add an annotation to this class.

@param classAnnotationInfo
the class annotation info
@param classNameToClassInfo
the map from class name to class info
548439
void addClassAnnotation(final AnnotationInfo classAnnotationInfo,
            final Map<String, ClassInfo> classNameToClassInfo) {
        final ClassInfo annotationClassInfo = getOrCreateClassInfo(classAnnotationInfo.getName(),
                ANNOTATION_CLASS_MODIFIER, classNameToClassInfo);
        if (this.annotationInfo == null) {
            this.annotationInfo = new AnnotationInfoList(2);
        }
        this.annotationInfo.add(classAnnotationInfo);

        this.addRelatedClass(RelType.CLASS_ANNOTATIONS, annotationClassInfo);
        annotationClassInfo.addRelatedClass(RelType.CLASSES_WITH_ANNOTATION, this);

        // Record use of @Inherited meta-annotation
        if (classAnnotationInfo.getName().equals(Inherited.class.getName())) {
            isInherited = true;
        }
    }
855974
void addPackageInfo(final PackageInfo packageInfo) {
        if (packageInfoSet == null) {
            packageInfoSet = new HashSet<>();
        }
        packageInfoSet.add(packageInfo);
    }
96232
private void populateMethodInfo(JavaClass cls, Map<String, Set<String>> methodInfo) {
        try {
            if (Values.DOTTED_JAVA_LANG_OBJECT.equals(cls.getClassName())) {
                return;
            }

            Method[] methods = cls.getMethods();
            for (Method m : methods) {
                String sig = m.getSignature();
                if (isPossiblyConfusingSignature(sig)) {

                    String name = m.getName();
                    Set<String> sigs = methodInfo.get(name);
                    if (sigs == null) {
                        sigs = new HashSet<>(3);
                        methodInfo.put(name, sigs);
                    }
                    sigs.add(m.getSignature());
                }
            }

            populateMethodInfo(cls.getSuperClass(), methodInfo);
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        }
    }
767151
public AnnotatedTypeBuilder<X> addToField(Field field, Annotation annotation) {
       if (fields.get(field) == null) {
           fields.put(field, new AnnotationBuilder());
       }
       fields.get(field).add(annotation);
       return this;
   }
1147464
@SuppressWarnings("unchecked")
    private void processToString(ClassTraceInfo info) {
        for (MethodNode mn : (List<MethodNode>) info.classNode.methods) {
            if (!mn.name.equals("toString") || !mn.desc.equals("()Ljava/lang/String;")) {
                continue;
            }
            Iterator<? extends AbstractInsnNode> instructionIterator = mn.instructions.iterator();
            INSN_LOOP: while (instructionIterator.hasNext()) {
                AbstractInsnNode insnNode = instructionIterator.next();
                if (insnNode.getType() == AbstractInsnNode.METHOD_INSN) {
                    MethodInsnNode methodInsn = (MethodInsnNode) insnNode;

                    // Skip static methods
                    if (methodInsn.getOpcode() == Opcodes.INVOKESTATIC) {
                        continue;
                    }

                    // Skip methods that aren't part of this class
                    if (!methodInsn.owner.equals(info.classNode.name)) {
                        continue;
                    }

                    // Skip explicitly trivial methods from this file class
                    MethodNode m = getMethod(methodInsn.name, methodInsn.desc, info.classNode.methods);
                    if (m != null && getAnnotation(TRIVIAL_TYPE.getDescriptor(), m.visibleAnnotations) != null) {
                        continue;
                    }

                    // If the target method is not found on this class and the super class
                    // is in the set of files being instrumented, see if it's trivial
                    String superName = info.classNode.superName;
                    while (m == null && superName != null && !"java/lang/Object".equals(superName)) {
                        if (superName.startsWith("java/") || superName.startsWith("javax/")) {
                            continue INSN_LOOP;
                        }
                        InputStream superClassInputStream = getClassInputStream(superName);
                        if (superClassInputStream == null) {
                            StringBuilder sb = new StringBuilder();
                            sb.append("INFO: ").append(info.classNode.name.replaceAll("/", "\\."));
                            sb.append(" extends class ").append(superName.replaceAll("/", "\\."));
                            sb.append(" and is calling ").append(methodInsn.name);
                            sb.append(" from toString()");
                            info.warnings.add(sb.toString());
                            continue INSN_LOOP;
                        }
                        ClassNode cn = getClassNode(superClassInputStream, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);
                        m = getMethod(methodInsn.name, methodInsn.desc, cn.methods);
                        superName = cn.superName;
                    }

                    // Found a method declaration on the super class that's marked as trivial
                    if (m != null && getAnnotation(TRIVIAL_TYPE.getDescriptor(), m.visibleAnnotations) != null) {
                        continue;
                    }

                    // Add a warning
                    StringBuilder sb = new StringBuilder();
                    sb.append("WARNING: ").append(info.classNode.name.replaceAll("/", "\\."));
                    sb.append(" is calling traceable methods from toString(); this may result in infinite recursion.  ");
                    sb.append("Consider referencing class fields or marking the called methods trivial to avoid trace.");
                    info.warnings.add(sb.toString());
                    break;
                }
            }
        }
    }
1136324
@Nonnull
    public BugInstance addClass(@SlashedClassName(when = When.UNKNOWN)  String className) {
        ClassAnnotation classAnnotation = new ClassAnnotation(ClassName.toDottedClassName(className));
        add(classAnnotation);
        return this;
    }
1372238
public void addClassNodeToCompile(ClassNode node, SourceUnit location) {
        classesToCompile.put(node.getName(), node);
        classNameToSource.put(node.getName(), location);
    }
694153
public void addAnnotationInfo(Element element, Content htmltree) {
        addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree);
    }
1224484
public void addClassDoc(ClassDoc classdoc) {
        if (classdoc == null) {
            return;
        }
        addClass(classdoc, allClasses);
        if (classdoc.isOrdinaryClass()) {
            addClass(classdoc, ordinaryClasses);
        } else if (classdoc.isException()) {
            addClass(classdoc, exceptions);
        } else if (classdoc.isEnum()) {
            addClass(classdoc, enums);
        } else if (classdoc.isAnnotationType()) {
            addClass(classdoc, annotationTypes);
        } else if (classdoc.isError()) {
            addClass(classdoc, errors);
        } else if (classdoc.isInterface()) {
            addClass(classdoc, interfaces);
        }
    }
727049
public void addColumnInfo(ColumnInfo columnInfo)
    {
        if (this.columnMetadatas == null)
        {
            this.columnMetadatas = new ArrayList<ColumnInfo>();
        }
        if (!columnMetadatas.contains(columnInfo) && !this.getIdColumnName().equals(columnInfo.getColumnName()))
        {
            columnMetadatas.add(columnInfo);
        }
    }
698341
public static function addMethodAnnotations($className, $methodName, ...$annotations)
    {
        if(isset(static::$annotations[$className]['Methods'][$methodName]))
        {
            static::$annotations[$className]['Methods'][$methodName] = array_merge(static::$annotations[$className]['Methods'][$methodName], $annotations);
        }
        else
        {
            static::$annotations[$className]['Methods'][$methodName] = $annotations;
        }
        foreach($annotations as $annotation)
        {
            static::$annotationRelation[get_class($annotation)]['Method'][] = [
                'type'      =>  'Method',
                'class'     =>  $className,
                'method'    =>  $methodName,
                'annotation'=>  $annotation,
            ];
        }
    }
1220770
public AnnotationInfoList getAnnotationInfo() {
        if (!scanResult.scanSpec.enableAnnotationInfo) {
            throw new IllegalArgumentException("Please call ClassGraph#enableAnnotationInfo() before #scan()");
        }
        if (annotationInfo == null || annotationInfo.length == 0) {
            return AnnotationInfoList.EMPTY_LIST;
        } else {
            final AnnotationInfoList annotationInfoList = new AnnotationInfoList(annotationInfo.length);
            Collections.addAll(annotationInfoList, annotationInfo);
            return AnnotationInfoList.getIndirectAnnotations(annotationInfoList, /* annotatedClass = */ null);
        }
    }
112656
public static boolean isProvider(ClassInfo classInfo) {
        AnnotationInfo annotationInfo = classInfo.getAnnotation(JaxWsConstants.WEB_SERVICE_ANNOTATION_NAME);
        if (annotationInfo == null) {
            annotationInfo = classInfo.getAnnotation(JaxWsConstants.WEB_SERVICE_PROVIDER_ANNOTATION_NAME);
            if (annotationInfo != null) {
                return true;
            }
        }
        return false;
    }
1255320
@SuppressWarnings("unchecked")
    static void registerAnnotationType(AnnotationClassValue<?> annotationClassValue) {
        final String name = annotationClassValue.getName();
        if (!ANNOTATION_TYPES.containsKey(name)) {
            annotationClassValue.getType().ifPresent((Consumer<Class<?>>) aClass -> {
                if (Annotation.class.isAssignableFrom(aClass)) {
                    ANNOTATION_TYPES.put(name, (Class<? extends Annotation>) aClass);
                }
            });
        }
    }
1028189
public static void addToClasspath(final URL url, final ClassLoader classLoader) {
        checkNotNull("url", url);
        checkNotNull("classLoader", classLoader);
        if (!(classLoader instanceof URLClassLoader)) {
            throw new IllegalArgumentException("Cannot add '" + url + "' to classloader because it's not an URL classloader");
        }
        final URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
        if (!containsURL(urlClassLoader.getURLs(), url)) {
            try {

                final Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class });
                addURL.setAccessible(true);
                addURL.invoke(urlClassLoader, new Object[] { url });
            } catch (final NoSuchMethodException e) {
                throw new RuntimeException(e);
            } catch (final IllegalArgumentException e) {
                throw new RuntimeException(e);
            } catch (final IllegalAccessException e) {
                throw new RuntimeException(e);
            } catch (final InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        }
    }
984559
public ClassNode annotatedWith(String name) {
        ClassNode anno = infoBase.node(name);
        this.annotations.add(anno);
        anno.annotated.add(this);
        return this;
    }
899865
static void addClassContainment(final List<SimpleEntry<String, String>> classContainmentEntries,
            final Map<String, ClassInfo> classNameToClassInfo) {
        for (final SimpleEntry<String, String> ent : classContainmentEntries) {
            final String innerClassName = ent.getKey();
            final ClassInfo innerClassInfo = ClassInfo.getOrCreateClassInfo(innerClassName,
                    /* classModifiers = */ 0, classNameToClassInfo);
            final String outerClassName = ent.getValue();
            final ClassInfo outerClassInfo = ClassInfo.getOrCreateClassInfo(outerClassName,
                    /* classModifiers = */ 0, classNameToClassInfo);
            innerClassInfo.addRelatedClass(RelType.CONTAINED_WITHIN_OUTER_CLASS, outerClassInfo);
            outerClassInfo.addRelatedClass(RelType.CONTAINS_INNER_CLASS, innerClassInfo);
        }
    }