/*
   * Returns true if the constructor is directly involved in a cycle.
   * Given most constructors aren't, we only allocate the visited list
   * lazily.
   */
  public boolean isRecursive(ArrayList visited) {
    if (this.binding == null
        || this.constructorCall == null
        || this.constructorCall.binding == null
        || this.constructorCall.isSuperAccess()
        || !this.constructorCall.binding.isValidBinding()) {
      return false;
    }

    ConstructorDeclaration targetConstructor =
        ((ConstructorDeclaration)
            this.scope.referenceType().declarationOf(this.constructorCall.binding.original()));
    if (this == targetConstructor) return true; // direct case

    if (visited == null) { // lazy allocation
      visited = new ArrayList(1);
    } else {
      int index = visited.indexOf(this);
      if (index >= 0) return index == 0; // only blame if directly part of the cycle
    }
    visited.add(this);

    return targetConstructor.isRecursive(visited);
  }