8198717: Remove compute_optional_offset
authorcoleenp
Wed, 19 Sep 2018 15:25:05 -0400
changeset 51807 3221f5e14866
parent 51806 1ecc914fb707
child 51808 3f32076a43a6
8198717: Remove compute_optional_offset Summary: remove optional_offset computation and related unused code from javaClasses for reflection. Reviewed-by: redestad, lfoltan
src/hotspot/share/classfile/javaClasses.cpp
src/hotspot/share/classfile/javaClasses.hpp
src/hotspot/share/runtime/reflection.cpp
--- a/src/hotspot/share/classfile/javaClasses.cpp	Wed Sep 19 21:31:33 2018 +0200
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Wed Sep 19 15:25:05 2018 -0400
@@ -86,7 +86,6 @@
   return _injected_fields[id].compute_offset();
 }
 
-
 InjectedField* JavaClasses::get_injected(Symbol* class_name, int* field_count) {
   *field_count = 0;
 
@@ -156,18 +155,6 @@
   compute_offset(dest_offset, ik, name, signature_symbol, is_static);
 }
 
-// Same as above but for "optional" offsets that might not be present in certain JDK versions
-// Old versions should be cleaned out since Hotspot only supports the current JDK, and this
-// function should be removed.
-static void
-compute_optional_offset(int& dest_offset,
-                        InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol) {
-  fieldDescriptor fd;
-  if (ik->find_local_field(name_symbol, signature_symbol, &fd)) {
-    dest_offset = fd.offset();
-  }
-}
-
 int java_lang_String::value_offset  = 0;
 int java_lang_String::hash_offset   = 0;
 int java_lang_String::coder_offset  = 0;
@@ -181,17 +168,11 @@
 #if INCLUDE_CDS
 #define FIELD_SERIALIZE_OFFSET(offset, klass, name, signature, is_static) \
   f->do_u4((u4*)&offset)
-
-#define FIELD_SERIALIZE_OFFSET_OPTIONAL(offset, klass, name, signature) \
-  f->do_u4((u4*)&offset)
 #endif
 
 #define FIELD_COMPUTE_OFFSET(offset, klass, name, signature, is_static) \
   compute_offset(offset, klass, name, vmSymbols::signature(), is_static)
 
-#define FIELD_COMPUTE_OFFSET_OPTIONAL(offset, klass, name, signature) \
-  compute_optional_offset(offset, klass, name, vmSymbols::signature())
-
 #define STRING_FIELDS_DO(macro) \
   macro(value_offset, k, vmSymbols::value_name(), byte_array_signature, false); \
   macro(hash_offset,  k, "hash",                  int_signature,        false); \
@@ -2735,20 +2716,13 @@
   macro(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), class_array_signature, false); \
   macro(slot_offset,           k, vmSymbols::slot_name(),           int_signature,         false); \
   macro(modifiers_offset,      k, vmSymbols::modifiers_name(),      int_signature,         false); \
-  macro##_OPTIONAL(signature_offset,             k, vmSymbols::signature_name(),             string_signature); \
-  macro##_OPTIONAL(annotations_offset,           k, vmSymbols::annotations_name(),           byte_array_signature); \
-  macro##_OPTIONAL(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), byte_array_signature); \
-  macro##_OPTIONAL(annotation_default_offset,    k, vmSymbols::annotation_default_name(),    byte_array_signature); \
-  macro##_OPTIONAL(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      byte_array_signature)
+  macro(signature_offset,             k, vmSymbols::signature_name(),             string_signature,     false); \
+  macro(annotations_offset,           k, vmSymbols::annotations_name(),           byte_array_signature, false); \
+  macro(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), byte_array_signature, false); \
+  macro(annotation_default_offset,    k, vmSymbols::annotation_default_name(),    byte_array_signature, false);
 
 void java_lang_reflect_Method::compute_offsets() {
   InstanceKlass* k = SystemDictionary::reflect_Method_klass();
-  // The generic signature and annotations fields are only present in 1.5
-  signature_offset = -1;
-  annotations_offset = -1;
-  parameter_annotations_offset = -1;
-  annotation_default_offset = -1;
-  type_annotations_offset = -1;
   METHOD_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 }
 
