• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java compiler warning  RSS feed

 
bob reilly
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm reviewing some java code (not mine) which displays the following in eclipse: "The Method xxx(xx, xx) from the type xxx is never used locally". I'm a newbie - I checked the balance of the project as best I could - I did not see this method invoked at all.

Does this message indicated that it is not invoked at all?

If not - could you please provide an explanatioin. Thanking you in advance...
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the word "locally" is crucial. It means that in your current project the method is not used. You can test that by commenting it out, and rebuilding the complete project - it should compile fine. But if it's not a private method then it may be used by other code that uses this class. Not sure if that's applicable to your project, but think of a library - all of its public methods are probably not used by the library itself, but they're certainly used by applications that use that library. In that case it wouldn't be safe to remove the method, because it's part of the public API the library exposes.
 
bob reilly
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method is private - so I think your answer just about does it. BTW - I enjoyed viewing your website 2002 USA visit.

Thank you for your comments.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can remember, you only get that Eclipse warning for private members.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!