1

I am currently working on an open source project. I am new in this field. My work is adding a new feature to the currently existing codebase.

However, I do not know where to add my code in the project. The projects contains hundreds of files, classes, and thousands of methods. It is not literally possible to go through each and every line of code.

Eg: Suppose I am working on a project called Calculator. I have the whole source code. Now I type 2 + 3 and hit enter. I get the result 5 which is displayed. But, I need to find where this exact calculation takes place in the source code. For instance, if a method is defined as :

public int add(int a, int b) {
     return (a+b);
}

So I need to find this method, whose name is not known to me.

I am currently using the Eclipse IDE.

Can you help me? Or am I approaching this completely the wrong way? If so, how should I go about contributing to open source projects?

R Langdon
  • 11
  • 2

1 Answers1

0

I'm not sure if this is exactly what you are looking for but you can access a thread's stackTrace that contains the information about the currently called methods. Therefore you could watch this for getting to know which methods are called.
See this question for how to access the stackTrace.

To access the running code to implement some sort of log mechanism you could use instrumentation to get your code into the running program if you don't have direct access to the code.

This logging method might also be worth a look

Community
  • 1
  • 1
Raven
  • 2,951
  • 2
  • 26
  • 42