コード例 #1
0
  /**
   * Find a method in given class.
   *
   * @param classDesc the class descriptor
   * @param methodName the name of the method
   * @param methodSig the signature of the method
   * @param isStatic are we looking for a static method?
   * @return the JavaClassAndMethod, or null if no such method exists in the class
   */
  public static @CheckForNull XMethod findMethod(
      ClassDescriptor classDesc, String methodName, String methodSig, boolean isStatic) {
    if (DEBUG_METHOD_LOOKUP) {
      System.out.println("Check " + classDesc.getClassName());
    }

    try {
      XClass xClass = Global.getAnalysisCache().getClassAnalysis(XClass.class, classDesc);
      return xClass.findMethod(methodName, methodSig, isStatic);
    } catch (CheckedAnalysisException e) {
      AnalysisContext.logError("Error looking for " + classDesc + "." + methodName + methodSig, e);
      return null;
    }
  }
コード例 #2
0
ファイル: AnalysisContext.java プロジェクト: deveshg/findbugs
 /**
  * Lookup a class's source file
  *
  * @param dottedClassName the name of the class
  * @return the source file for the class, or {@link SourceLineAnnotation#UNKNOWN_SOURCE_FILE} if
  *     unable to determine
  */
 public final String lookupSourceFile(@Nonnull @DottedClassName String dottedClassName) {
   requireNonNull(dottedClassName, "className is null");
   try {
     XClass xClass =
         Global.getAnalysisCache()
             .getClassAnalysis(
                 XClass.class,
                 DescriptorFactory.createClassDescriptorFromDottedClassName(dottedClassName));
     String name = xClass.getSource();
     if (name == null) {
       return SourceLineAnnotation.UNKNOWN_SOURCE_FILE;
     }
     return name;
   } catch (CheckedAnalysisException e) {
     return SourceLineAnnotation.UNKNOWN_SOURCE_FILE;
   }
 }
コード例 #3
0
ファイル: XObj.java プロジェクト: TonyClark/XPL
 public Object sendx(String message, Object... args) {
   return type.sendx(this, message, args);
 }