Is there a library that implements the Debug / ins...
# getting-started
r
Is there a library that implements the Debug / inspect functionality similar to the Rust
inspect
? Where you get a full dump of a class, not just the
toString
k
You could use
Json.serializeToString
from the kotlinx.serialization library. If you don't want to use that, there's
ToStringBuilder
+
RecursiveToStringStyle
from Apache commons.
m
You can implement a simple compiler plugin that calls
IrModuleFragment.dump()
on any class/file which should give you the full dump of the file, see: https://blog.bnorm.dev/writing-your-second-compiler-plugin-part-2 for a reference
r
That's a neat way to go about it ^^, is that compiler plugin available as library?
Probably requires some additional smithing to be cool to use.
d
There is no IR in runtime, so plugin approach won't work. Some kind of serialisation is a good solution
👍 1
m
Thanks for clarifying, I missed that.