Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to find out a method caller

Posted on 1997-08-29
2
Medium Priority
?
240 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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

916 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