Unused class and unused private method

Answered

Hi,

I have a public Java class that is used via reflection and IntelliJ 2016.1 rightly reports it as unused declaration. I can annotate the class with @SuppressWarnings("unused") but I noticed that this also silences warning about unused private method inside this class. I do not want to add this class as entry point as there are many classes like this. Is there any other option besides adding a main method?

Kind regards, Jan

0
3 comments

See https://youtrack.jetbrains.com/issue/IDEA-94178 which is a duplicate of https://youtrack.jetbrains.com/issue/IDEA-55769. Feel free to vote. There is no solution right now.

0

Thanks Serge. In the meanwhile I checked the Unused declaration inspection, On the fly editor setting and checked off the Check Classes. It seems to work fine, no warning on unused class but warning on unused private method. However I am not sure what the "one the fly" setting really changes, does it mean it will (not) warn me as I type but will warn me when I run "Inspect Code"? But with not checked Check Classes even with "Inspect Code" there is no warning on class.

Kind regards, Jan

0

Now its clear, the "on the fly editor editor settings" means "show the warning in editor (right stripe)", it won't go away from inspection results.

 

Kind regards, Jan

0

Please sign in to leave a comment.