< prev index next >

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

Print this page

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



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

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