changeset 52953:dbbc3a422de6 amber-demo

Automatic merge with datum
author mcimadamore
date Thu, 01 Nov 2018 01:38:56 +0100
parents aa666a24f362 ad3177db8f2c
children 7d56987f69c2
files
diffstat 3 files changed, 8 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/prims/jvm.cpp	Wed Oct 31 18:30:45 2018 +0100
+++ b/src/hotspot/share/prims/jvm.cpp	Thu Nov 01 01:38:56 2018 +0100
@@ -1790,16 +1790,10 @@
 
 JVM_ENTRY(jint, JVM_GetRecordParametersCount(JNIEnv *env, jclass ofClass))
 {
+  // current is not a primitive or array class
   JVMWrapper("JVM_GetRecordParametersCount");
   JvmtiVMObjectAllocEventCollector oam;
 
-  // Exclude primitive types and array types
-  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
-      java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_array_klass()) {
-    // Return 0
-    return 0;
-  }
-
   InstanceKlass* k = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)));
   // Ensure class is linked
   k->link_class(CHECK_0);
@@ -1810,17 +1804,10 @@
 
 JVM_ENTRY(jobjectArray, JVM_GetRecordParameters(JNIEnv *env, jclass ofClass))
 {
+  // current is not a primitive or array class
   JVMWrapper("JVM_GetRecordParameters");
   JvmtiVMObjectAllocEventCollector oam;
 
-  // Exclude primitive types and array types
-  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||
-      java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass))->is_array_klass()) {
-    // Return empty array
-    oop res = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), 0, CHECK_NULL);
-    return (jobjectArray) JNIHandles::make_local(env, res);
-  }
-
   InstanceKlass* k = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(ofClass)));
   constantPoolHandle cp(THREAD, k->constants());
 
--- a/src/java.base/share/classes/java/lang/Class.java	Wed Oct 31 18:30:45 2018 +0100
+++ b/src/java.base/share/classes/java/lang/Class.java	Thu Nov 01 01:38:56 2018 +0100
@@ -2248,7 +2248,7 @@
         if (sm != null) {
             checkMemberAccess(sm, Member.DECLARED, Reflection.getCallerClass(), true);
         }
-        return copyFields(privateGetRecordParameters());
+        return isPrimitive() || isArray() ? new Field[0] : copyFields(privateGetRecordParameters());
     }
 
     /**
@@ -2256,7 +2256,9 @@
      * @return the number of record parameters
      * @since 1.12
      */
-    public native int getRecordParametersCount();
+    public int getRecordParametersCount() {
+        return isPrimitive() || isArray() ? 0 : getRecordParametersCount0();
+    }
 
     /**
      * Returns an array containing {@code Method} objects reflecting all the
@@ -3433,6 +3435,7 @@
     private native Constructor<T>[] getDeclaredConstructors0(boolean publicOnly);
     private native Class<?>[]   getDeclaredClasses0();
     private native Field[]      getRecordParameters0();
+    private native int          getRecordParametersCount0();
 
     /**
      * Helper method to get the method name from arguments.
--- a/src/java.base/share/native/libjava/Class.c	Wed Oct 31 18:30:45 2018 +0100
+++ b/src/java.base/share/native/libjava/Class.c	Thu Nov 01 01:38:56 2018 +0100
@@ -77,7 +77,7 @@
     {"getNestHost0",         "()" CLS,      (void *)&JVM_GetNestHost},
     {"getNestMembers0",      "()[" CLS,     (void *)&JVM_GetNestMembers},
     {"getRecordParameters0",  "()[" FLD,    (void *)&JVM_GetRecordParameters},
-    {"getRecordParametersCount", "()I",     (void *)&JVM_GetRecordParametersCount},
+    {"getRecordParametersCount0", "()I",    (void *)&JVM_GetRecordParametersCount},
 };
 
 #undef OBJ