コード例 #1
0
ファイル: Rule.java プロジェクト: damc-dev/byteman
  /**
   * type check this rule
   *
   * @throws TypeException if the ruele contains type errors
   */
  public void typeCheck() throws TypeException {
    String helperName = ruleScript.getTargetHelper();

    // ensure that we have a valid helper class
    if (helperName != null) {
      try {
        helperClass = loader.loadClass(helperName);
      } catch (ClassNotFoundException e) {
        throw new TypeException(
            "Rule.typecheck : unknown helper class " + helperName + " for rule " + getName());
      }
    } else {
      helperClass = Helper.class;
    }
    if (triggerExceptions != null) {
      // ensure that the type group includes the exception types
      typeGroup.addExceptionTypes(triggerExceptions);
    }

    // try to resolve all types in the type group to classes

    typeGroup.resolveTypes();

    // use the descriptor to derive the method argument types and type any bindings for them
    // that are located in the bindings list

    installParameters((triggerAccess & Opcodes.ACC_STATIC) != 0, triggerClass);

    event.typeCheck(Type.VOID);
    condition.typeCheck(Type.Z);
    action.typeCheck(Type.VOID);
  }