src/share/classes/java/lang/reflect/Field.java

Print this page

        

@@ -79,12 +79,10 @@
     private FieldAccessor overrideFieldAccessor;
     // For sharing of FieldAccessors. This branching structure is
     // currently only two levels deep (i.e., one root Field and
     // potentially many Field objects pointing to it.)
     private Field               root;
-    // This is set by the vm at Field creation
-    private byte[]              typeAnnotations;
 
     // Generics infrastructure
 
     private String getGenericSignature() {return signature;}
 

@@ -146,11 +144,10 @@
         res.root = this;
         // Might as well eagerly propagate this if already present
         res.fieldAccessor = fieldAccessor;
         res.overrideFieldAccessor = overrideFieldAccessor;
 
-        res.typeAnnotations = typeAnnotations;
         return res;
     }
 
     /**
      * Returns the {@code Class} object representing the class or interface

@@ -1053,18 +1050,20 @@
                 getDeclaringClass());
         }
         return declaredAnnotations;
     }
 
+    private native byte[] getTypeAnnotationBytes0();
+
     /**
      * Returns an AnnotatedType object that represents the use of a type to specify
      * the declared type of the field represented by this Field.
      *
      * @since 1.8
      */
     public AnnotatedType getAnnotatedType() {
-        return TypeAnnotationParser.buildAnnotatedType(typeAnnotations,
+        return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
                                                        sun.misc.SharedSecrets.getJavaLangAccess().
                                                            getConstantPool(getDeclaringClass()),
                                                        this,
                                                        getDeclaringClass(),
                                                        getGenericType(),