@@ -2787,11 +2761,6 @@
   reflect->int_field_put(slot_offset, value);
 }
 
-oop java_lang_reflect_Method::name(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  return method->obj_field(name_offset);
-}
-
 void java_lang_reflect_Method::set_name(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   method->obj_field_put(name_offset, value);
@@ -2817,125 +2786,48 @@
   method->obj_field_put(parameterTypes_offset, value);
 }
 
-oop java_lang_reflect_Method::exception_types(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  return method->obj_field(exceptionTypes_offset);
-}
-
 void java_lang_reflect_Method::set_exception_types(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   method->obj_field_put(exceptionTypes_offset, value);
 }
 
-int java_lang_reflect_Method::modifiers(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  return method->int_field(modifiers_offset);
-}
-
 void java_lang_reflect_Method::set_modifiers(oop method, int value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   method->int_field_put(modifiers_offset, value);
 }
 
-bool java_lang_reflect_Method::has_signature_field() {
-  return (signature_offset >= 0);
-}
-
-oop java_lang_reflect_Method::signature(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
-  return method->obj_field(signature_offset);
-}
-
 void java_lang_reflect_Method::set_signature(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
   method->obj_field_put(signature_offset, value);
 }
 
-bool java_lang_reflect_Method::has_annotations_field() {
-  return (annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Method::annotations(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
-  return method->obj_field(annotations_offset);
-}
-
 void java_lang_reflect_Method::set_annotations(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
   method->obj_field_put(annotations_offset, value);
 }
 
-bool java_lang_reflect_Method::has_parameter_annotations_field() {
-  return (parameter_annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Method::parameter_annotations(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_parameter_annotations_field(), "parameter annotations field must be present");
-  return method->obj_field(parameter_annotations_offset);
-}
-
 void java_lang_reflect_Method::set_parameter_annotations(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_parameter_annotations_field(), "parameter annotations field must be present");
   method->obj_field_put(parameter_annotations_offset, value);
 }
 
-bool java_lang_reflect_Method::has_annotation_default_field() {
-  return (annotation_default_offset >= 0);
-}
-
-oop java_lang_reflect_Method::annotation_default(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotation_default_field(), "annotation default field must be present");
-  return method->obj_field(annotation_default_offset);
-}
-
 void java_lang_reflect_Method::set_annotation_default(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotation_default_field(), "annotation default field must be present");
   method->obj_field_put(annotation_default_offset, value);
 }
 
-bool java_lang_reflect_Method::has_type_annotations_field() {
-  return (type_annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Method::type_annotations(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  return method->obj_field(type_annotations_offset);
-}
-
-void java_lang_reflect_Method::set_type_annotations(oop method, oop value) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  method->obj_field_put(type_annotations_offset, value);
-}
-
 #define CONSTRUCTOR_FIELDS_DO(macro) \
   macro(clazz_offset,          k, vmSymbols::clazz_name(),          class_signature,       false); \
   macro(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), class_array_signature, false); \
   macro(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), class_array_signature, false); \
   macro(slot_offset,           k, vmSymbols::slot_name(),           int_signature,         false); \
   macro(modifiers_offset,      k, vmSymbols::modifiers_name(),      int_signature,         false); \
-  macro##_OPTIONAL(signature_offset,             k, vmSymbols::signature_name(),             string_signature); \
-  macro##_OPTIONAL(annotations_offset,           k, vmSymbols::annotations_name(),           byte_array_signature); \
-  macro##_OPTIONAL(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), byte_array_signature); \
-  macro##_OPTIONAL(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      byte_array_signature)
-
+  macro(signature_offset,             k, vmSymbols::signature_name(),             string_signature,     false); \
+  macro(annotations_offset,           k, vmSymbols::annotations_name(),           byte_array_signature, false); \
+  macro(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), byte_array_signature, false);
 
 void java_lang_reflect_Constructor::compute_offsets() {
   InstanceKlass* k = SystemDictionary::reflect_Constructor_klass();
-  // The generic signature and annotations fields are only present in 1.5
-  signature_offset = -1;
-  annotations_offset = -1;
-  parameter_annotations_offset = -1;
-  type_annotations_offset = -1;
   CONSTRUCTOR_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 }
 
