/**
  * Build a list of multiline diagnostics containing detailed info about type-variables, captured
  * types, and intersection types
  *
  * @return where clause list
  */
 protected List<JCDiagnostic> getWhereClauses() {
   List<JCDiagnostic> clauses = List.nil();
   for (WhereClauseKind kind : WhereClauseKind.values()) {
     List<JCDiagnostic> lines = List.nil();
     for (Map.Entry<Type, JCDiagnostic> entry : whereClauses.get(kind).entrySet()) {
       lines = lines.prepend(entry.getValue());
     }
     if (!lines.isEmpty()) {
       String key = kind.key();
       if (lines.size() > 1) key += ".1";
       JCDiagnostic d = diags.fragment(key, whereClauses.get(kind).keySet());
       d = new JCDiagnostic.MultilineDiagnostic(d, lines.reverse());
       clauses = clauses.prepend(d);
     }
   }
   return clauses.reverse();
 }
 public String simplify(Symbol s) {
   String name = s.getQualifiedName().toString();
   if (!s.type.isCompound()) {
     List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
     if (conflicts == null || (conflicts.size() == 1 && conflicts.contains(s))) {
       List<Name> l = List.nil();
       Symbol s2 = s;
       while (s2.type.getEnclosingType().tag == CLASS && s2.owner.kind == Kinds.TYP) {
         l = l.prepend(s2.getSimpleName());
         s2 = s2.owner;
       }
       l = l.prepend(s2.getSimpleName());
       StringBuilder buf = new StringBuilder();
       String sep = "";
       for (Name n2 : l) {
         buf.append(sep);
         buf.append(n2);
         sep = ".";
       }
       name = buf.toString();
     }
   }
   return name;
 }
 @Override
 public Void visitClassType(ClassType t, Void ignored) {
   if (t.isCompound()) {
     if (indexOf(t, WhereClauseKind.INTERSECTION) == -1) {
       Type supertype = types.supertype(t);
       List<Type> interfaces = types.interfaces(t);
       JCDiagnostic d =
           diags.fragment("where.intersection", t, interfaces.prepend(supertype));
       whereClauses.get(WhereClauseKind.INTERSECTION).put(t, d);
       visit(supertype);
       visit(interfaces);
     }
   }
   nameSimplifier.addUsage(t.tsym);
   visit(t.getTypeArguments());
   if (t.getEnclosingType() != Type.noType) visit(t.getEnclosingType());
   return null;
 }