Generally speaking we need the stack information when we want to develop caller dependent code. Having information about the caller allows our code to make decisions based on that information. In general practice, it is not a good idea to make functionality dependent on the caller. Information that affects the behavior of a method should be available via parameters. Caller dependent code development should be fairly limited.
The JDK accesses stack information with native methods that are not available to Java applications. The SecurityManager is a class that defines an application's security policy. This class checks that the caller of a reflection API is allowed to access the non-public members of another ...