@@ -2975,11 +2867,6 @@
   constructor->obj_field_put(parameterTypes_offset, value);
 }
 
-oop java_lang_reflect_Constructor::exception_types(oop constructor) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  return constructor->obj_field(exceptionTypes_offset);
-}
-
 void java_lang_reflect_Constructor::set_exception_types(oop constructor, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   constructor->obj_field_put(exceptionTypes_offset, value);
@@ -2995,96 +2882,37 @@
   reflect->int_field_put(slot_offset, value);
 }
 
-int java_lang_reflect_Constructor::modifiers(oop constructor) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  return constructor->int_field(modifiers_offset);
-}
-
 void java_lang_reflect_Constructor::set_modifiers(oop constructor, int value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   constructor->int_field_put(modifiers_offset, value);
 }
 
-bool java_lang_reflect_Constructor::has_signature_field() {
-  return (signature_offset >= 0);
-}
-
-oop java_lang_reflect_Constructor::signature(oop constructor) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
-  return constructor->obj_field(signature_offset);
-}
-
 void java_lang_reflect_Constructor::set_signature(oop constructor, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
   constructor->obj_field_put(signature_offset, value);
 }
 
-bool java_lang_reflect_Constructor::has_annotations_field() {
-  return (annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Constructor::annotations(oop constructor) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
-  return constructor->obj_field(annotations_offset);
-}
-
 void java_lang_reflect_Constructor::set_annotations(oop constructor, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
   constructor->obj_field_put(annotations_offset, value);
 }
 
-bool java_lang_reflect_Constructor::has_parameter_annotations_field() {
-  return (parameter_annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Constructor::parameter_annotations(oop method) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_parameter_annotations_field(), "parameter annotations field must be present");
-  return method->obj_field(parameter_annotations_offset);
-}
-
 void java_lang_reflect_Constructor::set_parameter_annotations(oop method, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_parameter_annotations_field(), "parameter annotations field must be present");
   method->obj_field_put(parameter_annotations_offset, value);
 }
 
-bool java_lang_reflect_Constructor::has_type_annotations_field() {
-  return (type_annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Constructor::type_annotations(oop constructor) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  return constructor->obj_field(type_annotations_offset);
-}
-
-void java_lang_reflect_Constructor::set_type_annotations(oop constructor, oop value) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  constructor->obj_field_put(type_annotations_offset, value);
-}
-
 #define FIELD_FIELDS_DO(macro) \
   macro(clazz_offset,     k, vmSymbols::clazz_name(),     class_signature,  false); \
   macro(name_offset,      k, vmSymbols::name_name(),      string_signature, false); \
   macro(type_offset,      k, vmSymbols::type_name(),      class_signature,  false); \
   macro(slot_offset,      k, vmSymbols::slot_name(),      int_signature,    false); \
   macro(modifiers_offset, k, vmSymbols::modifiers_name(), int_signature,    false); \
-  macro##_OPTIONAL(signature_offset,        k, vmSymbols::signature_name(), string_signature); \
-  macro##_OPTIONAL(annotations_offset,      k, vmSymbols::annotations_name(),  byte_array_signature); \
-  macro##_OPTIONAL(type_annotations_offset, k, vmSymbols::type_annotations_name(),  byte_array_signature)
+  macro(signature_offset,        k, vmSymbols::signature_name(),        string_signature,     false); \
+  macro(annotations_offset,      k, vmSymbols::annotations_name(),      byte_array_signature, false);
 
 void java_lang_reflect_Field::compute_offsets() {
   InstanceKlass* k = SystemDictionary::reflect_Field_klass();
-  // The generic signature and annotations fields are only present in 1.5
-  signature_offset = -1;
-  annotations_offset = -1;
-  type_annotations_offset = -1;
   FIELD_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 }
 
