< prev index next >
src/java.base/share/classes/java/lang/reflect/Field.java
Print this page
rev 15107 : 8161379: Force inline methods calling Reflection.getCallerClass
Reviewed-by: TBD
@@ -27,10 +27,11 @@
import jdk.internal.misc.SharedSecrets;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.FieldAccessor;
import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
import sun.reflect.generics.repository.FieldRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
import sun.reflect.generics.scope.ClassScope;
import java.lang.annotation.Annotation;
@@ -394,10 +395,11 @@
* and the field is an instance field.
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
*/
@CallerSensitive
+ @ForceInline
public Object get(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -427,10 +429,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public boolean getBoolean(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -460,10 +463,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public byte getByte(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -495,10 +499,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public char getChar(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -530,10 +535,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public short getShort(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -565,10 +571,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public int getInt(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -600,10 +607,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public long getLong(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -635,10 +643,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public float getFloat(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -670,10 +679,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#get
*/
@CallerSensitive
+ @ForceInline
public double getDouble(Object obj)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -747,10 +757,11 @@
* and the field is an instance field.
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
*/
@CallerSensitive
+ @ForceInline
public void set(Object obj, Object value)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -782,10 +793,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setBoolean(Object obj, boolean z)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -817,10 +829,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setByte(Object obj, byte b)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -852,10 +865,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setChar(Object obj, char c)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -887,10 +901,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setShort(Object obj, short s)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -922,10 +937,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setInt(Object obj, int i)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -957,10 +973,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setLong(Object obj, long l)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -992,10 +1009,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setFloat(Object obj, float f)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
@@ -1027,10 +1045,11 @@
* @exception ExceptionInInitializerError if the initialization provoked
* by this method fails.
* @see Field#set
*/
@CallerSensitive
+ @ForceInline
public void setDouble(Object obj, double d)
throws IllegalArgumentException, IllegalAccessException
{
if (!override) {
Class<?> caller = Reflection.getCallerClass();
< prev index next >