< 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,199 ****
* 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;
if (isConstructor() && getReferenceKind() == REF_newInvokeSpecial)
return itype.changeReturnType(c);
if (!isStatic())
return itype.insertParameterTypes(0, c);
return itype;
--- 189,199 ----
* 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.asPrimaryType();
if (isConstructor() && getReferenceKind() == REF_newInvokeSpecial)
return itype.changeReturnType(c);
if (!isStatic())
return itype.insertParameterTypes(0, c);
return itype;
*** 426,436 ****
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));
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());
--- 426,436 ----
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.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,485 ****
}
/** 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() {
if (isField()) {
Class<?> type = getFieldType();
! return type == type.asValueType();
}
return false;
}
static final String CONSTRUCTOR_NAME = "<init>"; // the ever-popular
--- 471,485 ----
}
/** Query whether this member is a flattened field */
public boolean isFlattened() { return (flags & FLATTENED) == FLATTENED; }
! /** Query whether this member is a field of an inline class. */
! public boolean isInlineableField() {
if (isField()) {
Class<?> type = getFieldType();
! return type.isInlineClass() && type == type.asPrimaryType();
}
return false;
}
static final String CONSTRUCTOR_NAME = "<init>"; // the ever-popular
*** 940,953 ****
//buf.append("#").append(System.identityHashCode(this));
return buf.toString();
}
private static String getName(Object obj) {
if (obj instanceof Class<?>)
! return ((Class<?>)obj).getName();
return String.valueOf(obj);
}
public IllegalAccessException makeAccessException(String message, Object from) {
message = message + ": "+ toString();
if (from != null) {
if (from == MethodHandles.publicLookup()) {
message += ", from public Lookup";
--- 940,962 ----
//buf.append("#").append(System.identityHashCode(this));
return buf.toString();
}
private static String getName(Object obj) {
if (obj instanceof Class<?>)
! 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 >