edu.umd.cs.findbugs.classfile.Global类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中edu.umd.cs.findbugs.classfile.Global类的一些代码示例,展示了Global类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global类的具体详情如下:
包路径:edu.umd.cs.findbugs.classfile.Global
类名称:Global

Global介绍

[英]Static methods for accessing objects that are global to an analysis session. Hopefully, this will be limited to the analysis cache.
[中]用于访问分析会话全局对象的静态方法。希望这仅限于分析缓存。

代码示例

代码示例来源:origin: spotbugs/spotbugs

/**
 * Get the Subtypes2 inheritance hierarchy database.
 */
public Subtypes2 getSubtypes2() {
  return Global.getAnalysisCache().getDatabase(Subtypes2.class);
}

代码示例来源:origin: spotbugs/spotbugs

@After
public void tearDown() {
  Global.setAnalysisCacheForCurrentThread(null);
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * Protected to allow Eclipse plugin remember some cache data for later reuse
 */
protected void clearCaches() {
  DescriptorFactory.clearInstance();
  ObjectTypeFactory.clearInstance();
  TypeQualifierApplications.clearInstance();
  TypeQualifierAnnotation.clearInstance();
  TypeQualifierValue.clearInstance();
  // Make sure the codebases on the classpath are closed
  AnalysisContext.removeCurrentAnalysisContext();
  Global.removeAnalysisCacheForCurrentThread();
  IO.close(classPath);
}

代码示例来源:origin: spotbugs/spotbugs

@Before
public void setUp () {
  Global.setAnalysisCacheForCurrentThread(new NoopAnalysisCache());
}

代码示例来源:origin: spotbugs/spotbugs

@SuppressWarnings("unchecked")
protected Map<AnalysisLocal<T>, T> getMap() {
  Map<?, ?> m = Global.getAnalysisCache().getAnalysisLocals();
  return (Map<AnalysisLocal<T>, T>) m;
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * Create the analysis cache object and register it for current execution thread.
 * <p>
 * This method is protected to allow clients override it and possibly reuse
 * some previous analysis data (for Eclipse interactive re-build)
 *
 * @throws IOException
 *             if error occurs registering analysis engines in a plugin
 */
protected IAnalysisCache createAnalysisCache() throws IOException {
  IAnalysisCache analysisCache = ClassFactory.instance().createAnalysisCache(classPath, bugReporter);
  // Register the "built-in" analysis engines
  registerBuiltInAnalysisEngines(analysisCache);
  // Register analysis engines in plugins
  registerPluginAnalysisEngines(detectorFactoryCollection, analysisCache);
  // Install the DetectorFactoryCollection as a database
  analysisCache.eagerlyPutDatabase(DetectorFactoryCollection.class, detectorFactoryCollection);
  Global.setAnalysisCacheForCurrentThread(analysisCache);
  return analysisCache;
}
/**

代码示例来源:origin: spotbugs/spotbugs

@Override
  public void report() {
    if (!Analysis.FIND_EFFECTIVE_RELEVANT_QUALIFIERS) {
      return;
    }
    Global.getAnalysisCache().eagerlyPutDatabase(InterproceduralCallGraph.class, callGraph);
  }
}

代码示例来源:origin: spotbugs/spotbugs

public FindUnsatisfiedObligation(BugReporter bugReporter) {
  this.bugReporter = bugReporter;
  IAnalysisCache analysisCache = Global.getAnalysisCache();
  database = analysisCache.getDatabase(ObligationPolicyDatabase.class);
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * @return Returns the database.
 */
static MethodInfoDatabase getDatabase() {
  return Global.getAnalysisCache().getDatabase(MethodInfoDatabase.class);
}
static IdentityHashMap<MethodInfo, Void> getUnconditionalthrowers() {

代码示例来源:origin: spotbugs/spotbugs

public FindUselessObjects(BugReporter reporter) {
  this.reporter = reporter;
  this.noSideEffectMethods = Global.getAnalysisCache().getDatabase(NoSideEffectMethodsDatabase.class);
}

代码示例来源:origin: spotbugs/spotbugs

public FindDoubleCheck(BugReporter bugReporter) {
  this.bugReporter = bugReporter;
  this.nse = Global.getAnalysisCache().getDatabase(NoSideEffectMethodsDatabase.class);
}

代码示例来源:origin: spotbugs/spotbugs

public XClass getXClass() throws CheckedAnalysisException {
  return Global.getAnalysisCache().getClassAnalysis(XClass.class, this);
}
/**

代码示例来源:origin: spotbugs/spotbugs

public FindNoSideEffectMethods(BugReporter bugReporter) {
  Global.getAnalysisCache().eagerlyPutDatabase(NoSideEffectMethodsDatabase.class, noSideEffectMethods);
}

代码示例来源:origin: spotbugs/spotbugs

/**
   * @return Returns the referencedXClass.
   */
  private XClass getReferencedXClass() {
    if (referencedXClass == null && referencedClass != null) {
      try {
        referencedXClass = Global.getAnalysisCache().getClassAnalysis(XClass.class, referencedClass);
      } catch (CheckedAnalysisException e) {
        assert true;
      }
    }
    return referencedXClass;
  }
}

代码示例来源:origin: spotbugs/spotbugs

public BuildStringPassthruGraph(BugReporter bugReporter) {
  Global.getAnalysisCache().eagerlyPutDatabase(StringPassthruDatabase.class, cache);
}

代码示例来源:origin: spotbugs/spotbugs

public DirectlyRelevantTypeQualifiersDatabase getDirectlyRelevantTypeQualifiersDatabase() {
  return Global.getAnalysisCache().getDatabase(DirectlyRelevantTypeQualifiersDatabase.class);
}

代码示例来源:origin: spotbugs/spotbugs

public static XClass getXClass(ClassDescriptor c) throws CheckedAnalysisException {
  return Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
}

代码示例来源:origin: spotbugs/spotbugs

static XClass getXClass(ClassDescriptor c) throws CheckedAnalysisException {
  return Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
}

代码示例来源:origin: spotbugs/spotbugs

protected <E> E getDatabase(Class<E> cls) {
  return Global.getAnalysisCache().getDatabase(cls);
}

代码示例来源:origin: spotbugs/spotbugs

@Override
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
  FBClassReader cr = Global.getAnalysisCache().getClassAnalysis(FBClassReader.class, classDescriptor);
  this.interfaces = new ArrayList<>();
  this.innerClasses = new ArrayList<>();
  this.fields = new ArrayList<>();
  this.methods = new ArrayList<>();
  cr.accept(this, 0);
}

相关文章