Create a string with the result of an expression and the expression that originated the value. Is it
- by Oscar Reyes
Like
String r = SomeThing.toExecString("new Object().toString()");
And when executed the value of r would be:
"new Object().toString() = java.lang.Object@c5e3974"
Is this even possible at all? Would it need a bunch of reflection? A built in compiler maybe?
AFAIK, this is not possible with regular Java.
The closest thing I could get is IDE support like in IDEA with the "macro" soutv+tab that prints:
Hit taband type the expression
The IDE types the rest for you.
But that's quite another completely thing.