I had a similar situation in my own code earlier but it turned out IDEA was
doing the right thing. In your example you are assigning a value to count
but you are never using it. For it to be considered used you must, for
example, pass it as an arg to a method, or use it in a comparison or
calculation. Try the following:
public void test()
{
int count = 0; // count is unused
count = 7; // count is still unused
count = Integer.parseInt(System.getProperty("test")); // count is *still*
unused
int z = count; // count is now used, but z isn't!
}
It would be interesting if IDEA could figure out that since z is useless,
count is also useless! But I'm pretty happy with the way it is now; I would
probably start off by removing the line of code declaring z, then notice
that count turned a different color, and delete those as well (I'd then
delete the whole useless freakin method :)).
-Khaled.
----- Original Message -----
From: "Marc Wirth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 08, 2002 2:32 AM
Subject: [Eap-list] 602 Wrong detection of unused variable
> Hi all,
>
> using the following example:
>
> public static void test()
> {
> int count = 0;
> try {
> count = Integer.parseInt(System.getProperty("test"));
> } catch (NumberFormatException e) {
> }
> count = 2;
> }
>
> The definition of "count" in the third line is marked as unused (yellow
indicator on the right, colored as "unused symbol").
>
> Regards,
> Marc Wirth
>
>
>
>
> _______________________________________________
> Eap-list mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-list
>
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list