Community
Participate
Working Groups
[Follow up of bug#283031 comment#16] Eclipse Version: 3.6.0, Build id: I20091030-1201. The following code produces an incorrect unused method warning: public class EclipseBug { private static class A { public void foo() {} // <-- gets flagged } public static class B extends A {} } while the message is "technically" correct i.e foo is never used "locally", one of the quick fix provided viz, "Remove method foo" could lead to build errors if method foo was used elsewhere.
Created attachment 153560 [details] Proposed patch
(In reply to comment #0) > while the message is "technically" correct i.e foo is never used "locally", > one of the quick fix provided viz, "Remove method foo" could lead to build > errors if method foo was used elsewhere. Huh? The "unused locally" warning means what it says -and- that the element in question is not visible outside. Otherwise you would have to flag all public methods of any class as "unused locally", unless they are used by the class itself. So this is not a bug just because of the quick fix.
(In reply to comment #2) > (In reply to comment #0) > > while the message is "technically" correct i.e foo is never used "locally", > > one of the quick fix provided viz, "Remove method foo" could lead to build > > errors if method foo was used elsewhere. > Huh? The "unused locally" warning means what it says -and- that the element in > question is not visible outside. Otherwise you would have to flag all public > methods of any class as "unused locally", unless they are used by the class > itself. So this is not a bug just because of the quick fix. Yes, I was not suggesting this is a bug only because of the offered quick fix. The quick fix was mentioned because, whenever something is flagged as unused, you should be able to delete it without any deleterious effect and that is not guaranteed in this case. As for the first part, it is perhaps splitting hairs on my part, I was merely pointing out that the message literally is not incorrect. When viewed in the larger context of this diagnotic being useful however, it needs fixing and hence this bug.
Released in HEAD for 3.6M4
Verified for 3.6M4 using build I20091207-1800