@@ -3154,54 +2982,16 @@
   field->int_field_put(modifiers_offset, value);
 }
 
-bool java_lang_reflect_Field::has_signature_field() {
-  return (signature_offset >= 0);
-}
-
-oop java_lang_reflect_Field::signature(oop field) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
-  return field->obj_field(signature_offset);
-}
-
 void java_lang_reflect_Field::set_signature(oop field, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_signature_field(), "signature field must be present");
   field->obj_field_put(signature_offset, value);
 }
 
-bool java_lang_reflect_Field::has_annotations_field() {
-  return (annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Field::annotations(oop field) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
-  return field->obj_field(annotations_offset);
-}
-
 void java_lang_reflect_Field::set_annotations(oop field, oop value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_annotations_field(), "annotations field must be present");
   field->obj_field_put(annotations_offset, value);
 }
 
-bool java_lang_reflect_Field::has_type_annotations_field() {
-  return (type_annotations_offset >= 0);
-}
-
-oop java_lang_reflect_Field::type_annotations(oop field) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  return field->obj_field(type_annotations_offset);
-}
-
-void java_lang_reflect_Field::set_type_annotations(oop field, oop value) {
-  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
-  assert(has_type_annotations_field(), "type_annotations field must be present");
-  field->obj_field_put(type_annotations_offset, value);
-}
-
 #define CONSTANTPOOL_FIELDS_DO(macro) \
   macro(_oop_offset, k, "constantPoolOop", object_signature, false)
 
@@ -4219,7 +4009,6 @@
 int java_lang_reflect_Method::annotations_offset;
 int java_lang_reflect_Method::parameter_annotations_offset;
 int java_lang_reflect_Method::annotation_default_offset;
-int java_lang_reflect_Method::type_annotations_offset;
 int java_lang_reflect_Constructor::clazz_offset;
 int java_lang_reflect_Constructor::parameterTypes_offset;
 int java_lang_reflect_Constructor::exceptionTypes_offset;
@@ -4228,7 +4017,6 @@
 int java_lang_reflect_Constructor::signature_offset;
 int java_lang_reflect_Constructor::annotations_offset;
 int java_lang_reflect_Constructor::parameter_annotations_offset;
-int java_lang_reflect_Constructor::type_annotations_offset;
 int java_lang_reflect_Field::clazz_offset;
 int java_lang_reflect_Field::name_offset;
 int java_lang_reflect_Field::type_offset;
@@ -4236,7 +4024,6 @@
 int java_lang_reflect_Field::modifiers_offset;
 int java_lang_reflect_Field::signature_offset;
 int java_lang_reflect_Field::annotations_offset;
-int java_lang_reflect_Field::type_annotations_offset;
 int java_lang_reflect_Parameter::name_offset;
 int java_lang_reflect_Parameter::modifiers_offset;
 int java_lang_reflect_Parameter::index_offset;
--- a/src/hotspot/share/classfile/javaClasses.hpp	Wed Sep 19 21:31:33 2018 +0200
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Wed Sep 19 15:25:05 2018 -0400
@@ -602,10 +602,8 @@
   static int annotations_offset;
   static int parameter_annotations_offset;
   static int annotation_default_offset;
-  static int type_annotations_offset;
 
   static void compute_offsets();
-
  public:
   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 
@@ -616,7 +614,6 @@
   static oop clazz(oop reflect);
   static void set_clazz(oop reflect, oop value);
 
-  static oop name(oop method);
   static void set_name(oop method, oop value);
 
   static oop return_type(oop method);
@@ -625,35 +622,16 @@
   static oop parameter_types(oop method);
   static void set_parameter_types(oop method, oop value);
 
-  static oop exception_types(oop method);
-  static void set_exception_types(oop method, oop value);
-
   static int slot(oop reflect);
   static void set_slot(oop reflect, int value);
 
-  static int modifiers(oop method);
+  static void set_exception_types(oop method, oop value);
   static void set_modifiers(oop method, int value);
