예제 #1
0
  /*
   * Instanciate a method pattern with signatures for generics search
   */
  public MethodPattern(
      boolean findDeclarations,
      boolean findReferences,
      boolean isFunction,
      char[] selector,
      char[] declaringQualification,
      char[] declaringSimpleName,
      char[] returnQualification,
      char[] returnSimpleName,
      String returnSignature,
      char[][] parameterQualifications,
      char[][] parameterSimpleNames,
      String[] parameterSignatures,
      IFunction method,
      int matchRule) {

    this(
        findDeclarations,
        findReferences,
        isFunction,
        selector,
        declaringQualification,
        declaringSimpleName,
        returnQualification,
        returnSimpleName,
        parameterQualifications,
        parameterSimpleNames,
        method.getDeclaringType(),
        matchRule);

    // Set flags
    try {
      this.varargs = (method.getFlags() & Flags.AccVarargs) != 0;
    } catch (JavaScriptModelException e) {
      // do nothing
    }

    methodParameters = true;

    if (declaringType != null) {
      // Store type signature and arguments for declaring type
      storeTypeSignaturesAndArguments(declaringType);
    }
    // Store type signatures and arguments for return type
    if (returnSignature != null) {
      returnTypeSignatures = Util.splitTypeLevelsSignature(returnSignature);
      returnTypeArguments = Util.getAllTypeArguments(returnTypeSignatures);
    }

    // Store type signatures and arguments for method parameters type
    if (parameterSignatures != null) {
      int length = parameterSignatures.length;
      if (length > 0) {
        parametersTypeSignatures = new char[length][][];
        parametersTypeArguments = new char[length][][][];
        for (int i = 0; i < length; i++) {
          parametersTypeSignatures[i] = Util.splitTypeLevelsSignature(parameterSignatures[i]);
          parametersTypeArguments[i] = Util.getAllTypeArguments(parametersTypeSignatures[i]);
        }
      }
    }

    // Store type signatures and arguments for method
    methodArguments = extractMethodArguments(method);
    if (hasMethodArguments()) ((InternalSearchPattern) this).mustResolve = true;
  }