/*
(non-Javadoc)

@see edu.umd.cs.findbugs.classfile.IAnalysisEngineRegistrar#
registerAnalysisEngines(edu.umd.cs.findbugs.classfile.IAnalysisCache)
771128
@Override
    public void registerAnalysisEngines(IAnalysisCache analysisCache) {
        for (IClassAnalysisEngine<?> engine : classAnalysisEngineList) {
            engine.registerWith(analysisCache);
        }

        for (IMethodAnalysisEngine<?> engine : methodAnalysisEngineList) {
            engine.registerWith(analysisCache);
        }

        for (IDatabaseFactory<?> databaseFactory : databaseFactoryList) {
            databaseFactory.registerWith(analysisCache);
        }

        // if (!Subtypes.DO_NOT_USE) {
        // new
        // ReflectionDatabaseFactory<Subtypes>(Subtypes.class).registerWith(analysisCache);
        // }
    }
644063
@Override
    public NonExceptionPostdominatorsAnalysis analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor)
            throws CheckedAnalysisException {
        CFG cfg = getCFG(analysisCache, descriptor);
        ReverseDepthFirstSearch rdfs = getReverseDepthFirstSearch(analysisCache, descriptor);
        NonExceptionPostdominatorsAnalysis analysis = new NonExceptionPostdominatorsAnalysis(cfg, rdfs, getDepthFirstSearch(
                analysisCache, descriptor));
        Dataflow<java.util.BitSet, PostDominatorsAnalysis> dataflow = new Dataflow<>(cfg,
                analysis);
        dataflow.execute();
        return analysis;
    }
694564
protected void registerJavaTimeDatatypes() {

    // prevent compile-time dependencies and GWT availability problems
    registerStandardDatatype("java.time.LocalTime");
    registerStandardDatatype("java.time.LocalDate");
    registerStandardDatatype("java.time.LocalDateTime");
    registerStandardDatatype("java.time.MonthDay");
    registerStandardDatatype("java.time.Year");
    registerStandardDatatype("java.time.YearMonth");
    registerStandardDatatype("java.time.Instant");
    registerStandardDatatype("java.time.Duration");
    registerStandardDatatype("java.time.Period");
    registerStandardDatatype("java.time.OffsetTime");
    registerStandardDatatype("java.time.OffsetDate");
    registerStandardDatatype("java.time.OffsetDateTime");
    registerStandardDatatype("java.time.ZoneId");
    registerStandardDatatype("java.time.ZonedDateTime");
    registerStandardDatatype("java.time.ZoneOffset");
    registerStandardDatatype("java.time.ZoneRegion");
  }
1066715
public void setRegistry(BridgeHeadTypeRegistry registry) {
        this.registry.set(registry);
        for (FactoryAccessor<?> accessor : accessors) {
            registry.injectInto(accessor);
        }
    }
513676
public static void registerConverters(Set<?> converters, ConverterRegistry registry) {
		if (converters != null) {
			for (Object converter : converters) {
				if (converter instanceof GenericConverter) {
					registry.addConverter((GenericConverter) converter);
				}
				else if (converter instanceof Converter<?, ?>) {
					registry.addConverter((Converter<?, ?>) converter);
				}
				else if (converter instanceof ConverterFactory<?, ?>) {
					registry.addConverterFactory((ConverterFactory<?, ?>) converter);
				}
				else {
					throw new IllegalArgumentException("Each converter object must implement one of the " +
							"Converter, ConverterFactory, or GenericConverter interfaces");
				}
			}
		}
	}
463931
public void addAndRegisterAddOns(List<AddOnModel> addOns) {
        this.addOns.addAll(addOns);
        registerAllAddOns(this.addOns);
        initialized();
    }
341487
@Override
    public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException {
        LOGGER.debug("Initializing Artifactory analyzer");
        final boolean enabled = isEnabled();
        LOGGER.debug("Artifactory analyzer enabled: {}", enabled);
        if (enabled) {
            searcher = new ArtifactorySearch(getSettings());
            final boolean preflightRequest = searcher.preflightRequest();
            if (!preflightRequest) {
                setEnabled(false);
                throw new InitializationException("There was an issue connecting to Artifactory . Disabling analyzer.");
            }
        }
    }
651868
@Override
    public LoadedFieldSet analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
        MethodGen methodGen = getMethodGen(analysisCache, descriptor);
        if (methodGen == null) {
            return null;
        }
        InstructionList il = methodGen.getInstructionList();

        LoadedFieldSet loadedFieldSet = new LoadedFieldSet(methodGen);
        ConstantPoolGen cpg = getConstantPoolGen(analysisCache, descriptor.getClassDescriptor());

        for (InstructionHandle handle = il.getStart(); handle != null; handle = handle.getNext()) {
            Instruction ins = handle.getInstruction();
            short opcode = ins.getOpcode();
            try {
                if (opcode == Const.INVOKESTATIC) {
                    INVOKESTATIC inv = (INVOKESTATIC) ins;
                    if (Hierarchy.isInnerClassAccess(inv, cpg)) {
                        InnerClassAccess access = Hierarchy.getInnerClassAccess(inv, cpg);
                        /*
                         * if (access == null) {
                         * System.out.println("Missing inner class access in " +
                         * SignatureConverter.convertMethodSignature(methodGen)
                         * + " at " + inv); }
                         */
                        if (access != null) {
                            if (access.isLoad()) {
                                loadedFieldSet.addLoad(handle, access.getField());
                            } else {
                                loadedFieldSet.addStore(handle, access.getField());
                            }
                        }
                    }
                } else if (fieldInstructionOpcodeSet.get(opcode)) {
                    boolean isLoad = (opcode == Const.GETFIELD || opcode == Const.GETSTATIC);
                    XField field = Hierarchy.findXField((FieldInstruction) ins, cpg);
                    if (field != null) {
                        if (isLoad) {
                            loadedFieldSet.addLoad(handle, field);
                        } else {
                            loadedFieldSet.addStore(handle, field);
                        }
                    }
                }
            } catch (ClassNotFoundException e) {
                AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(e);
            }
        }

        return loadedFieldSet;
    }
