< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java

Print this page

512 
513         Set<String> modifiers = flags.getMethodModifiers();
514 
515         String name = getName(m);
516         if (classFile.isInterface() &&
517                 (!flags.is(AccessFlags.ACC_ABSTRACT)) && !name.equals("<clinit>")) {
518             if (classFile.major_version > DEFAULT_ALLOWED_MAJOR_VERSION ||
519                     (classFile.major_version == DEFAULT_ALLOWED_MAJOR_VERSION && classFile.minor_version >= DEFAULT_ALLOWED_MINOR_VERSION)) {
520                 if (!flags.is(AccessFlags.ACC_STATIC | AccessFlags.ACC_PRIVATE)) {
521                     modifiers.add("default");
522                 }
523             }
524         }
525 
526         writeModifiers(modifiers);
527         if (methodType != null) {
528             print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes));
529         }
530         switch (name) {
531             case "<init>":





532                 print(getJavaName(classFile));
533                 print(getJavaParameterTypes(d, flags));
534                 break;
535             case "<clinit>":
536                 print("{}");
537                 break;
538             default:
539                 print(getJavaReturnType(d));
540                 print(" ");
541                 print(name);
542                 print(getJavaParameterTypes(d, flags));
543                 break;
544         }
545 
546         Attribute e_attr = m.attributes.get(Attribute.Exceptions);
547         if (e_attr != null) { // if there are generic exceptions, there must be erased exceptions
548             if (e_attr instanceof Exceptions_attribute) {
549                 Exceptions_attribute exceptions = (Exceptions_attribute) e_attr;
550                 print(" throws ");
551                 if (methodExceptions != null) { // use generic list if available

512 
513         Set<String> modifiers = flags.getMethodModifiers();
514 
515         String name = getName(m);
516         if (classFile.isInterface() &&
517                 (!flags.is(AccessFlags.ACC_ABSTRACT)) && !name.equals("<clinit>")) {
518             if (classFile.major_version > DEFAULT_ALLOWED_MAJOR_VERSION ||
519                     (classFile.major_version == DEFAULT_ALLOWED_MAJOR_VERSION && classFile.minor_version >= DEFAULT_ALLOWED_MINOR_VERSION)) {
520                 if (!flags.is(AccessFlags.ACC_STATIC | AccessFlags.ACC_PRIVATE)) {
521                     modifiers.add("default");
522                 }
523             }
524         }
525 
526         writeModifiers(modifiers);
527         if (methodType != null) {
528             print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes));
529         }
530         switch (name) {
531             case "<init>":
532                 String returnType = getJavaReturnType(d);
533                 if (!returnType.equals("void")) { // static factories for primitive classes
534                     print(returnType);
535                     print(" ");
536                 }
537                 print(getJavaName(classFile));
538                 print(getJavaParameterTypes(d, flags));
539                 break;
540             case "<clinit>":
541                 print("{}");
542                 break;
543             default:
544                 print(getJavaReturnType(d));
545                 print(" ");
546                 print(name);
547                 print(getJavaParameterTypes(d, flags));
548                 break;
549         }
550 
551         Attribute e_attr = m.attributes.get(Attribute.Exceptions);
552         if (e_attr != null) { // if there are generic exceptions, there must be erased exceptions
553             if (e_attr instanceof Exceptions_attribute) {
554                 Exceptions_attribute exceptions = (Exceptions_attribute) e_attr;
555                 print(" throws ");
556                 if (methodExceptions != null) { // use generic list if available
< prev index next >