jjzjj

CallerSensitive

全部标签

java.lang.InternalError : CallerSensitive annotation expected at frame 1 错误

在静态方法中(用@CallerSensitive注释)我尝试获取调用类的名称:@CallerSensitivepublicstaticvoidsomeMethod(){Stringname=sun.reflect.Reflection.getCallerClass().getName();...}我得到错误:java.lang.InternalError:CallerSensitiveannotationexpectedatframe1这里有什么问题吗?引用资料http://www.infoq.com/news/2013/07/Oracle-Removes-getCallerClass

java - sun.reflect.CallerSensitive 注释是什么意思?

@CallerSensitive注解上述方法的含义是什么?例如,注解存在于Class的getClassLoader方法中@CallerSensitivepublicClassLoadergetClassLoader(){//} 最佳答案 根据我在评论中链接的JEP(也是here),Acaller-sensitivemethodvariesitsbehavioraccordingtotheclassofitsimmediatecaller.Itdiscoversitscaller’sclassbyinvokingthesun.refl

java - sun.reflect.CallerSensitive 注释是什么意思?

@CallerSensitive注解上述方法的含义是什么?例如,注解存在于Class的getClassLoader方法中@CallerSensitivepublicClassLoadergetClassLoader(){//} 最佳答案 根据我在评论中链接的JEP(也是here),Acaller-sensitivemethodvariesitsbehavioraccordingtotheclassofitsimmediatecaller.Itdiscoversitscaller’sclassbyinvokingthesun.refl