289359
private void checkIndexableClasses(SearchIntegrator searchFactory, Set<Class<?>> indexedEntities) {
      for (Class<?> c : indexedEntities) {
         if (searchFactory.getIndexBinding(new PojoIndexedTypeIdentifier(c)) == null) {
            throw log.classNotIndexable(c.getName());
         }
      }
   }
603222
@SuppressWarnings("all")
  private void registerConvertersFromFileSystem(String converterClassResourceName, URL converterClassResourceLocation) {

    try {

      File convertersPackagePath = new File(converterClassResourceLocation.toURI()).getParentFile();

      Assert.isTrue(convertersPackagePath.isDirectory(),
          "Directory for Converters package [%s] does not exist", convertersPackagePath.getAbsolutePath());

      for (File classFile : convertersPackagePath.listFiles(new FileExtensionFilter(CLASS_FILE_EXTENSION))) {

        String converterClassName = CONVERTERS_PACKAGE.getName()
            .concat(StringUtils.DOT_SEPARATOR).concat(FileUtils.getName(classFile));

        register(converterClassName);
      }
    }
    catch (URISyntaxException cause) {
      throw newRuntimeException(cause, "Failed to create File reference to directory [%s] of Converters package",
          converterClassResourceName.substring(0, converterClassResourceName.lastIndexOf(File.separator) + 1));
    }
  }
744978
public void register(CacheEntryListenerConfiguration<K, V> configuration) {
    if (configuration.getCacheEntryListenerFactory() == null) {
      return;
    }
    EventTypeAwareListener<K, V> listener = new EventTypeAwareListener<>(
        configuration.getCacheEntryListenerFactory().create());

    CacheEntryEventFilter<K, V> filter = event -> true;
    if (configuration.getCacheEntryEventFilterFactory() != null) {
      filter = new EventTypeFilter<>(listener,
          configuration.getCacheEntryEventFilterFactory().create());
    }

    Registration<K, V> registration = new Registration<>(configuration, filter, listener);
    dispatchQueues.putIfAbsent(registration, CompletableFuture.completedFuture(null));
  }
507810
protected CFG getCFG(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor) throws CheckedAnalysisException {
        return analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
    }
785653
private void registerExternalLoaders() throws MojoExecutionException {
        if (archiveLoaders != null) {
            for (String entry : archiveLoaders) {
                try {
                    SourceLoader loader = (SourceLoader) Class.forName(entry).newInstance();
                    registerLoader(loader);
                } catch (Exception e) {
                    throw new MojoExecutionException("Error registering archive loader for class: " + entry, e);
                }
            }
        }
    }
734546
private void addProjectMethods(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
        Set<MethodIdentifier> projectMethodIdentifiers = findUnhandledProjectMethodIdentifiers(instructions, projectMethods);

        for (MethodIdentifier identifier : projectMethodIdentifiers) {
            // TODO cache results -> singleton pool?

            final MethodResult methodResult = visitProjectMethod(identifier);
            if (methodResult == null) {
                continue;
            }

            final List<Instruction> nestedMethodInstructions = interpretRelevantInstructions(methodResult.getInstructions());
            projectMethods.add(new ProjectMethod(identifier, nestedMethodInstructions));
            addProjectMethods(nestedMethodInstructions, projectMethods);
        }
    }
981198
public function registerAnalysers()
    {
        $jsonFile = Environment::getJsonConfigFilename();
        if (!$jsonFile) {
            return;
        }

        $config = new Config;
        $var    = $config->validate($jsonFile);

        foreach ($var['analysers'] as $analyser) {
            if (class_exists($analyser['class'])) {
                $analyser = new $analyser['class'];

                if ($analyser instanceof AnalyserInterface) {
                    $this->addAnalyser($analyser);
                }
            }
        }
    }
1004051
public void registerFilters() {
        addExcludeFilter(new TypeFilter() {
            @Override
            public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) {
                return !metadataReader.getClassMetadata().isInterface();
            }
        });
        addIncludeFilter(new AnnotationTypeFilter(SpringRestClientEnabled.class));
    }
966643
public synchronized void registerEntityClasses(final String iPackageName, final ClassLoader iClassLoader) {
		OLogManager.instance().debug(this, "Discovering entity classes inside package: %s", iPackageName);

		List<Class<?>> classes = null;
		try {
			classes = OReflectionHelper.getClassesForPackage(iPackageName, iClassLoader);
		} catch (ClassNotFoundException e) {
			throw new OException(e);
		}
		for (Class<?> c : classes) {
			if (!classHandler.containsEntityClass(c)) {
				if (c.isAnonymousClass()) {
					OLogManager.instance().warn(this, "Trying to register an anonymous class '%s'.", c.getName());
					continue;
				}
				classHandler.registerEntityClass(c);
			}
		}

		if (OLogManager.instance().isDebugEnabled()) {
			for (Entry<String, Class<?>> entry : classHandler.getClassesEntrySet()) {
				OLogManager.instance().debug(this, "Loaded entity class '%s' from: %s", entry.getKey(), entry.getValue());
			}
		}
	}