コード例 #1
0
 @Override
 public String format(JCDiagnostic diag, Locale l) {
   StringBuilder sb = new StringBuilder();
   nameSimplifier = new ClassNameSimplifier();
   for (WhereClauseKind kind : WhereClauseKind.values()) whereClauses.get(kind).clear();
   preprocessDiagnostic(diag);
   sb.append(formatter.format(diag, l));
   if (getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
     List<JCDiagnostic> clauses = getWhereClauses();
     String indent = formatter.isRaw() ? "" : formatter.indentString(DetailsInc);
     for (JCDiagnostic d : clauses) {
       String whereClause = formatter.format(d, l);
       if (whereClause.length() > 0) {
         sb.append('\n' + indent + whereClause);
       }
     }
   }
   return sb.toString();
 }
コード例 #2
0
 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;
 }