< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java

Print this page




 301         if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
 302             StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
 303             for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
 304                 s.append('&');
 305                 s.append(visit(is.head, locale));
 306             }
 307             return s.toString();
 308         } else if (sym.name.length() == 0) {
 309             String s;
 310             ClassType norm = (ClassType) t.tsym.type;
 311             if (norm == null) {
 312                 s = localize(locale, "compiler.misc.anonymous.class", (Object) null);
 313             } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
 314                 s = localize(locale, "compiler.misc.anonymous.class",
 315                         visit(norm.interfaces_field.head, locale));
 316             } else {
 317                 s = localize(locale, "compiler.misc.anonymous.class",
 318                         visit(norm.supertype_field, locale));
 319             }
 320             return s;
 321         } else if (longform) {
 322             return sym.getQualifiedName().toString();


 323         } else {
 324             return sym.name.toString();
 325         }


 326     }
 327 
 328     /**
 329      * Converts a set of method argument types into their corresponding
 330      * localized string representation.
 331      *
 332      * @param args arguments to be rendered
 333      * @param varArgs if true, the last method argument is regarded as a vararg
 334      * @param locale the locale in which the string is to be rendered
 335      * @return localized string representation
 336      */
 337     protected String printMethodArgs(List<Type> args, boolean varArgs, Locale locale) {
 338         if (!varArgs) {
 339             return visitTypes(args, locale);
 340         } else {
 341             StringBuilder buf = new StringBuilder();
 342             while (args.tail.nonEmpty()) {
 343                 buf.append(visit(args.head, locale));
 344                 args = args.tail;
 345                 buf.append(',');




 301         if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
 302             StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
 303             for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
 304                 s.append('&');
 305                 s.append(visit(is.head, locale));
 306             }
 307             return s.toString();
 308         } else if (sym.name.length() == 0) {
 309             String s;
 310             ClassType norm = (ClassType) t.tsym.type;
 311             if (norm == null) {
 312                 s = localize(locale, "compiler.misc.anonymous.class", (Object) null);
 313             } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
 314                 s = localize(locale, "compiler.misc.anonymous.class",
 315                         visit(norm.interfaces_field.head, locale));
 316             } else {
 317                 s = localize(locale, "compiler.misc.anonymous.class",
 318                         visit(norm.supertype_field, locale));
 319             }
 320             return s;
 321         }
 322         String s;
 323         if (longform) {
 324              s =  sym.getQualifiedName().toString();
 325         } else {
 326             s =  sym.name.toString();
 327         }
 328 
 329         return sym.isProjectedNullable() ? s + '?' : s;
 330     }
 331 
 332     /**
 333      * Converts a set of method argument types into their corresponding
 334      * localized string representation.
 335      *
 336      * @param args arguments to be rendered
 337      * @param varArgs if true, the last method argument is regarded as a vararg
 338      * @param locale the locale in which the string is to be rendered
 339      * @return localized string representation
 340      */
 341     protected String printMethodArgs(List<Type> args, boolean varArgs, Locale locale) {
 342         if (!varArgs) {
 343             return visitTypes(args, locale);
 344         } else {
 345             StringBuilder buf = new StringBuilder();
 346             while (args.tail.nonEmpty()) {
 347                 buf.append(visit(args.head, locale));
 348                 args = args.tail;
 349                 buf.append(',');


< prev index next >