< prev index next >

src/java.base/share/classes/jdk/internal/classfile/impl/ClassPrinterImpl.java

Print this page

 905                         var bmNode = new MapNodeImpl(FLOW, "bm");
 906                         bmNode.with(leafs(
 907                                 "index", bm.bsmIndex(),
 908                                 "kind", DirectMethodHandleDesc.Kind.valueOf(mh.kind(),
 909                                         mref instanceof InterfaceMethodRefEntry).name(),
 910                                 "owner", mref.owner().asInternalName(),
 911                                 "name", mref.nameAndType().name().stringValue()));
 912                         bmNode.with(list("args", "arg", bm.arguments().stream().map(LoadableConstantEntry::constantValue)));
 913                         return bmNode;
 914                     })));
 915                 case ConstantValueAttribute cva ->
 916                     nodes.add(leaf("constant value", cva.constant().constantValue()));
 917                 case NestHostAttribute nha ->
 918                     nodes.add(leaf("nest host", nha.nestHost().name().stringValue()));
 919                 case NestMembersAttribute nma ->
 920                     nodes.add(list("nest members", "member", nma.nestMembers().stream()
 921                             .map(mp -> mp.name().stringValue())));
 922                 case PermittedSubclassesAttribute psa ->
 923                     nodes.add(list("permitted subclasses", "subclass", psa.permittedSubclasses().stream()
 924                             .map(e -> e.name().stringValue())));



 925                 default -> {}
 926             }
 927             if (verbosity == Verbosity.TRACE_ALL) switch (attr) {
 928                 case EnclosingMethodAttribute ema ->
 929                     nodes.add(map("enclosing method",
 930                             "class", ema.enclosingClass().name().stringValue(),
 931                             "method name", ema.enclosingMethodName()
 932                                     .map(Utf8Entry::stringValue).orElse("null"),
 933                             "method type", ema.enclosingMethodType()
 934                                     .map(Utf8Entry::stringValue).orElse("null")));
 935                 case ExceptionsAttribute exa ->
 936                     nodes.add(list("exceptions", "exc", exa.exceptions().stream()
 937                             .map(e -> e.name().stringValue())));
 938                 case InnerClassesAttribute ica ->
 939                     nodes.add(new ListNodeImpl(BLOCK, "inner classes", ica.classes().stream()
 940                             .map(ic -> new MapNodeImpl(FLOW, "cls").with(
 941                                 leaf("inner class", ic.innerClass().name().stringValue()),
 942                                 leaf("outer class", ic.outerClass()
 943                                         .map(cle -> cle.name().stringValue()).orElse("null")),
 944                                 leaf("inner name", ic.innerName().map(Utf8Entry::stringValue).orElse("null")),

 905                         var bmNode = new MapNodeImpl(FLOW, "bm");
 906                         bmNode.with(leafs(
 907                                 "index", bm.bsmIndex(),
 908                                 "kind", DirectMethodHandleDesc.Kind.valueOf(mh.kind(),
 909                                         mref instanceof InterfaceMethodRefEntry).name(),
 910                                 "owner", mref.owner().asInternalName(),
 911                                 "name", mref.nameAndType().name().stringValue()));
 912                         bmNode.with(list("args", "arg", bm.arguments().stream().map(LoadableConstantEntry::constantValue)));
 913                         return bmNode;
 914                     })));
 915                 case ConstantValueAttribute cva ->
 916                     nodes.add(leaf("constant value", cva.constant().constantValue()));
 917                 case NestHostAttribute nha ->
 918                     nodes.add(leaf("nest host", nha.nestHost().name().stringValue()));
 919                 case NestMembersAttribute nma ->
 920                     nodes.add(list("nest members", "member", nma.nestMembers().stream()
 921                             .map(mp -> mp.name().stringValue())));
 922                 case PermittedSubclassesAttribute psa ->
 923                     nodes.add(list("permitted subclasses", "subclass", psa.permittedSubclasses().stream()
 924                             .map(e -> e.name().stringValue())));
 925                 case LoadableDescriptorsAttribute pa ->
 926                     nodes.add(list("loadable descriptors", "descriptor", pa.loadableDescriptors().stream()
 927                             .map(e -> e.stringValue())));
 928                 default -> {}
 929             }
 930             if (verbosity == Verbosity.TRACE_ALL) switch (attr) {
 931                 case EnclosingMethodAttribute ema ->
 932                     nodes.add(map("enclosing method",
 933                             "class", ema.enclosingClass().name().stringValue(),
 934                             "method name", ema.enclosingMethodName()
 935                                     .map(Utf8Entry::stringValue).orElse("null"),
 936                             "method type", ema.enclosingMethodType()
 937                                     .map(Utf8Entry::stringValue).orElse("null")));
 938                 case ExceptionsAttribute exa ->
 939                     nodes.add(list("exceptions", "exc", exa.exceptions().stream()
 940                             .map(e -> e.name().stringValue())));
 941                 case InnerClassesAttribute ica ->
 942                     nodes.add(new ListNodeImpl(BLOCK, "inner classes", ica.classes().stream()
 943                             .map(ic -> new MapNodeImpl(FLOW, "cls").with(
 944                                 leaf("inner class", ic.innerClass().name().stringValue()),
 945                                 leaf("outer class", ic.outerClass()
 946                                         .map(cle -> cle.name().stringValue()).orElse("null")),
 947                                 leaf("inner name", ic.innerName().map(Utf8Entry::stringValue).orElse("null")),
< prev index next >