< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java

Print this page

371 
372         @Override
373         public String visitClassType(ClassType t, Locale locale) {
374             if (t.isCompound() &&
375                     getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
376                 return localize(locale,
377                         "compiler.misc.intersection.type",
378                         indexOf(t, WhereClauseKind.INTERSECTION));
379             }
380             else
381                 return super.visitClassType(t, locale);
382         }
383 
384         @Override
385         protected String className(ClassType t, boolean longform, Locale locale) {
386             Symbol sym = t.tsym;
387             if (sym.name.length() == 0 ||
388                     !getConfiguration().isEnabled(RichFormatterFeature.SIMPLE_NAMES)) {
389                 return super.className(t, longform, locale);
390             }
391             else if (longform)
392                 return nameSimplifier.simplify(sym).toString();

393             else
394                 return sym.name.toString();


395         }
396 
397         @Override
398         public String visitTypeVar(TypeVar t, Locale locale) {
399             if (unique(t) ||
400                     !getConfiguration().isEnabled(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES)) {
401                 return t.toString();
402             }
403             else {
404                 return localize(locale,
405                         "compiler.misc.type.var",
406                         t.toString(), indexOf(t, WhereClauseKind.TYPEVAR));
407             }
408         }
409 
410         @Override
411         public String visitClassSymbol(ClassSymbol s, Locale locale) {
412             if (s.type.isCompound()) {
413                 return visit(s.type, locale);
414             }

371 
372         @Override
373         public String visitClassType(ClassType t, Locale locale) {
374             if (t.isCompound() &&
375                     getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
376                 return localize(locale,
377                         "compiler.misc.intersection.type",
378                         indexOf(t, WhereClauseKind.INTERSECTION));
379             }
380             else
381                 return super.visitClassType(t, locale);
382         }
383 
384         @Override
385         protected String className(ClassType t, boolean longform, Locale locale) {
386             Symbol sym = t.tsym;
387             if (sym.name.length() == 0 ||
388                     !getConfiguration().isEnabled(RichFormatterFeature.SIMPLE_NAMES)) {
389                 return super.className(t, longform, locale);
390             }
391             String s;
392             if (longform)
393                 s =  nameSimplifier.simplify(sym).toString();
394             else
395                 s = sym.name.toString();
396 
397             return s;
398         }
399 
400         @Override
401         public String visitTypeVar(TypeVar t, Locale locale) {
402             if (unique(t) ||
403                     !getConfiguration().isEnabled(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES)) {
404                 return t.toString();
405             }
406             else {
407                 return localize(locale,
408                         "compiler.misc.type.var",
409                         t.toString(), indexOf(t, WhereClauseKind.TYPEVAR));
410             }
411         }
412 
413         @Override
414         public String visitClassSymbol(ClassSymbol s, Locale locale) {
415             if (s.type.isCompound()) {
416                 return visit(s.type, locale);
417             }
< prev index next >