コード例 #1
0
 @Override
 public String visitTypeVar(TypeVar t, Locale locale) {
   if (unique(t) || !getConfiguration().isEnabled(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES)) {
     return t.toString();
   } else {
     return localize(
         locale, "compiler.misc.type.var", t.toString(), indexOf(t, WhereClauseKind.TYPEVAR));
   }
 }
コード例 #2
0
 private boolean unique(TypeVar typevar) {
   int found = 0;
   for (Type t : whereClauses.get(WhereClauseKind.TYPEVAR).keySet()) {
     if (t.toString().equals(typevar.toString())) {
       found++;
     }
   }
   if (found < 1) throw new AssertionError("Missing type variable in where clause " + typevar);
   return found == 1;
 }