Solved

How to find out a method caller

Posted on 1997-08-29
2
186 Views
Last Modified: 2010-04-16
How to find out from which method was method called from ?
For example if method A calls method B, how can I find, that method B was called from A. And is it possible to find out on the level of bytecode?
0
Comment
Question by:Klemo
2 Comments
 
LVL 4

Accepted Solution

by:
russgold earned 50 total points
ID: 1226006
There is a solution, but it doesn't work when running under a JIT:  You can use Throwable.printStackTrace to print the current stack to a BufferedOutputStream and then parse the result to find the calling method's name.  The problem is that in a JIT, the Java stack information is not preserved.  
0
 

Author Comment

by:Klemo
ID: 1226007
I knew that already, I find it out whit playing with that stuff, but thanks anyway.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now