Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - how can I determine the number of methods in a Java application

Tags:

java

eclipse

I'm trying to do something weird, I'm trying to determine how many methods has my Java application.

This weird thing has a purpose, it is because I have to improve the logging in the application, and it will require to make a revision of every method and add the logging if it is missing, update the logging if it already has.

I'm in the estimation process, so knowing how many methods has the application will help me to provide a high level estimation with a reasonable basis for this.

Then, here is the question, is there any way to know how many methods has my Java application?

Thanks in advance.

Fer

PS: I'm using Eclipse

like image 567
Fernando Moyano Avatar asked Dec 19 '11 16:12

Fernando Moyano


People also ask

How do I list all methods in Eclipse?

You can open any method or type in your workspace using the "Open Type" wizard or the "Open Method" wizard. -Or- press Ctrl+Shift+T (for a type) or Ctrl+Shift+M (for a method). The "Open Type/Method" dialog will appear. If a type/method was previously selected in the editor or outline views, it will be displayed.

How many methods should a Java program have?

b) A class should contain an average of less than 30 methods, resulting in up to 900 lines of code.

How do you check how many times a method is called in Eclipse?

Select mymethod() and press ctrl + alt + h . To see some detailed Information about any method you can use this by selecting that particular Object or method and right click.

How many methods can a class have Java?

The following limitations of the Java virtual machine are implicit in the class file format: The number of methods that may be declared by a class or interface is limited to 65535 by the size of the methods_count item of the ClassFile structure (§4.1).


1 Answers

Using Eclipse you can do this:

  • Press Ctrl-H (Search), then select the "Java Search" tab (if it doesn't appear click on the "Customize..." button at the lower left corner)
  • Put * in the search box
  • Select "Method" in the "Search For" fieldset
  • Select "Declarations" in the "Limit To" fieldset
  • Select "Sources" in the "Search In" fieldset
  • Select "Workspace" in the "Scope" fieldset
  • Click on "Search"

After the search is complete you should see a "XXXX declarations in..." message in the search view and that will be your result.

Hope it helps!

like image 153
Francisco Paulo Avatar answered Oct 25 '22 20:10

Francisco Paulo