Exemple #1
0
  public String toString() {
    Name name = name();

    if (kind() == null) {
      return "<unknown class " + name + typeParameterString() + ">";
    }

    if (kind() == ANONYMOUS) {
      if (interfaces != null && !interfaces.isEmpty()) {
        return isFunction()
            ? "" + interfaces.get(0)
            : "<anonymous subtype of " + interfaces.get(0) + typeParameters() + ">";
      }
      if (superType != null) {
        return "<anonymous subclass of " + superType + ">" + typeParameterString();
      }
    }

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return (p != null ? p.toString() + "." : "") + name + typeParameterString();
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return (outer != null ? outer.toString() + "." : "") + name + typeParameterString();
    } else {
      return name.toString() + typeParameterString();
    }
  }
Exemple #2
0
 private static void addTypeToWorkList(ArrayList<ClassDef> worklist, Ref<? extends Type> ref) {
   Type sup = Types.get(ref);
   sup = Types.baseType(sup);
   // can be a parameter type
   if (sup instanceof ParameterType) return;
   if (!(sup instanceof X10ParsedClassType)) assert sup instanceof X10ParsedClassType;
   worklist.add(((X10ParsedClassType) sup).def());
 }
Exemple #3
0
  /** Get the full name of the class, if possible. */
  public QName fullName() {
    Name name = name();

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return QName.make(p != null ? p.fullName() : null, name);
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return QName.make(outer != null ? outer.fullName() : null, name);
    } else if (kind() == LOCAL) {
      return QName.make(null, name);
    } else if (kind() == ANONYMOUS) {
      return QName.make(null, Name.make("<anonymous class>"));
    } else {
      return QName.make(null, Name.make("<unknown class>"));
    }
  }