/**
   * 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;
    }
  }
Exemplo n.º 2
0
 /**
  * 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;
   }
 }
Exemplo n.º 3
0
 public Object sendx(String message, Object... args) {
   return type.sendx(this, message, args);
 }