< prev index next >

src/java.base/share/classes/java/lang/invoke/MemberName.java

Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd

@@ -189,11 +189,11 @@
      *  For non-static methods or constructors, this is the type with a leading parameter,
      *  a reference to declaring class.  For static methods, it is the same as the declared type.
      */
     public MethodType getInvocationType() {
         MethodType itype = getMethodOrFieldType();
-        Class<?> c = clazz.isValue() ? clazz.asValueType() : clazz;
+        Class<?> c = clazz.asPrimaryType();
         if (isConstructor() && getReferenceKind() == REF_newInvokeSpecial)
             return itype.changeReturnType(c);
         if (!isStatic())
             return itype.insertParameterTypes(0, c);
         return itype;

@@ -426,11 +426,11 @@
         return Modifier.isProtected(flags);
     }
     /** Utility method to query the modifier flags of this member. */
     public boolean isFinal() {
         // all fields declared in a value type are effectively final
-        assert(!clazz.isValue() || !isField() || Modifier.isFinal(flags));
+        assert(!clazz.isInlineClass() || !isField() || Modifier.isFinal(flags));
         return Modifier.isFinal(flags);
     }
     /** Utility method to query whether this member or its defining class is final. */
     public boolean canBeStaticallyBound() {
         return Modifier.isFinal(flags | clazz.getModifiers());

@@ -471,15 +471,15 @@
     }
 
     /** Query whether this member is a flattened field */
     public boolean isFlattened() { return (flags & FLATTENED) == FLATTENED; }
 
-    /** Query whether this member is a field of normal value type. */
-    public boolean isValue()  {
+    /** Query whether this member is a field of an inline class. */
+    public boolean isInlineableField()  {
         if (isField()) {
             Class<?> type = getFieldType();
-            return type == type.asValueType();
+            return type.isInlineClass() && type == type.asPrimaryType();
         }
         return false;
     }
 
     static final String CONSTRUCTOR_NAME = "<init>";  // the ever-popular

@@ -940,14 +940,23 @@
         //buf.append("#").append(System.identityHashCode(this));
         return buf.toString();
     }
     private static String getName(Object obj) {
         if (obj instanceof Class<?>)
-            return ((Class<?>)obj).getName();
+            return toTypeName((Class<?>)obj);
         return String.valueOf(obj);
     }
 
+    /*
+     * Returns the class name appended with "?" if it is the nullable projection
+     * of an inline class.
+     */
+    private static String toTypeName(Class<?> type) {
+        return type.isInlineClass() && type.isNullableType() ? type.getName() + "?" : type.getName();
+    }
+
+
     public IllegalAccessException makeAccessException(String message, Object from) {
         message = message + ": "+ toString();
         if (from != null)  {
             if (from == MethodHandles.publicLookup()) {
                 message += ", from public Lookup";
< prev index next >