Ejemplo n.º 1
0
  private boolean isTransformed(Class clazz, String name, boolean isInterface) {
    if (isBytemanClass(name) || !isTransformable(name)) {
      return false;
    }

    boolean found = false;
    List<RuleScript> scripts;
    if (isInterface) {
      scripts = scriptRepository.scriptsForInterfaceName(name);
    } else {
      scripts = scriptRepository.scriptsForClassName(name);
    }
    if (scripts != null) {
      for (RuleScript script : scripts) {
        if (!script.hasTransform(clazz)) {
          found = true;
          if (isVerbose()) {
            System.out.println("Retransforming loaded bootstrap class " + clazz.getName());
          }
          break;
        }
      }
    }

    return found;
  }
Ejemplo n.º 2
0
  /**
   * check whether a class should not be considered for transformation
   *
   * @param clazz the class to check
   * @return true if clazz should not be considered for transformation otherwise false
   */
  protected boolean isSkipClass(Class<?> clazz) {
    if (!inst.isModifiableClass(clazz)) {
      return true;
    }

    // we can safely skip array classes, interfaces and primitive classes

    if (clazz.isArray()) {
      return true;
    }

    if (clazz.isInterface()) {
      return true;
    }

    if (clazz.isPrimitive()) {
      return true;
    }

    String name = clazz.getName();

    if (isBytemanClass(name) || !isTransformable(name)) {
      return true;
    }

    return false;
  }