How to get the caller class in Java
<p>I want to get the caller class of the method, i.e. </p>

<pre><code>class foo{

  bar();

}
</code></pre>

<p>in the method bar, i need to get the class name <code>foo</code>, and i found this method:</p>

<pre><code>Class clazz = Reflection.getCallerClass(1);
</code></pre>

<p>however, i noticed that <code>getCallerClass</code> is a native method, so am wondering whether there are some side effects here.</p>

<p>are there any other choices? thanks in advance.</p>
