Menu

#52 Detect CDI scopes as used code

Difficult
open
nobody
None
1
2021-06-22
2021-06-21
No

In JakartaEE environments it is quite normal to have beans that are instantiated by the container, e.g. @ApplicationScoped beans. When a bean has scope "@ApplicationScope" or has some other CDI annotation on it that binds it to the container, e.g. @Observes, etc. UCDetector should not flag those classes and methods as unused, as they are instantiated by the container.

I single out Jakarta CDI specifically as it is an industry standard and widely used. Perhaps you could add an editable list of annotations that mark a class as used, as to support Spring and other injection frameworks.

Discussion

  • Joerg Spieler

    Joerg Spieler - 2021-06-21

    Use UCDetector Preferences: "Ignore -> Code with annotations"
    See: http://ucdetector.org/preferences.html

     
    👍
    1
  • Martijn Dashorst

    Found it! Thanks!

     

Anonymous
Anonymous

Add attachments
Cancel