Can Idea ingore variables

Most applications put some sort of static final variable in each class to denote version number or copyright info. This is usually used to identify compiled code as your own. The second scenerio is where you use VC tags to populate the version number of the class. It is usually soemthing like

public static final String id = "$id:";

or

public static final String copyright = "Copyright 2003 MyCompany";

Ok here is the question. Is there a way to get idea to ignore these variables in the code inspection? It constantly marks these as un-used, which is correct but I don't care about these particular ones.

tia,
charles

4 comments
Comment actions Permalink

Not a clean solution but...

You may add them as entry points so unused code inspection wouldn't bother
you anymore. Though every such variable should be separately added to entry
points and there's no yet any way to add them all simultaneously.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"charles decroes" <spam@decroes.com> wrote in message
news:5145092.1041522549569.JavaMail.jrun@is.intellij.net...

Most applications put some sort of static final variable in each class to

denote version number or copyright info. This is usually used to identify
compiled code as your own. The second scenerio is where you use VC tags to
populate the version number of the class. It is usually soemthing like
>

public static final String id = "$id:";

>

or

>

public static final String copyright = "Copyright 2003 MyCompany";

>

Ok here is the question. Is there a way to get idea to ignore these

variables in the code inspection? It constantly marks these as un-used,
which is correct but I don't care about these particular ones.
>

tia,
charles



0
Comment actions Permalink

My usual solution to this sort of thing is to create a test case which checks the values of the variables. Just a bunch of lines that look like

After all, if the variables are worth putting in, they are worth validating, and it keeps them from being unused.

--Dave

0
Comment actions Permalink

good point, and good idea.

thanks

0
Comment actions Permalink

Code inspection has been of limited use to me. The main reason is that in
my project every class has a public static method which is provided for
use as an external entry point (ala main()). So, the code inspection spends
a lot of cycles searching for calls to this method.

I saw your post and I thought I had found salvation. I added the method in
question as an entry point and sure enough it is now longer reported as
unreachable code. Unfortunately, IDEA still chews (what appears to be)
the same amount of cycles looking for calls to this method that I have
specified as an entry point. (The project as ~2500 .java files in it, so I
notice this.)

Is there something I can do to prevent IDEA for looking for calls to a
method that I've marked as an entry point?

Kendall

"Maxim Shafirov" <max@intellij.net> wrote in message
news:av1o42$ce3$1@is.intellij.net...

Not a clean solution but...

>

You may add them as entry points so unused code inspection wouldn't bother
you anymore. Though every such variable should be separately added to

entry

points and there's no yet any way to add them all simultaneously.

>

--

>

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"

>
>

"charles decroes" <spam@decroes.com> wrote in message
news:5145092.1041522549569.JavaMail.jrun@is.intellij.net...

Most applications put some sort of static final variable in each class

to

denote version number or copyright info. This is usually used to identify
compiled code as your own. The second scenerio is where you use VC tags

to

populate the version number of the class. It is usually soemthing like
>

public static final String id = "$id:";

>

or

>

public static final String copyright = "Copyright 2003 MyCompany";

>

Ok here is the question. Is there a way to get idea to ignore these

variables in the code inspection? It constantly marks these as un-used,
which is correct but I don't care about these particular ones.
>

tia,
charles

>
>


0

Please sign in to leave a comment.