-
-  static bool has_signature_field();
-  static oop signature(oop method);
   static void set_signature(oop method, oop value);
-
-  static bool has_annotations_field();
-  static oop annotations(oop method);
   static void set_annotations(oop method, oop value);
-
-  static bool has_parameter_annotations_field();
-  static oop parameter_annotations(oop method);
   static void set_parameter_annotations(oop method, oop value);
-
-  static bool has_annotation_default_field();
-  static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
-  static bool has_type_annotations_field();
-  static oop type_annotations(oop method);
-  static void set_type_annotations(oop method, oop value);
-
   // Debugging
   friend class JavaClasses;
 };
@@ -673,10 +651,8 @@
   static int signature_offset;
   static int annotations_offset;
   static int parameter_annotations_offset;
-  static int type_annotations_offset;
 
   static void compute_offsets();
-
  public:
   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 
@@ -690,31 +666,15 @@
   static oop parameter_types(oop constructor);
   static void set_parameter_types(oop constructor, oop value);
 
-  static oop exception_types(oop constructor);
-  static void set_exception_types(oop constructor, oop value);
-
   static int slot(oop reflect);
   static void set_slot(oop reflect, int value);
 
-  static int modifiers(oop constructor);
+  static void set_exception_types(oop constructor, oop value);
   static void set_modifiers(oop constructor, int value);
-
-  static bool has_signature_field();
-  static oop signature(oop constructor);
   static void set_signature(oop constructor, oop value);
-
-  static bool has_annotations_field();
-  static oop annotations(oop constructor);
   static void set_annotations(oop constructor, oop value);
-
-  static bool has_parameter_annotations_field();
-  static oop parameter_annotations(oop method);
   static void set_parameter_annotations(oop method, oop value);
 
-  static bool has_type_annotations_field();
-  static oop type_annotations(oop constructor);
-  static void set_type_annotations(oop constructor, oop value);
-
   // Debugging
   friend class JavaClasses;
 };
@@ -733,7 +693,6 @@
   static int modifiers_offset;
   static int signature_offset;
   static int annotations_offset;
-  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -759,26 +718,11 @@
   static int modifiers(oop field);
   static void set_modifiers(oop field, int value);
 
-  static bool has_signature_field();
-  static oop signature(oop constructor);
   static void set_signature(oop constructor, oop value);
-
-  static bool has_annotations_field();
-  static oop annotations(oop constructor);
   static void set_annotations(oop constructor, oop value);
-
-  static bool has_parameter_annotations_field();
-  static oop parameter_annotations(oop method);
   static void set_parameter_annotations(oop method, oop value);
-
-  static bool has_annotation_default_field();
-  static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
-  static bool has_type_annotations_field();
-  static oop type_annotations(oop field);
-  static void set_type_annotations(oop field, oop value);
-
   // Debugging
   friend class JavaClasses;
 };
--- a/src/hotspot/share/runtime/reflection.cpp	Wed Sep 19 21:31:33 2018 +0200
+++ b/src/hotspot/share/runtime/reflection.cpp	Wed Sep 19 15:25:05 2018 -0400
@@ -898,28 +898,17 @@
   java_lang_reflect_Method::set_exception_types(mh(), exception_types());
   java_lang_reflect_Method::set_modifiers(mh(), modifiers);
   java_lang_reflect_Method::set_override(mh(), false);
