On 10/7/2013 3:49 AM, Alan Bateman wrote:
On 07/10/2013 09:24, Mandy Chung wrote:
JDK 8 was feature complete in June and there just isn't sufficient
time remaining to get agreement and feedback on an API to examine the
caller frames. To that end, I propose to restore the old unsupported
Reflection.getCallerClass(int) and that we will look to define a
standard API for JDK 9.
Webrev at:
http://cr.openjdk.java.net/~mchung/jdk8/webrevs/8025799/
It remains to be an unsupported API and JDK should not use this
method and it's not annotated with @CallerSensitive. I considered
detecting if this method is called by a system class (loaded by null
loader) and throw an error. I decided to minimize the compatibility
risk in case if there is any existing code added to the bootclasspath
depending on this private API.
I liked the direction this was going with the walkStack and
firstCaller proposal but it is way too late in jdk8 to have any time
to get feedback. So I agree that temporarily restoring the unsupported
Reflection.getCallerClass(int) is the right thing for now. As the
standard API is likely to be significant then it probably warrants a JEP.
I agree and I meant to mention that too. I will submit a JEP and target
it for JDK 9.
As regards the webrev then the changes looks okay. I guess you could
rename one of the native methods to avoid the non-obvious name
mangling but since it is only temporary then I could live with what
you have.
As it's temporary, I will leave it as it is.
Thanks
Mandy