问题
I got an exception with a stack trace containing the following line
my.company.Service$$$view26.myMethod(Unknown Source)
Can anybody help me to understand what the $$$view part means?
We are using JBoss EAP 6.4 and Java 8.
回答1:
A dollar sign ($
, one or multiple) means that it is a generated class.
CDI (Weld 1.x in case of EAP 6.4 you are using) is one of the 'frameworks' which uses this pattern. It creates proxies based on your classes in order to allow for interception decoration and bean injection. All generated classes will have the same package name and class name and will be appended by the magical dollar affixes. My guess is that you came across it with some CDI functionality.
Also some of the JBoss logging frameworks (probably used in either Weld or other EAP part) allowed to create an automated logger classes based on annotations. The creation of these loggers was also based on adding the $
affix to class name.
It is a common practice and allows to 'easily' (not really easy though) identify generated classes. Although I cannot dig up any official requirement that generated classes should have this.
来源:https://stackoverflow.com/questions/39828803/what-is-the-meaning-of-view-in-java-log-file