What does $$ and means in java stacktrace?

后端 未结 1 594
一向
一向 2021-02-07 02:35

Many times I get stacktraces like this one (please see the arrow for the confusing line):

org.springframework.dao.DataIntegrityViolationException: could not exec         


        
相关标签:
1条回答
  • 2021-02-07 03:24

    $ is an allowed character in class names.

    The name SimpleDetectorPersistenceService$$EnhancerBySpringCGLIB$$66303639 hints that it is a class which was dynamically generated at runtime by Spring framework using CGLIB.

    They use $$ and a numeric offset to make this class name unique to avoid conflicts with existing classes.

    The string (<generated>) in the stracktrace too was generated by CGLIB:
    When CGLIB creates a class at runtime it uses <generated> as placeholder for the name of the source file. The stacktrace then simply prints this string instead of the real source file and line number.

    0 讨论(0)
提交回复
热议问题