• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to trace a method of an API

 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my project I added an API to my project.

For some reason I have to change a method of one class of that API.

Now I want to know how this change affect on my project.

So I used F7 to go through the method .

But it doesn,t work, F7 acted like F8 in NetBeans6.8 !!

What should I do for debugging the methods of an API ?Using Junit Test is helpful here?
Thanks.
I also ask this question in this forum: Stackoverflow
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please just post one thread per topic in this forum.

I suspect your question is specific to a development environment. When you say, "F7 acted like F8 here," what do you mean? Where's "here" and what are you comparing "here" to?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you have published that method as part of an API you must ensure its effects do not change. You can of course alter the implementation which achieves that effect.
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Brannon wrote:Please just post one thread per topic in this forum.


Ok. i edit my post.
What do you mean?
I searched in this forum, but there is no result.
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Once you have published that method as part of an API you must ensure its effects do not change. You can of course alter the implementation which achieves that effect.

Can you explain more?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which bit don’t you understand? If you are using that method in an API, you must maintain its effect. You can change the implementation, however. You will have given it a description in its documentation, so you are now bound to maintain the method to match that description.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On SO you were on about altering the method in an API you have downloaded. You can’t do that. You would have to write your own class.
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:On SO you were on about altering the method in an API you have downloaded. You can’t do that. You would have to write your own class.

Ok.
But my main problem is :for understanding details about a method(in an API) and knowing how exactly it works, need to trace that method step by step, i use (f7 ,step into method) for doing that .
But it does not go into the method.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sara Bony wrote:But my main problem is :for understanding details about a method(in an API) and knowing how exactly it works, need to trace that method step by step, i use (f7 ,step into method) for doing that .
But it does not go into the method.

OK, so this is something like Eclipse or Netbeans, right?

If you let us know exactly what, we could move your question to a more appropriate forum.

Winston
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Sara Bony wrote:But my main problem is :for understanding details about a method(in an API) and knowing how exactly it works, need to trace that method step by step, i use (f7 ,step into method) for doing that .
But it does not go into the method.

OK, so this is something like Eclipse or Netbeans, right?

If you let us know exactly what, we could move your question to a more appropriate forum.

Winston

Ok.
Program run in NetBeans 6.8.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need to know the implementation details of that method in the first place?
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Why do you need to know the implementation details of that method in the first place?

Because i need to change that to meet my requirement.
It is an API of a simulator, its developer developed it in general and users should change it to meet their special requirement.
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sara Bony wrote:
Campbell Ritchie wrote:Why do you need to know the implementation details of that method in the first place?

Because i need to change that to meet my requirement.
It is an API of a simulator, its developer developed it in general and users should change it to meet their special requirement.

So you have the source code for the API. Have you told Netbeans where this source code is ? Netbeans (and other IDEs for that matter) can only step into the source code if they know where it is. If they don't know where it is then they will just step over the method call which appears to be what is happening here.
And before you ask, I don't know how to tell Netbeans where the source code is as I don't use Netbeans, but it shouldn't be difficult to find in the help.
 
Sara Bony
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem has been solved.
We can only do line-by-line debugging in NetBeans for a library (package) if we have the source code for that package, and for adding it in NeatBeans :
1. right click on project and go to "Properties"

2. in the window that appear choose "sources" on the left

3. on the right of window, under "source package folder" click on "add folder" then add the root directory for the source code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic