Java: Find all callers of a method – get all methods that call a particular method

This tutorial belongs to Eclipse JDT Tutorial Series.

I will explore how we can compute fan in i.e. find all the methods that call a particular method (all callers of a method).

In Eclipse, one can right click on a method and choose “open call hierarchy” and eclipse shows all the methods that call the selected method and all the methods that are called from the selected method (callers and callees of the selected method).

We can programtically find callers and callees and I will explain how I have done it.

There are a couple of different ways that I know:

  1. Use the eclipse JDT internal classes : these are the same classes used by eclipse to show the callers and callees of a method
  2. Use the eclipse ast visitor

Read more

Research Topics for Software Engineering – Between SE and NLP

Someone says that programming language is also a language. This is true. Beyond this, during a software development life cycle different kinds of natural languages are added for various purposes, such as requirement analysis, comments, bug reports, etc. Since there are common features between natural language and software related data, a lot of research in … Read more

Latent Semantic Indexing

Latent Semantic Indexing(LSI) is a common technique in natural language processing area. This article is about how LSI works by comparing the pure key-word-based search. What is LSI? Latent Semantic Indexing (LSI) is an indexing and retrieval method that uses a mathematical technique called Singular value decomposition (SVD) to identify patterns in the relationships between … Read more

Count Number of Statements in a Java Method By Using Eclipse JDT ASTParser

This tutorial belongs to Eclipse JDT Tutorial Series.

Given a method, we may want a count of the number of statements in the method (for ex: to gauge the complexity of the method). We can use eclipse JDT ASTParser to get this job done.

One approximate way to count the number of statements in a method is to count the number of lines ending with the semi-colon along with lines that contain the words “if/for/while/”.

Read more

Research in Software Engineering- Bug Report

Bug reports are artifacts that track the defects of software systems. In software maintenance research area, there has been a bunch of research work addressing problem of bug reports in recent years.

Bugzilla is one of the most popular bug reporting system. For the sake of its popularity and open-source feature, the data for research are largely provided by Bugzilla.

The diagram below shows the major categories of work in this area. The left-bottom corner is a sample bug report from Bugzilla.

Read more

OSGi Framework Architecture – Three Conceptual Layers

The OSGi(Open Services Gateway initiative) framework provides a dynamic modular architecture which has been used in many applications such as Eclipse Equinox, Apache Felix, etc. Understanding how OSGi framework works is useful for developing Eclipse plugins and many other molecularity applications. In this article, the high-level overview of the architecture is explained. OSGi framework architecture … Read more

Software Engineering Research Topics – Diagram of General Perspective

Diagram is (Sometimes) Worth Ten Thousand Words. During my research starting stage, I’m trying to get myself better understanding of state-of-the-art in software engineering area. The diagram below is first one of this series. It contains the basic research topics in software maintenance/evolution area of software engineering. To better understand on each small topic on … Read more

Java equals() and hashCode() Contract

The Java super class java.lang.Object defines two important methods: public boolean equals(Object obj) public int hashCode()public boolean equals(Object obj) public int hashCode() In this post, I will first show an example of a common mistake, and then explain how the equals() and hashCode() contract works. 1. A common mistake The common mistake is shown in … Read more

Java Design Pattern: Singleton

Singleton pattern is one of the most commonly used patterns in Java. It is used to control the number of objects created by preventing external instantiation and modification. This concept can be generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects, … Read more

Research in Software Engineering – Code Assistant/Recommendation

Here are some research about code assistant conducted in software engineering research area. Those topics are pretty common, and a lot of people have developed various kinds of tools. 1. Mining Subclassing Directives to improve Framework Reuse. Idea: reverse engineer from application-specific code, how-to-use documentation of a particular software artifact can be inferred from how … Read more