mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8345773: Class-File API debug printing capability
Reviewed-by: liach, mcimadamore
This commit is contained in:
parent
e88e793cfd
commit
f88c1c6ff8
2 changed files with 15 additions and 4 deletions
|
@ -34,6 +34,8 @@ import java.util.function.Consumer;
|
|||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import jdk.internal.classfile.components.ClassPrinter;
|
||||
|
||||
/**
|
||||
* A {@link ClassFileElement} that has complex structure defined in terms of
|
||||
* other classfile elements, such as a method, field, method body, or entire
|
||||
|
@ -92,4 +94,14 @@ public sealed interface CompoundElement<E extends ClassFileElement>
|
|||
return Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return a text representation of the compound element and its contents for debugging purposes}
|
||||
*
|
||||
* The format, structure and exact contents of the returned string are not specified and may change at any time in the future.
|
||||
*/
|
||||
default String toDebugString() {
|
||||
StringBuilder text = new StringBuilder();
|
||||
ClassPrinter.toYaml(this, ClassPrinter.Verbosity.TRACE_ALL, text::append);
|
||||
return text.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue