1 /*
   2  * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.reflect;
  27 
  28 import jdk.internal.access.SharedSecrets;
  29 import jdk.internal.reflect.CallerSensitive;
  30 import jdk.internal.reflect.FieldAccessor;
  31 import jdk.internal.reflect.Reflection;
  32 import jdk.internal.vm.annotation.ForceInline;
  33 import jdk.internal.vm.annotation.Stable;
  34 import sun.reflect.generics.repository.FieldRepository;
  35 import sun.reflect.generics.factory.CoreReflectionFactory;
  36 import sun.reflect.generics.factory.GenericsFactory;
  37 import sun.reflect.generics.scope.ClassScope;
  38 import java.lang.annotation.Annotation;
  39 import java.util.Map;
  40 import java.util.Objects;
  41 import sun.reflect.annotation.AnnotationParser;
  42 import sun.reflect.annotation.AnnotationSupport;
  43 import sun.reflect.annotation.TypeAnnotation;
  44 import sun.reflect.annotation.TypeAnnotationParser;
  45 
  46 /**
  47  * A {@code Field} provides information about, and dynamic access to, a
  48  * single field of a class or an interface.  The reflected field may
  49  * be a class (static) field or an instance field.
  50  *
  51  * <p>A {@code Field} permits widening conversions to occur during a get or
  52  * set access operation, but throws an {@code IllegalArgumentException} if a
  53  * narrowing conversion would occur.
  54  *
  55  * @see Member
  56  * @see java.lang.Class
  57  * @see java.lang.Class#getFields()
  58  * @see java.lang.Class#getField(String)
  59  * @see java.lang.Class#getDeclaredFields()
  60  * @see java.lang.Class#getDeclaredField(String)
  61  *
  62  * @author Kenneth Russell
  63  * @author Nakul Saraiya
  64  * @since 1.1
  65  */
  66 public final
  67 class Field extends AccessibleObject implements Member {
  68     private final Class<?>            clazz;
  69     private final int                 slot;
  70     // This is guaranteed to be interned by the VM in the 1.4
  71     // reflection implementation
  72     private final String              name;
  73     private final Class<?>            type;
  74     private final int                 modifiers;
  75     private final boolean             trustedFinal;
  76     // Generics and annotations support
  77     private final transient String    signature;
  78     // generic info repository; lazily initialized
  79     private transient FieldRepository genericInfo;
  80     private final byte[]              annotations;
  81     // Cached field accessor created without override
  82     @Stable
  83     private FieldAccessor fieldAccessor;
  84     // Cached field accessor created with override
  85     @Stable
  86     private FieldAccessor overrideFieldAccessor;
  87     // For sharing of FieldAccessors. This branching structure is
  88     // currently only two levels deep (i.e., one root Field and
  89     // potentially many Field objects pointing to it.)
  90     //
  91     // If this branching structure would ever contain cycles, deadlocks can
  92     // occur in annotation code.
  93     private Field               root;
  94 
  95     // Generics infrastructure
  96 
  97     private String getGenericSignature() {return signature;}
  98 
  99     // Accessor for factory
 100     private GenericsFactory getFactory() {
 101         Class<?> c = getDeclaringClass();
 102         // create scope and factory
 103         return CoreReflectionFactory.make(c, ClassScope.make(c));
 104     }
 105 
 106     // Accessor for generic info repository
 107     private FieldRepository getGenericInfo() {
 108         // lazily initialize repository if necessary
 109         if (genericInfo == null) {
 110             // create and cache generic info repository
 111             genericInfo = FieldRepository.make(getGenericSignature(),
 112                                                getFactory());
 113         }
 114         return genericInfo; //return cached repository
 115     }
 116 
 117 
 118     /**
 119      * Package-private constructor
 120      */
 121     @SuppressWarnings("deprecation")
 122     Field(Class<?> declaringClass,
 123           String name,
 124           Class<?> type,
 125           int modifiers,
 126           boolean trustedFinal,
 127           int slot,
 128           String signature,
 129           byte[] annotations)
 130     {
 131         this.clazz = declaringClass;
 132         this.name = name;
 133         this.type = type;
 134         this.modifiers = modifiers;
 135         this.trustedFinal = trustedFinal;
 136         this.slot = slot;
 137         this.signature = signature;
 138         this.annotations = annotations;
 139     }
 140 
 141     /**
 142      * Package-private routine (exposed to java.lang.Class via
 143      * ReflectAccess) which returns a copy of this Field. The copy's
 144      * "root" field points to this Field.
 145      */
 146     Field copy() {
 147         // This routine enables sharing of FieldAccessor objects
 148         // among Field objects which refer to the same underlying
 149         // method in the VM. (All of this contortion is only necessary
 150         // because of the "accessibility" bit in AccessibleObject,
 151         // which implicitly requires that new java.lang.reflect
 152         // objects be fabricated for each reflective call on Class
 153         // objects.)
 154         if (this.root != null)
 155             throw new IllegalArgumentException("Can not copy a non-root Field");
 156 
 157         Field res = new Field(clazz, name, type, modifiers, trustedFinal, slot, signature, annotations);
 158         res.root = this;
 159         // Might as well eagerly propagate this if already present
 160         res.fieldAccessor = fieldAccessor;
 161         res.overrideFieldAccessor = overrideFieldAccessor;
 162 
 163         return res;
 164     }
 165 
 166     /**
 167      * @throws InaccessibleObjectException {@inheritDoc}
 168      * @throws SecurityException {@inheritDoc}
 169      */
 170     @Override
 171     @CallerSensitive
 172     public void setAccessible(boolean flag) {
 173         AccessibleObject.checkPermission();
 174         if (flag) checkCanSetAccessible(Reflection.getCallerClass());
 175         setAccessible0(flag);
 176     }
 177 
 178     @Override
 179     void checkCanSetAccessible(Class<?> caller) {
 180         checkCanSetAccessible(caller, clazz);
 181     }
 182 
 183     /**
 184      * Returns the {@code Class} object representing the class or interface
 185      * that declares the field represented by this {@code Field} object.
 186      */
 187     @Override
 188     public Class<?> getDeclaringClass() {
 189         return clazz;
 190     }
 191 
 192     /**
 193      * Returns the name of the field represented by this {@code Field} object.
 194      */
 195     public String getName() {
 196         return name;
 197     }
 198 
 199     /**
 200      * Returns the Java language modifiers for the field represented
 201      * by this {@code Field} object, as an integer. The {@code Modifier} class should
 202      * be used to decode the modifiers.
 203      *
 204      * @see Modifier
 205      * @jls 8.3 Field Declarations
 206      * @jls 9.3 Field (Constant) Declarations
 207      */
 208     public int getModifiers() {
 209         return modifiers;
 210     }
 211 
 212     /**
 213      * Returns {@code true} if this field represents an element of
 214      * an enumerated class; returns {@code false} otherwise.
 215      *
 216      * @return {@code true} if and only if this field represents an element of
 217      * an enumerated class.
 218      * @since 1.5
 219      * @jls 8.9.1 Enum Constants
 220      */
 221     public boolean isEnumConstant() {
 222         return (getModifiers() & Modifier.ENUM) != 0;
 223     }
 224 
 225     /**
 226      * Returns {@code true} if this field is a synthetic
 227      * field; returns {@code false} otherwise.
 228      *
 229      * @return true if and only if this field is a synthetic
 230      * field as defined by the Java Language Specification.
 231      * @since 1.5
 232      * @see <a
 233      * href="{@docRoot}/java.base/java/lang/reflect/package-summary.html#LanguageJvmModel">Java
 234      * programming language and JVM modeling in core reflection</a>
 235      */
 236     public boolean isSynthetic() {
 237         return Modifier.isSynthetic(getModifiers());
 238     }
 239 
 240     /**
 241      * Returns a {@code Class} object that identifies the
 242      * declared type for the field represented by this
 243      * {@code Field} object.
 244      *
 245      * @return a {@code Class} object identifying the declared
 246      * type of the field represented by this object
 247      */
 248     public Class<?> getType() {
 249         return type;
 250     }
 251 
 252     /**
 253      * Returns a {@code Type} object that represents the declared type for
 254      * the field represented by this {@code Field} object.
 255      *
 256      * <p>If the declared type of the field is a parameterized type,
 257      * the {@code Type} object returned must accurately reflect the
 258      * actual type arguments used in the source code.
 259      *
 260      * <p>If the type of the underlying field is a type variable or a
 261      * parameterized type, it is created. Otherwise, it is resolved.
 262      *
 263      * @return a {@code Type} object that represents the declared type for
 264      *     the field represented by this {@code Field} object
 265      * @throws GenericSignatureFormatError if the generic field
 266      *     signature does not conform to the format specified in
 267      *     <cite>The Java Virtual Machine Specification</cite>
 268      * @throws TypeNotPresentException if the generic type
 269      *     signature of the underlying field refers to a non-existent
 270      *     class or interface declaration
 271      * @throws MalformedParameterizedTypeException if the generic
 272      *     signature of the underlying field refers to a parameterized type
 273      *     that cannot be instantiated for any reason
 274      * @since 1.5
 275      */
 276     public Type getGenericType() {
 277         if (getGenericSignature() != null)
 278             return getGenericInfo().getGenericType();
 279         else
 280             return getType();
 281     }
 282 
 283 
 284     /**
 285      * Compares this {@code Field} against the specified object.  Returns
 286      * true if the objects are the same.  Two {@code Field} objects are the same if
 287      * they were declared by the same class and have the same name
 288      * and type.
 289      */
 290     public boolean equals(Object obj) {
 291         if (obj instanceof Field other) {
 292             return (getDeclaringClass() == other.getDeclaringClass())
 293                 && (getName() == other.getName())
 294                 && (getType() == other.getType());
 295         }
 296         return false;
 297     }
 298 
 299     /**
 300      * Returns a hashcode for this {@code Field}.  This is computed as the
 301      * exclusive-or of the hashcodes for the underlying field's
 302      * declaring class name and its name.
 303      */
 304     public int hashCode() {
 305         return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
 306     }
 307 
 308     /**
 309      * Returns a string describing this {@code Field}.  The format is
 310      * the access modifiers for the field, if any, followed
 311      * by the field type, followed by a space, followed by
 312      * the fully-qualified name of the class declaring the field,
 313      * followed by a period, followed by the name of the field.
 314      * For example:
 315      * <pre>
 316      *    public static final int java.lang.Thread.MIN_PRIORITY
 317      *    private int java.io.FileDescriptor.fd
 318      * </pre>
 319      *
 320      * <p>The modifiers are placed in canonical order as specified by
 321      * "The Java Language Specification".  This is {@code public},
 322      * {@code protected} or {@code private} first, and then other
 323      * modifiers in the following order: {@code static}, {@code final},
 324      * {@code transient}, {@code volatile}.
 325      *
 326      * @return a string describing this {@code Field}
 327      * @jls 8.3.1 Field Modifiers
 328      */
 329     public String toString() {
 330         int mod = getModifiers();
 331         return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
 332             + getType().getTypeName() + " "
 333             + getDeclaringClass().getTypeName() + "."
 334             + getName());
 335     }
 336 
 337     @Override
 338     String toShortString() {
 339         return "field " + getDeclaringClass().getTypeName() + "." + getName();
 340     }
 341 
 342     /**
 343      * Returns a string describing this {@code Field}, including
 344      * its generic type.  The format is the access modifiers for the
 345      * field, if any, followed by the generic field type, followed by
 346      * a space, followed by the fully-qualified name of the class
 347      * declaring the field, followed by a period, followed by the name
 348      * of the field.
 349      *
 350      * <p>The modifiers are placed in canonical order as specified by
 351      * "The Java Language Specification".  This is {@code public},
 352      * {@code protected} or {@code private} first, and then other
 353      * modifiers in the following order: {@code static}, {@code final},
 354      * {@code transient}, {@code volatile}.
 355      *
 356      * @return a string describing this {@code Field}, including
 357      * its generic type
 358      *
 359      * @since 1.5
 360      * @jls 8.3.1 Field Modifiers
 361      */
 362     public String toGenericString() {
 363         int mod = getModifiers();
 364         Type fieldType = getGenericType();
 365         return (((mod == 0) ? "" : (Modifier.toString(mod) + " "))
 366             + fieldType.getTypeName() + " "
 367             + getDeclaringClass().getTypeName() + "."
 368             + getName());
 369     }
 370 
 371     /**
 372      * Returns the value of the field represented by this {@code Field}, on
 373      * the specified object. The value is automatically wrapped in an
 374      * object if it has a primitive type.
 375      *
 376      * <p>The underlying field's value is obtained as follows:
 377      *
 378      * <p>If the underlying field is a static field, the {@code obj} argument
 379      * is ignored; it may be null.
 380      *
 381      * <p>Otherwise, the underlying field is an instance field.  If the
 382      * specified {@code obj} argument is null, the method throws a
 383      * {@code NullPointerException}. If the specified object is not an
 384      * instance of the class or interface declaring the underlying
 385      * field, the method throws an {@code IllegalArgumentException}.
 386      *
 387      * <p>If this {@code Field} object is enforcing Java language access control, and
 388      * the underlying field is inaccessible, the method throws an
 389      * {@code IllegalAccessException}.
 390      * If the underlying field is static, the class that declared the
 391      * field is initialized if it has not already been initialized.
 392      *
 393      * <p>Otherwise, the value is retrieved from the underlying instance
 394      * or static field.  If the field has a primitive type, the value
 395      * is wrapped in an object before being returned, otherwise it is
 396      * returned as is.
 397      *
 398      * <p>If the field is hidden in the type of {@code obj},
 399      * the field's value is obtained according to the preceding rules.
 400      *
 401      * @param obj object from which the represented field's value is
 402      * to be extracted
 403      * @return the value of the represented field in object
 404      * {@code obj}; primitive values are wrapped in an appropriate
 405      * object before being returned
 406      *
 407      * @throws    IllegalAccessException    if this {@code Field} object
 408      *              is enforcing Java language access control and the underlying
 409      *              field is inaccessible.
 410      * @throws    IllegalArgumentException  if the specified object is not an
 411      *              instance of the class or interface declaring the underlying
 412      *              field (or a subclass or implementor thereof).
 413      * @throws    NullPointerException      if the specified object is null
 414      *              and the field is an instance field.
 415      * @throws    ExceptionInInitializerError if the initialization provoked
 416      *              by this method fails.
 417      */
 418     @CallerSensitive
 419     @ForceInline // to ensure Reflection.getCallerClass optimization
 420     public Object get(Object obj)
 421         throws IllegalArgumentException, IllegalAccessException
 422     {
 423         if (!override) {
 424             Class<?> caller = Reflection.getCallerClass();
 425             checkAccess(caller, obj);
 426             return getFieldAccessor().get(obj);
 427         } else {
 428             return getOverrideFieldAccessor().get(obj);
 429         }
 430     }
 431 
 432     /**
 433      * Gets the value of a static or instance {@code boolean} field.
 434      *
 435      * @param obj the object to extract the {@code boolean} value
 436      * from
 437      * @return the value of the {@code boolean} field
 438      *
 439      * @throws    IllegalAccessException    if this {@code Field} object
 440      *              is enforcing Java language access control and the underlying
 441      *              field is inaccessible.
 442      * @throws    IllegalArgumentException  if the specified object is not
 443      *              an instance of the class or interface declaring the
 444      *              underlying field (or a subclass or implementor
 445      *              thereof), or if the field value cannot be
 446      *              converted to the type {@code boolean} by a
 447      *              widening conversion.
 448      * @throws    NullPointerException      if the specified object is null
 449      *              and the field is an instance field.
 450      * @throws    ExceptionInInitializerError if the initialization provoked
 451      *              by this method fails.
 452      * @see       Field#get
 453      */
 454     @CallerSensitive
 455     @ForceInline // to ensure Reflection.getCallerClass optimization
 456     public boolean getBoolean(Object obj)
 457         throws IllegalArgumentException, IllegalAccessException
 458     {
 459         if (!override) {
 460             Class<?> caller = Reflection.getCallerClass();
 461             checkAccess(caller, obj);
 462             return getFieldAccessor().getBoolean(obj);
 463         } else {
 464             return getOverrideFieldAccessor().getBoolean(obj);
 465         }
 466     }
 467 
 468     /**
 469      * Gets the value of a static or instance {@code byte} field.
 470      *
 471      * @param obj the object to extract the {@code byte} value
 472      * from
 473      * @return the value of the {@code byte} field
 474      *
 475      * @throws    IllegalAccessException    if this {@code Field} object
 476      *              is enforcing Java language access control and the underlying
 477      *              field is inaccessible.
 478      * @throws    IllegalArgumentException  if the specified object is not
 479      *              an instance of the class or interface declaring the
 480      *              underlying field (or a subclass or implementor
 481      *              thereof), or if the field value cannot be
 482      *              converted to the type {@code byte} by a
 483      *              widening conversion.
 484      * @throws    NullPointerException      if the specified object is null
 485      *              and the field is an instance field.
 486      * @throws    ExceptionInInitializerError if the initialization provoked
 487      *              by this method fails.
 488      * @see       Field#get
 489      */
 490     @CallerSensitive
 491     @ForceInline // to ensure Reflection.getCallerClass optimization
 492     public byte getByte(Object obj)
 493         throws IllegalArgumentException, IllegalAccessException
 494     {
 495         if (!override) {
 496             Class<?> caller = Reflection.getCallerClass();
 497             checkAccess(caller, obj);
 498             return getFieldAccessor().getByte(obj);
 499         } else {
 500             return getOverrideFieldAccessor().getByte(obj);
 501         }
 502     }
 503 
 504     /**
 505      * Gets the value of a static or instance field of type
 506      * {@code char} or of another primitive type convertible to
 507      * type {@code char} via a widening conversion.
 508      *
 509      * @param obj the object to extract the {@code char} value
 510      * from
 511      * @return the value of the field converted to type {@code char}
 512      *
 513      * @throws    IllegalAccessException    if this {@code Field} object
 514      *              is enforcing Java language access control and the underlying
 515      *              field is inaccessible.
 516      * @throws    IllegalArgumentException  if the specified object is not
 517      *              an instance of the class or interface declaring the
 518      *              underlying field (or a subclass or implementor
 519      *              thereof), or if the field value cannot be
 520      *              converted to the type {@code char} by a
 521      *              widening conversion.
 522      * @throws    NullPointerException      if the specified object is null
 523      *              and the field is an instance field.
 524      * @throws    ExceptionInInitializerError if the initialization provoked
 525      *              by this method fails.
 526      * @see Field#get
 527      */
 528     @CallerSensitive
 529     @ForceInline // to ensure Reflection.getCallerClass optimization
 530     public char getChar(Object obj)
 531         throws IllegalArgumentException, IllegalAccessException
 532     {
 533         if (!override) {
 534             Class<?> caller = Reflection.getCallerClass();
 535             checkAccess(caller, obj);
 536             return getFieldAccessor().getChar(obj);
 537         } else {
 538             return getOverrideFieldAccessor().getChar(obj);
 539         }
 540     }
 541 
 542     /**
 543      * Gets the value of a static or instance field of type
 544      * {@code short} or of another primitive type convertible to
 545      * type {@code short} via a widening conversion.
 546      *
 547      * @param obj the object to extract the {@code short} value
 548      * from
 549      * @return the value of the field converted to type {@code short}
 550      *
 551      * @throws    IllegalAccessException    if this {@code Field} object
 552      *              is enforcing Java language access control and the underlying
 553      *              field is inaccessible.
 554      * @throws    IllegalArgumentException  if the specified object is not
 555      *              an instance of the class or interface declaring the
 556      *              underlying field (or a subclass or implementor
 557      *              thereof), or if the field value cannot be
 558      *              converted to the type {@code short} by a
 559      *              widening conversion.
 560      * @throws    NullPointerException      if the specified object is null
 561      *              and the field is an instance field.
 562      * @throws    ExceptionInInitializerError if the initialization provoked
 563      *              by this method fails.
 564      * @see       Field#get
 565      */
 566     @CallerSensitive
 567     @ForceInline // to ensure Reflection.getCallerClass optimization
 568     public short getShort(Object obj)
 569         throws IllegalArgumentException, IllegalAccessException
 570     {
 571         if (!override) {
 572             Class<?> caller = Reflection.getCallerClass();
 573             checkAccess(caller, obj);
 574             return getFieldAccessor().getShort(obj);
 575         } else {
 576             return getOverrideFieldAccessor().getShort(obj);
 577         }
 578     }
 579 
 580     /**
 581      * Gets the value of a static or instance field of type
 582      * {@code int} or of another primitive type convertible to
 583      * type {@code int} via a widening conversion.
 584      *
 585      * @param obj the object to extract the {@code int} value
 586      * from
 587      * @return the value of the field converted to type {@code int}
 588      *
 589      * @throws    IllegalAccessException    if this {@code Field} object
 590      *              is enforcing Java language access control and the underlying
 591      *              field is inaccessible.
 592      * @throws    IllegalArgumentException  if the specified object is not
 593      *              an instance of the class or interface declaring the
 594      *              underlying field (or a subclass or implementor
 595      *              thereof), or if the field value cannot be
 596      *              converted to the type {@code int} by a
 597      *              widening conversion.
 598      * @throws    NullPointerException      if the specified object is null
 599      *              and the field is an instance field.
 600      * @throws    ExceptionInInitializerError if the initialization provoked
 601      *              by this method fails.
 602      * @see       Field#get
 603      */
 604     @CallerSensitive
 605     @ForceInline // to ensure Reflection.getCallerClass optimization
 606     public int getInt(Object obj)
 607         throws IllegalArgumentException, IllegalAccessException
 608     {
 609         if (!override) {
 610             Class<?> caller = Reflection.getCallerClass();
 611             checkAccess(caller, obj);
 612             return getFieldAccessor().getInt(obj);
 613         } else {
 614             return getOverrideFieldAccessor().getInt(obj);
 615         }
 616     }
 617 
 618     /**
 619      * Gets the value of a static or instance field of type
 620      * {@code long} or of another primitive type convertible to
 621      * type {@code long} via a widening conversion.
 622      *
 623      * @param obj the object to extract the {@code long} value
 624      * from
 625      * @return the value of the field converted to type {@code long}
 626      *
 627      * @throws    IllegalAccessException    if this {@code Field} object
 628      *              is enforcing Java language access control and the underlying
 629      *              field is inaccessible.
 630      * @throws    IllegalArgumentException  if the specified object is not
 631      *              an instance of the class or interface declaring the
 632      *              underlying field (or a subclass or implementor
 633      *              thereof), or if the field value cannot be
 634      *              converted to the type {@code long} by a
 635      *              widening conversion.
 636      * @throws    NullPointerException      if the specified object is null
 637      *              and the field is an instance field.
 638      * @throws    ExceptionInInitializerError if the initialization provoked
 639      *              by this method fails.
 640      * @see       Field#get
 641      */
 642     @CallerSensitive
 643     @ForceInline // to ensure Reflection.getCallerClass optimization
 644     public long getLong(Object obj)
 645         throws IllegalArgumentException, IllegalAccessException
 646     {
 647         if (!override) {
 648             Class<?> caller = Reflection.getCallerClass();
 649             checkAccess(caller, obj);
 650             return getFieldAccessor().getLong(obj);
 651         } else {
 652             return getOverrideFieldAccessor().getLong(obj);
 653         }
 654     }
 655 
 656     /**
 657      * Gets the value of a static or instance field of type
 658      * {@code float} or of another primitive type convertible to
 659      * type {@code float} via a widening conversion.
 660      *
 661      * @param obj the object to extract the {@code float} value
 662      * from
 663      * @return the value of the field converted to type {@code float}
 664      *
 665      * @throws    IllegalAccessException    if this {@code Field} object
 666      *              is enforcing Java language access control and the underlying
 667      *              field is inaccessible.
 668      * @throws    IllegalArgumentException  if the specified object is not
 669      *              an instance of the class or interface declaring the
 670      *              underlying field (or a subclass or implementor
 671      *              thereof), or if the field value cannot be
 672      *              converted to the type {@code float} by a
 673      *              widening conversion.
 674      * @throws    NullPointerException      if the specified object is null
 675      *              and the field is an instance field.
 676      * @throws    ExceptionInInitializerError if the initialization provoked
 677      *              by this method fails.
 678      * @see Field#get
 679      */
 680     @CallerSensitive
 681     @ForceInline // to ensure Reflection.getCallerClass optimization
 682     public float getFloat(Object obj)
 683         throws IllegalArgumentException, IllegalAccessException
 684     {
 685         if (!override) {
 686             Class<?> caller = Reflection.getCallerClass();
 687             checkAccess(caller, obj);
 688             return getFieldAccessor().getFloat(obj);
 689         } else {
 690             return getOverrideFieldAccessor().getFloat(obj);
 691         }
 692     }
 693 
 694     /**
 695      * Gets the value of a static or instance field of type
 696      * {@code double} or of another primitive type convertible to
 697      * type {@code double} via a widening conversion.
 698      *
 699      * @param obj the object to extract the {@code double} value
 700      * from
 701      * @return the value of the field converted to type {@code double}
 702      *
 703      * @throws    IllegalAccessException    if this {@code Field} object
 704      *              is enforcing Java language access control and the underlying
 705      *              field is inaccessible.
 706      * @throws    IllegalArgumentException  if the specified object is not
 707      *              an instance of the class or interface declaring the
 708      *              underlying field (or a subclass or implementor
 709      *              thereof), or if the field value cannot be
 710      *              converted to the type {@code double} by a
 711      *              widening conversion.
 712      * @throws    NullPointerException      if the specified object is null
 713      *              and the field is an instance field.
 714      * @throws    ExceptionInInitializerError if the initialization provoked
 715      *              by this method fails.
 716      * @see       Field#get
 717      */
 718     @CallerSensitive
 719     @ForceInline // to ensure Reflection.getCallerClass optimization
 720     public double getDouble(Object obj)
 721         throws IllegalArgumentException, IllegalAccessException
 722     {
 723         if (!override) {
 724             Class<?> caller = Reflection.getCallerClass();
 725             checkAccess(caller, obj);
 726             return getFieldAccessor().getDouble(obj);
 727         } else {
 728             return getOverrideFieldAccessor().getDouble(obj);
 729         }
 730     }
 731 
 732     /**
 733      * Sets the field represented by this {@code Field} object on the
 734      * specified object argument to the specified new value. The new
 735      * value is automatically unwrapped if the underlying field has a
 736      * primitive type.
 737      *
 738      * <p>The operation proceeds as follows:
 739      *
 740      * <p>If the underlying field is static, the {@code obj} argument is
 741      * ignored; it may be null.
 742      *
 743      * <p>Otherwise the underlying field is an instance field.  If the
 744      * specified object argument is null, the method throws a
 745      * {@code NullPointerException}.  If the specified object argument is not
 746      * an instance of the class or interface declaring the underlying
 747      * field, the method throws an {@code IllegalArgumentException}.
 748      *
 749      * <p>If this {@code Field} object is enforcing Java language access control, and
 750      * the underlying field is inaccessible, the method throws an
 751      * {@code IllegalAccessException}.
 752      *
 753      * <p>If the underlying field is final, this {@code Field} object has
 754      * <em>write</em> access if and only if the following conditions are met:
 755      * <ul>
 756      * <li>{@link #setAccessible(boolean) setAccessible(true)} has succeeded for
 757      *     this {@code Field} object;</li>
 758      * <li>the field is non-static; and</li>
 759      * <li>the field's declaring class is not a {@linkplain Class#isHidden()
 760      *     hidden class}; and</li>
 761      * <li>the field's declaring class is not a {@linkplain Class#isRecord()
 762      *     record class}.</li>
 763      * </ul>
 764      * If any of the above checks is not met, this method throws an
 765      * {@code IllegalAccessException}.
 766      *
 767      * <p> Setting a final field in this way
 768      * is meaningful only during deserialization or reconstruction of
 769      * instances of classes with blank final fields, before they are
 770      * made available for access by other parts of a program. Use in
 771      * any other context may have unpredictable effects, including cases
 772      * in which other parts of a program continue to use the original
 773      * value of this field.
 774      *
 775      * <p>If the underlying field is of a primitive type, an unwrapping
 776      * conversion is attempted to convert the new value to a value of
 777      * a primitive type.  If this attempt fails, the method throws an
 778      * {@code IllegalArgumentException}.
 779      *
 780      * <p>If, after possible unwrapping, the new value cannot be
 781      * converted to the type of the underlying field by an identity or
 782      * widening conversion, the method throws an
 783      * {@code IllegalArgumentException}.
 784      *
 785      * <p>If the underlying field is static, the class that declared the
 786      * field is initialized if it has not already been initialized.
 787      *
 788      * <p>The field is set to the possibly unwrapped and widened new value.
 789      *
 790      * <p>If the field is hidden in the type of {@code obj},
 791      * the field's value is set according to the preceding rules.
 792      *
 793      * @param obj the object whose field should be modified
 794      * @param value the new value for the field of {@code obj}
 795      * being modified
 796      *
 797      * @throws    IllegalAccessException    if this {@code Field} object
 798      *              is enforcing Java language access control and the underlying
 799      *              field is inaccessible or final;
 800      *              or if this {@code Field} object has no write access.
 801      * @throws    IllegalArgumentException  if the specified object is not an
 802      *              instance of the class or interface declaring the underlying
 803      *              field (or a subclass or implementor thereof),
 804      *              or if an unwrapping conversion fails.
 805      * @throws    NullPointerException      if the specified object is null
 806      *              and the field is an instance field.
 807      * @throws    ExceptionInInitializerError if the initialization provoked
 808      *              by this method fails.
 809      */
 810     @CallerSensitive
 811     @ForceInline // to ensure Reflection.getCallerClass optimization
 812     public void set(Object obj, Object value)
 813         throws IllegalArgumentException, IllegalAccessException
 814     {
 815         if (!override) {
 816             Class<?> caller = Reflection.getCallerClass();
 817             checkAccess(caller, obj);
 818             getFieldAccessor().set(obj, value);
 819         } else {
 820             getOverrideFieldAccessor().set(obj, value);
 821         }
 822     }
 823 
 824     /**
 825      * Sets the value of a field as a {@code boolean} on the specified object.
 826      * This method is equivalent to
 827      * {@code set(obj, zObj)},
 828      * where {@code zObj} is a {@code Boolean} object and
 829      * {@code zObj.booleanValue() == z}.
 830      *
 831      * @param obj the object whose field should be modified
 832      * @param z   the new value for the field of {@code obj}
 833      * being modified
 834      *
 835      * @throws    IllegalAccessException    if this {@code Field} object
 836      *              is enforcing Java language access control and the underlying
 837      *              field is either inaccessible or final;
 838      *              or if this {@code Field} object has no write access.
 839      * @throws    IllegalArgumentException  if the specified object is not an
 840      *              instance of the class or interface declaring the underlying
 841      *              field (or a subclass or implementor thereof),
 842      *              or if an unwrapping conversion fails.
 843      * @throws    NullPointerException      if the specified object is null
 844      *              and the field is an instance field.
 845      * @throws    ExceptionInInitializerError if the initialization provoked
 846      *              by this method fails.
 847      * @see       Field#set
 848      */
 849     @CallerSensitive
 850     @ForceInline // to ensure Reflection.getCallerClass optimization
 851     public void setBoolean(Object obj, boolean z)
 852         throws IllegalArgumentException, IllegalAccessException
 853     {
 854         if (!override) {
 855             Class<?> caller = Reflection.getCallerClass();
 856             checkAccess(caller, obj);
 857             getFieldAccessor().setBoolean(obj, z);
 858         } else {
 859             getOverrideFieldAccessor().setBoolean(obj, z);
 860         }
 861     }
 862 
 863     /**
 864      * Sets the value of a field as a {@code byte} on the specified object.
 865      * This method is equivalent to
 866      * {@code set(obj, bObj)},
 867      * where {@code bObj} is a {@code Byte} object and
 868      * {@code bObj.byteValue() == b}.
 869      *
 870      * @param obj the object whose field should be modified
 871      * @param b   the new value for the field of {@code obj}
 872      * being modified
 873      *
 874      * @throws    IllegalAccessException    if this {@code Field} object
 875      *              is enforcing Java language access control and the underlying
 876      *              field is either inaccessible or final;
 877      *              or if this {@code Field} object has no write access.
 878      * @throws    IllegalArgumentException  if the specified object is not an
 879      *              instance of the class or interface declaring the underlying
 880      *              field (or a subclass or implementor thereof),
 881      *              or if an unwrapping conversion fails.
 882      * @throws    NullPointerException      if the specified object is null
 883      *              and the field is an instance field.
 884      * @throws    ExceptionInInitializerError if the initialization provoked
 885      *              by this method fails.
 886      * @see       Field#set
 887      */
 888     @CallerSensitive
 889     @ForceInline // to ensure Reflection.getCallerClass optimization
 890     public void setByte(Object obj, byte b)
 891         throws IllegalArgumentException, IllegalAccessException
 892     {
 893         if (!override) {
 894             Class<?> caller = Reflection.getCallerClass();
 895             checkAccess(caller, obj);
 896             getFieldAccessor().setByte(obj, b);
 897         } else {
 898             getOverrideFieldAccessor().setByte(obj, b);
 899         }
 900     }
 901 
 902     /**
 903      * Sets the value of a field as a {@code char} on the specified object.
 904      * This method is equivalent to
 905      * {@code set(obj, cObj)},
 906      * where {@code cObj} is a {@code Character} object and
 907      * {@code cObj.charValue() == c}.
 908      *
 909      * @param obj the object whose field should be modified
 910      * @param c   the new value for the field of {@code obj}
 911      * being modified
 912      *
 913      * @throws    IllegalAccessException    if this {@code Field} object
 914      *              is enforcing Java language access control and the underlying
 915      *              field is either inaccessible or final;
 916      *              or if this {@code Field} object has no write access.
 917      * @throws    IllegalArgumentException  if the specified object is not an
 918      *              instance of the class or interface declaring the underlying
 919      *              field (or a subclass or implementor thereof),
 920      *              or if an unwrapping conversion fails.
 921      * @throws    NullPointerException      if the specified object is null
 922      *              and the field is an instance field.
 923      * @throws    ExceptionInInitializerError if the initialization provoked
 924      *              by this method fails.
 925      * @see       Field#set
 926      */
 927     @CallerSensitive
 928     @ForceInline // to ensure Reflection.getCallerClass optimization
 929     public void setChar(Object obj, char c)
 930         throws IllegalArgumentException, IllegalAccessException
 931     {
 932         if (!override) {
 933             Class<?> caller = Reflection.getCallerClass();
 934             checkAccess(caller, obj);
 935             getFieldAccessor().setChar(obj, c);
 936         } else {
 937             getOverrideFieldAccessor().setChar(obj, c);
 938         }
 939     }
 940 
 941     /**
 942      * Sets the value of a field as a {@code short} on the specified object.
 943      * This method is equivalent to
 944      * {@code set(obj, sObj)},
 945      * where {@code sObj} is a {@code Short} object and
 946      * {@code sObj.shortValue() == s}.
 947      *
 948      * @param obj the object whose field should be modified
 949      * @param s   the new value for the field of {@code obj}
 950      * being modified
 951      *
 952      * @throws    IllegalAccessException    if this {@code Field} object
 953      *              is enforcing Java language access control and the underlying
 954      *              field is either inaccessible or final;
 955      *              or if this {@code Field} object has no write access.
 956      * @throws    IllegalArgumentException  if the specified object is not an
 957      *              instance of the class or interface declaring the underlying
 958      *              field (or a subclass or implementor thereof),
 959      *              or if an unwrapping conversion fails.
 960      * @throws    NullPointerException      if the specified object is null
 961      *              and the field is an instance field.
 962      * @throws    ExceptionInInitializerError if the initialization provoked
 963      *              by this method fails.
 964      * @see       Field#set
 965      */
 966     @CallerSensitive
 967     @ForceInline // to ensure Reflection.getCallerClass optimization
 968     public void setShort(Object obj, short s)
 969         throws IllegalArgumentException, IllegalAccessException
 970     {
 971         if (!override) {
 972             Class<?> caller = Reflection.getCallerClass();
 973             checkAccess(caller, obj);
 974             getFieldAccessor().setShort(obj, s);
 975         } else {
 976             getOverrideFieldAccessor().setShort(obj, s);
 977         }
 978     }
 979 
 980     /**
 981      * Sets the value of a field as an {@code int} on the specified object.
 982      * This method is equivalent to
 983      * {@code set(obj, iObj)},
 984      * where {@code iObj} is an {@code Integer} object and
 985      * {@code iObj.intValue() == i}.
 986      *
 987      * @param obj the object whose field should be modified
 988      * @param i   the new value for the field of {@code obj}
 989      * being modified
 990      *
 991      * @throws    IllegalAccessException    if this {@code Field} object
 992      *              is enforcing Java language access control and the underlying
 993      *              field is either inaccessible or final;
 994      *              or if this {@code Field} object has no write access.
 995      * @throws    IllegalArgumentException  if the specified object is not an
 996      *              instance of the class or interface declaring the underlying
 997      *              field (or a subclass or implementor thereof),
 998      *              or if an unwrapping conversion fails.
 999      * @throws    NullPointerException      if the specified object is null
1000      *              and the field is an instance field.
1001      * @throws    ExceptionInInitializerError if the initialization provoked
1002      *              by this method fails.
1003      * @see       Field#set
1004      */
1005     @CallerSensitive
1006     @ForceInline // to ensure Reflection.getCallerClass optimization
1007     public void setInt(Object obj, int i)
1008         throws IllegalArgumentException, IllegalAccessException
1009     {
1010         if (!override) {
1011             Class<?> caller = Reflection.getCallerClass();
1012             checkAccess(caller, obj);
1013             getFieldAccessor().setInt(obj, i);
1014         } else {
1015             getOverrideFieldAccessor().setInt(obj, i);
1016         }
1017     }
1018 
1019     /**
1020      * Sets the value of a field as a {@code long} on the specified object.
1021      * This method is equivalent to
1022      * {@code set(obj, lObj)},
1023      * where {@code lObj} is a {@code Long} object and
1024      * {@code lObj.longValue() == l}.
1025      *
1026      * @param obj the object whose field should be modified
1027      * @param l   the new value for the field of {@code obj}
1028      * being modified
1029      *
1030      * @throws    IllegalAccessException    if this {@code Field} object
1031      *              is enforcing Java language access control and the underlying
1032      *              field is either inaccessible or final;
1033      *              or if this {@code Field} object has no write access.
1034      * @throws    IllegalArgumentException  if the specified object is not an
1035      *              instance of the class or interface declaring the underlying
1036      *              field (or a subclass or implementor thereof),
1037      *              or if an unwrapping conversion fails.
1038      * @throws    NullPointerException      if the specified object is null
1039      *              and the field is an instance field.
1040      * @throws    ExceptionInInitializerError if the initialization provoked
1041      *              by this method fails.
1042      * @see       Field#set
1043      */
1044     @CallerSensitive
1045     @ForceInline // to ensure Reflection.getCallerClass optimization
1046     public void setLong(Object obj, long l)
1047         throws IllegalArgumentException, IllegalAccessException
1048     {
1049         if (!override) {
1050             Class<?> caller = Reflection.getCallerClass();
1051             checkAccess(caller, obj);
1052             getFieldAccessor().setLong(obj, l);
1053         } else {
1054             getOverrideFieldAccessor().setLong(obj, l);
1055         }
1056     }
1057 
1058     /**
1059      * Sets the value of a field as a {@code float} on the specified object.
1060      * This method is equivalent to
1061      * {@code set(obj, fObj)},
1062      * where {@code fObj} is a {@code Float} object and
1063      * {@code fObj.floatValue() == f}.
1064      *
1065      * @param obj the object whose field should be modified
1066      * @param f   the new value for the field of {@code obj}
1067      * being modified
1068      *
1069      * @throws    IllegalAccessException    if this {@code Field} object
1070      *              is enforcing Java language access control and the underlying
1071      *              field is either inaccessible or final;
1072      *              or if this {@code Field} object has no write access.
1073      * @throws    IllegalArgumentException  if the specified object is not an
1074      *              instance of the class or interface declaring the underlying
1075      *              field (or a subclass or implementor thereof),
1076      *              or if an unwrapping conversion fails.
1077      * @throws    NullPointerException      if the specified object is null
1078      *              and the field is an instance field.
1079      * @throws    ExceptionInInitializerError if the initialization provoked
1080      *              by this method fails.
1081      * @see       Field#set
1082      */
1083     @CallerSensitive
1084     @ForceInline // to ensure Reflection.getCallerClass optimization
1085     public void setFloat(Object obj, float f)
1086         throws IllegalArgumentException, IllegalAccessException
1087     {
1088         if (!override) {
1089             Class<?> caller = Reflection.getCallerClass();
1090             checkAccess(caller, obj);
1091             getFieldAccessor().setFloat(obj, f);
1092         } else {
1093             getOverrideFieldAccessor().setFloat(obj, f);
1094         }
1095     }
1096 
1097     /**
1098      * Sets the value of a field as a {@code double} on the specified object.
1099      * This method is equivalent to
1100      * {@code set(obj, dObj)},
1101      * where {@code dObj} is a {@code Double} object and
1102      * {@code dObj.doubleValue() == d}.
1103      *
1104      * @param obj the object whose field should be modified
1105      * @param d   the new value for the field of {@code obj}
1106      * being modified
1107      *
1108      * @throws    IllegalAccessException    if this {@code Field} object
1109      *              is enforcing Java language access control and the underlying
1110      *              field is either inaccessible or final;
1111      *              or if this {@code Field} object has no write access.
1112      * @throws    IllegalArgumentException  if the specified object is not an
1113      *              instance of the class or interface declaring the underlying
1114      *              field (or a subclass or implementor thereof),
1115      *              or if an unwrapping conversion fails.
1116      * @throws    NullPointerException      if the specified object is null
1117      *              and the field is an instance field.
1118      * @throws    ExceptionInInitializerError if the initialization provoked
1119      *              by this method fails.
1120      * @see       Field#set
1121      */
1122     @CallerSensitive
1123     @ForceInline // to ensure Reflection.getCallerClass optimization
1124     public void setDouble(Object obj, double d)
1125         throws IllegalArgumentException, IllegalAccessException
1126     {
1127         if (!override) {
1128             Class<?> caller = Reflection.getCallerClass();
1129             checkAccess(caller, obj);
1130             getFieldAccessor().setDouble(obj, d);
1131         } else {
1132             getOverrideFieldAccessor().setDouble(obj, d);
1133         }
1134     }
1135 
1136     // check access to field
1137     private void checkAccess(Class<?> caller, Object obj)
1138         throws IllegalAccessException
1139     {
1140         checkAccess(caller, clazz,
1141                     Modifier.isStatic(modifiers) ? null : obj.getClass(),
1142                     modifiers);
1143     }
1144 
1145     // security check is done before calling this method
1146     private FieldAccessor getFieldAccessor() {
1147         FieldAccessor a = fieldAccessor;
1148         return (a != null) ? a : acquireFieldAccessor();
1149     }
1150 
1151     private FieldAccessor getOverrideFieldAccessor() {
1152         FieldAccessor a = overrideFieldAccessor;
1153         return (a != null) ? a : acquireOverrideFieldAccessor();
1154     }
1155 
1156     // NOTE that there is no synchronization used here. It is correct
1157     // (though not efficient) to generate more than one FieldAccessor
1158     // for a given Field. However, avoiding synchronization will
1159     // probably make the implementation more scalable.
1160     private FieldAccessor acquireFieldAccessor() {
1161         // First check to see if one has been created yet, and take it
1162         // if so
1163         Field root = this.root;
1164         FieldAccessor tmp = root == null ? null : root.fieldAccessor;
1165         if (tmp != null) {
1166             fieldAccessor = tmp;
1167         } else {
1168             // Otherwise fabricate one and propagate it up to the root
1169             tmp = reflectionFactory.newFieldAccessor(this, false);
1170             setFieldAccessor(tmp);
1171         }
1172         return tmp;
1173     }
1174 
1175     private FieldAccessor acquireOverrideFieldAccessor() {
1176         // First check to see if one has been created yet, and take it
1177         // if so
1178         Field root = this.root;
1179         FieldAccessor tmp = root == null ? null : root.overrideFieldAccessor;
1180         if (tmp != null) {
1181             overrideFieldAccessor = tmp;
1182         } else {
1183             // Otherwise fabricate one and propagate it up to the root
1184             tmp = reflectionFactory.newFieldAccessor(this, true);
1185             setOverrideFieldAccessor(tmp);
1186         }
1187         return tmp;
1188     }
1189 
1190     // Sets the fieldAccessor for this Field object and
1191     // (recursively) its root
1192     private void setFieldAccessor(FieldAccessor accessor) {
1193         fieldAccessor = accessor;
1194         // Propagate up
1195         Field root = this.root;
1196         if (root != null) {
1197             root.setFieldAccessor(accessor);
1198         }
1199     }
1200 
1201     // Sets the overrideFieldAccessor for this Field object and
1202     // (recursively) its root
1203     private void setOverrideFieldAccessor(FieldAccessor accessor) {
1204         overrideFieldAccessor = accessor;
1205         // Propagate up
1206         Field root = this.root;
1207         if (root != null) {
1208             root.setOverrideFieldAccessor(accessor);
1209         }
1210     }
1211 
1212     @Override
1213     /* package-private */ Field getRoot() {
1214         return root;
1215     }
1216 
1217     /* package-private */ boolean isTrustedFinal() {
1218         return trustedFinal;
1219     }
1220 
1221     /**
1222      * {@inheritDoc}
1223      *
1224      * @throws NullPointerException {@inheritDoc}
1225      * @since 1.5
1226      */
1227     @Override
1228     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
1229         Objects.requireNonNull(annotationClass);
1230         return annotationClass.cast(declaredAnnotations().get(annotationClass));
1231     }
1232 
1233     /**
1234      * {@inheritDoc}
1235      *
1236      * @throws NullPointerException {@inheritDoc}
1237      * @since 1.8
1238      */
1239     @Override
1240     public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
1241         Objects.requireNonNull(annotationClass);
1242 
1243         return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
1244     }
1245 
1246     /**
1247      * {@inheritDoc}
1248      */
1249     @Override
1250     public Annotation[] getDeclaredAnnotations()  {
1251         return AnnotationParser.toArray(declaredAnnotations());
1252     }
1253 
1254     private transient volatile Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
1255 
1256     private Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
1257         Map<Class<? extends Annotation>, Annotation> declAnnos;
1258         if ((declAnnos = declaredAnnotations) == null) {
1259             synchronized (this) {
1260                 if ((declAnnos = declaredAnnotations) == null) {
1261                     Field root = this.root;
1262                     if (root != null) {
1263                         declAnnos = root.declaredAnnotations();
1264                     } else {
1265                         declAnnos = AnnotationParser.parseAnnotations(
1266                                 annotations,
1267                                 SharedSecrets.getJavaLangAccess()
1268                                         .getConstantPool(getDeclaringClass()),
1269                                 getDeclaringClass());
1270                     }
1271                     declaredAnnotations = declAnnos;
1272                 }
1273             }
1274         }
1275         return declAnnos;
1276     }
1277 
1278     private native byte[] getTypeAnnotationBytes0();
1279 
1280     /**
1281      * Returns an AnnotatedType object that represents the use of a type to specify
1282      * the declared type of the field represented by this Field.
1283      * @return an object representing the declared type of the field
1284      * represented by this Field
1285      *
1286      * @since 1.8
1287      */
1288     public AnnotatedType getAnnotatedType() {
1289         return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
1290                                                        SharedSecrets.getJavaLangAccess().
1291                                                            getConstantPool(getDeclaringClass()),
1292                                                        this,
1293                                                        getDeclaringClass(),
1294                                                        getGenericType(),
1295                                                        TypeAnnotation.TypeAnnotationTarget.FIELD);
1296 }
1297 }