Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Unused public method?
Unused public method? [message #63270] Fri, 20 June 2003 12:30 Go to next message
Eclipse UserFriend
Does it make sense to have a feature request to warn developer about unused
public method in a class?
In the compiler option, it can warn users about unused private methods. I am
wonder if it make sense to have a feature to warn about unused public
method. I think unused public method is more tricky than unused private
method.
Re: Unused public method? [message #63386 is a reply to message #63270] Fri, 20 June 2003 14:39 Go to previous messageGo to next message
Eclipse UserFriend
What about a framework?
There are many unused methods. What about abstract classes? Seems not
very useful | hard to implement.

martin
Re: Unused public method? [message #63428 is a reply to message #63270] Fri, 20 June 2003 14:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: linnet.nospam.users.sourceforge.net

yinglcs wrote:

> Does it make sense to have a feature request to warn developer about unused
> public method in a class?
> In the compiler option, it can warn users about unused private methods. I am
> wonder if it make sense to have a feature to warn about unused public
> method. I think unused public method is more tricky than unused private
> method.
>
>
>
It's quite hard to determine what is really not used if it's not
private. Imagine, for example, that you have some other project calling
a public method. If you close this project, the public method appears
not to be called, which is of course not true.

Best regards,

Jesper
Re: Unused public method? [message #64145 is a reply to message #63270] Sat, 21 June 2003 19:37 Go to previous messageGo to next message
Eclipse UserFriend
yinglcs wrote:

> Does it make sense to have a feature request to warn developer about unused
> public method in a class?
> In the compiler option, it can warn users about unused private methods. I am
> wonder if it make sense to have a feature to warn about unused public
> method. I think unused public method is more tricky than unused private
> method.

Go get the plugin JQuery
(http://www.cs.ubc.ca/labs/spl/projects/jquery/index.htm)
It will do this and much more. It's a complete java source query engine so
you can define your own queries and add them to JQuery's menu (even on a
per-project basis).
The tutorial actually has the query close to what you are looking for
"Methods NOT called from elsewhere" which will show you all methods in a
package not called. It could easily be expanded to only show public
methods as well as well as make it applicable per class.
It's an amazing piece of work.
However, as the others said, this functionality is limited to a project at
a time probably for those reasons mentioned.

John
Re: Unused public method? [message #65188 is a reply to message #64145] Mon, 23 June 2003 12:33 Go to previous messageGo to next message
Eclipse UserFriend
"insurgent" <insurgent@insurgent.us> wrote:
> yinglcs wrote:

> > Does it make sense to have a feature request to warn developer about
unused
> > public method in a class?

Yes. RefactorIt does this.

> Go get the plugin JQuery
> (http://www.cs.ubc.ca/labs/spl/projects/jquery/index.htm)
> It will do this and much more. It's a complete java source query engine so
> you can define your own queries and add them to JQuery's menu (even on a
> per-project basis).
> The tutorial actually has the query close to what you are looking for
> "Methods NOT called from elsewhere" which will show you all methods in a
> package not called. It could easily be expanded to only show public
> methods as well as well as make it applicable per class.

This is the tutorial at:

http://www.cs.ubc.ca/labs/spl/projects/jquery/tutorial.htm

....?

I can't seem to see the example you are referring to.

It /seems/ to list methods that are called - not those which are not.
--
__________
|im |yler http://timtyler.org/ tim@tt1.org
Re: Unused public method? [message #65486 is a reply to message #65188] Mon, 23 June 2003 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Yea, looks like the tutorial page is incomplete. If you look in the
actualy file for the tutorial.rub in the distro at
%PATH%\plugins\ca.ubc.jquery\rules you'll see a few rules defined not
mentioned on the page ("Methods called from elsewhere" and "Methods NOT
called from elsewhere".
The rule as defined will only show up for package but if you change the
":- package(?P)." to ":- package(?X) ; class(?X)." (; is "or" in prolog)
You should also be able to modify the rule with "modifier(?M,public)" so
it only shows public methods not called from elsewhere.

Also, I got an email back from one of the authors and he says the new
version will be able to do queries on *working sets*!

Take care,

John

Tim Tyler wrote:

> "insurgent" <insurgent@insurgent.us> wrote:
> > yinglcs wrote:

> > > Does it make sense to have a feature request to warn developer about
> unused
> > > public method in a class?

> Yes. RefactorIt does this.

> > Go get the plugin JQuery
> > (http://www.cs.ubc.ca/labs/spl/projects/jquery/index.htm)
> > It will do this and much more. It's a complete java source query engine so
> > you can define your own queries and add them to JQuery's menu (even on a
> > per-project basis).
> > The tutorial actually has the query close to what you are looking for
> > "Methods NOT called from elsewhere" which will show you all methods in a
> > package not called. It could easily be expanded to only show public
> > methods as well as well as make it applicable per class.

> This is the tutorial at:

> http://www.cs.ubc.ca/labs/spl/projects/jquery/tutorial.htm

> ....?

> I can't seem to see the example you are referring to.

> It /seems/ to list methods that are called - not those which are not.
> --
> __________
> |im |yler http://timtyler.org/ tim@tt1.org
Re: Unused public method? [message #66115 is a reply to message #65486] Tue, 24 June 2003 08:17 Go to previous message
Eclipse UserFriend
"insurent" <insurgent@insurgent.us> wrote:

> Yea, looks like the tutorial page is incomplete. If you look in the
> actualy file for the tutorial.rub in the distro at
> %PATH%\plugins\ca.ubc.jquery\rules you'll see a few rules defined not
> mentioned on the page ("Methods called from elsewhere" and "Methods NOT
> called from elsewhere".

I can see the rule - in the "tutorial.rub" file there.

If I try and load that file from the menu I get errors.

Also, my attempts to execute the query have been thwarted by "paste"
being disabled in the query textbox.

The only way I can enter queries seems to be by typing them in by hand :-(

This tool may offer potentially interesting functionality.

However, currently the user interface doesn't seem to conveniently
expose very much of it :-|
--
__________
|im |yler http://timtyler.org/ tim@tt1.org
Previous Topic:Code Formatting Feature? Disabling code wrapping
Next Topic:Organize imports filter
Goto Forum:
  


Current Time: Sat May 10 14:36:55 EDT 2025

Powered by FUDForum. Page generated in 0.03763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top