-  if (java_lang_reflect_Method::has_signature_field() &&
-      method->generic_signature() != NULL) {
+  if (method->generic_signature() != NULL) {
     Symbol*  gs = method->generic_signature();
     Handle sig = java_lang_String::create_from_symbol(gs, CHECK_NULL);
     java_lang_reflect_Method::set_signature(mh(), sig());
   }
-  if (java_lang_reflect_Method::has_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->annotations(), CHECK_NULL);
-    java_lang_reflect_Method::set_annotations(mh(), an_oop);
-  }
-  if (java_lang_reflect_Method::has_parameter_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->parameter_annotations(), CHECK_NULL);
-    java_lang_reflect_Method::set_parameter_annotations(mh(), an_oop);
-  }
-  if (java_lang_reflect_Method::has_annotation_default_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->annotation_default(), CHECK_NULL);
-    java_lang_reflect_Method::set_annotation_default(mh(), an_oop);
-  }
-  if (java_lang_reflect_Method::has_type_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->type_annotations(), CHECK_NULL);
-    java_lang_reflect_Method::set_type_annotations(mh(), an_oop);
-  }
+  typeArrayOop an_oop = Annotations::make_java_array(method->annotations(), CHECK_NULL);
+  java_lang_reflect_Method::set_annotations(mh(), an_oop);
+  an_oop = Annotations::make_java_array(method->parameter_annotations(), CHECK_NULL);
+  java_lang_reflect_Method::set_parameter_annotations(mh(), an_oop);
+  an_oop = Annotations::make_java_array(method->annotation_default(), CHECK_NULL);
+  java_lang_reflect_Method::set_annotation_default(mh(), an_oop);
   return mh();
 }
 
@@ -948,24 +937,15 @@
   java_lang_reflect_Constructor::set_exception_types(ch(), exception_types());
   java_lang_reflect_Constructor::set_modifiers(ch(), modifiers);
   java_lang_reflect_Constructor::set_override(ch(), false);
-  if (java_lang_reflect_Constructor::has_signature_field() &&
-      method->generic_signature() != NULL) {
+  if (method->generic_signature() != NULL) {
     Symbol*  gs = method->generic_signature();
     Handle sig = java_lang_String::create_from_symbol(gs, CHECK_NULL);
     java_lang_reflect_Constructor::set_signature(ch(), sig());
   }
-  if (java_lang_reflect_Constructor::has_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->annotations(), CHECK_NULL);
-    java_lang_reflect_Constructor::set_annotations(ch(), an_oop);
-  }
-  if (java_lang_reflect_Constructor::has_parameter_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->parameter_annotations(), CHECK_NULL);
-    java_lang_reflect_Constructor::set_parameter_annotations(ch(), an_oop);
-  }
-  if (java_lang_reflect_Constructor::has_type_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(method->type_annotations(), CHECK_NULL);
-    java_lang_reflect_Constructor::set_type_annotations(ch(), an_oop);
-  }
+  typeArrayOop an_oop = Annotations::make_java_array(method->annotations(), CHECK_NULL);
+  java_lang_reflect_Constructor::set_annotations(ch(), an_oop);
+  an_oop = Annotations::make_java_array(method->parameter_annotations(), CHECK_NULL);
+  java_lang_reflect_Constructor::set_parameter_annotations(ch(), an_oop);
   return ch();
 }
 
@@ -986,20 +966,13 @@
   // Note the ACC_ANNOTATION bit, which is a per-class access flag, is never set here.
   java_lang_reflect_Field::set_modifiers(rh(), fd->access_flags().as_int() & JVM_RECOGNIZED_FIELD_MODIFIERS);
   java_lang_reflect_Field::set_override(rh(), false);
-  if (java_lang_reflect_Field::has_signature_field() &&
-      fd->has_generic_signature()) {
+  if (fd->has_generic_signature()) {
     Symbol*  gs = fd->generic_signature();
     Handle sig = java_lang_String::create_from_symbol(gs, CHECK_NULL);
     java_lang_reflect_Field::set_signature(rh(), sig());
   }
-  if (java_lang_reflect_Field::has_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(fd->annotations(), CHECK_NULL);
-    java_lang_reflect_Field::set_annotations(rh(), an_oop);
-  }
-  if (java_lang_reflect_Field::has_type_annotations_field()) {
-    typeArrayOop an_oop = Annotations::make_java_array(fd->type_annotations(), CHECK_NULL);
-    java_lang_reflect_Field::set_type_annotations(rh(), an_oop);
-  }
+  typeArrayOop an_oop = Annotations::make_java_array(fd->annotations(), CHECK_NULL);
+  java_lang_reflect_Field::set_annotations(rh(), an_oop);
   return rh();
 }