Description
It may come in handy to provide an option to automatically hide stack trace elements originating from generated classes.
For instance:
org.sample.SampleException: Unable to process request
at org.sample.MyController.create(MyControllerController.java:41)
at org.sample.MyController$$FastClassBySpringCGLIB$$340ae8ef.invoke(<generated>)
...
In this example, MyController$$FastClassBySpringCGLIB$$..
is a CGLIB class generated by Spring at runtime. It gives no additional value to report it in the stacktrace and users may want to remove/hide it to increase visibility.
The converter already allows to exclude elements matching a regex pattern. However a stack element is removed only if it is followed (or preceded) by at least one another excluded item. Also, the excluded items are replaced by a single line reporting the number of exclusions ("... 12 frames excluded").
Here we simply want to silently HIDE elements originating from generated classes so the exclusion
is not applicable. This feature could leverage the existing StackElementFilter.withSourceInfo()
filter and would be enabled using a simple flag as follows:
<filterGeneratedClasses>true</filterGeneratedClasses>
Note: how do we detect generated classes?
Is it enough to say that a class is generated if the filename and the line number are unknown? What if the code is compiled without debugging information?