Given a Scope, is there a function that can generate a unique variable name such that a variable declaration for the unique name could be inserted in scope and the resulting source code/CompilationUnitTree would still compile?
Is there a way to generate a unique variable name in a given scope?
1.2k views Asked by Daniel Trebbien At
1
I ended up writing my own utility function:
This was tested with the following test source file:
where
MyEnumis declared as:The scope in question is the scope of the method invocation statement
LOGGER.debug(STR1);within the catch block. Result:"sb4".