IntelliJ IDEA has a handy feature to detect unused methods and show them in grey, hinting a potential warning for dead code.
Some methods, however, are not executed directly but via reflection. A good example would be @RequestMapping
-annotated methods which are executed by Spring. IntelliJ has decent Spring integration hence it detects this annotation and does not mark such a method as unused.
I have a tiny AJAX framework where I use my own annotation to point which method to execute based on certain HTTP request properties (very similar to what @RequestMapping
is doing). Understandably, IntelliJ has no idea what does my annotation stand for and and marks such a method as unused, adding unnecessary noise.
I was thinking of:
Can anyone suggest any ideas how to solve this problem?
You can tell IntelliJ to not to warn about used for any method/field annotated with the annotation the "unused" method has.
It should be a quick fix all you have to do is hit <Alt>+<Enter> and select Suppress for methods annotated by ...
You don't need to add anything to you code and you only have to do this once per annotation.