Public methods reported unused

hi,

is there any plan to make an separate option in code analysis, that
reports public and protected methods as unused? because now i've got
every single piece of code reported with warnings because of unused
public setters in Java Beans, which a set via iBatis, protected setters,
set via reflection, enums. it is really annoying :( , and i don't think
i'm alone

3 comments
Comment actions Permalink

This option is already present. The "Unused declaration" inspection (Inspections | Declaration Redundancy | Unused declaration) sets options for the public, package and protected level methods & fields. In that inspection's settings, you can alter the severity level of the warning. Or you can add "entry points" to prevent the inspection from highlighting things in specific class. For example, if all your beans are in the same package, or have a particular naming convention, you could exclude them. Of course, you can just turn the inspection off as well.

The "unused symbol" inspection affects the settings for private methods and fields. Note that there is currently a bug (IDEA-27007) with changing the settings for Unused Symbols.

0
Comment actions Permalink

On 26.12.2009 23:15, Mark Vedder wrote:

This option is already present. The "Unused declaration" inspection (Inspections | Declaration Redundancy | Unused declaration) sets options for the public, package and protected level methods&  fields. In that inspection's settings, you can alter the severity level of the warning. Or you can add "entry points" to prevent the inspection from highlighting things in specific class. For example, if all your beans are in the same package, or have a particular naming convention, you could exclude them. Of course, you can just turn the inspection off as well.

>

The "unused symbol" inspection affects the settings for private methods and fields. Note that there is currently a bug (http://youtrack.jetbrains.net/issue/IDEA-27007) with changing the settings for Unused Symbols.

>

thanks, i didn't knew that unused private methods are still reported if
this inspection is turned off.

0
Comment actions Permalink

So far, it seems the only way to add an EntryPoint is to create an
adhoc annotation and add it to the exclusion list in the inspection
dialog.
Then one has to annotate all classes/methods with it. That includes all
Struts1/2 Action methods, all top level API interfaces and much more.

That's quite inconvenient IMHO, there's a lot more methods detected as
unused in the Maia than there were in Diana.

This used to be one of the most useful inspection, especially when
working on legacy code. It has become quite unsuable for me.

rgds
nodje

On 2009-12-27 07:15:04 +0800, Mark Vedder <no_reply@jetbrains.com> said:

This option is already present. The "Unused declaration" inspection
(Inspections | Declaration Redundancy | Unused declaration) sets
options for the public, package and protected level methods & fields.
In that inspection's settings, you can alter the severity level of the
warning. Or you can add "entry points" to prevent the inspection from
highlighting things in specific class. For example, if all your beans
are in the same package, or have a particular naming convention, you
could exclude them. Of course, you can just turn the inspection off as
well.

The "unused symbol" inspection affects the settings for private methods
and fields. Note that there is currently a bug
(http://youtrack.jetbrains.net/issue/IDEA-27007) with changing the
settings for Unused Symbols.

---
Original message URL: http://www.jetbrains.net/devnet/message/5253245#5253245



0

Please sign in to leave a comment.