< prev index next > src/java.base/share/classes/java/lang/invoke/MemberName.java
Print this page
return Modifier.isNative(flags);
}
// let the rest (native, volatile, transient, etc.) be tested via Modifier.isFoo
// unofficial modifier flags, used by HotSpot:
! static final int BRIDGE = 0x00000040;
! static final int VARARGS = 0x00000080;
! static final int SYNTHETIC = 0x00001000;
! static final int ANNOTATION= 0x00002000;
! static final int ENUM = 0x00004000;
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
public boolean isBridge() {
return allFlagsSet(IS_METHOD | BRIDGE);
}
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
return Modifier.isNative(flags);
}
// let the rest (native, volatile, transient, etc.) be tested via Modifier.isFoo
// unofficial modifier flags, used by HotSpot:
! static final int BRIDGE = 0x00000040;
! static final int VARARGS = 0x00000080;
! static final int SYNTHETIC = 0x00001000;
! static final int ANNOTATION = 0x00002000;
! static final int ENUM = 0x00004000;
+
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
public boolean isBridge() {
return allFlagsSet(IS_METHOD | BRIDGE);
}
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
public boolean isSynthetic() {
return allFlagsSet(SYNTHETIC);
}
! static final String CONSTRUCTOR_NAME = "<init>"; // the ever-popular
// modifiers exported by the JVM:
static final int RECOGNIZED_MODIFIERS = 0xFFFF;
// private flags, not part of RECOGNIZED_MODIFIERS:
static final int
! IS_METHOD = MN_IS_METHOD, // method (not constructor)
! IS_CONSTRUCTOR = MN_IS_CONSTRUCTOR, // constructor
! IS_FIELD = MN_IS_FIELD, // field
! IS_TYPE = MN_IS_TYPE, // nested type
! CALLER_SENSITIVE = MN_CALLER_SENSITIVE, // @CallerSensitive annotation detected
! TRUSTED_FINAL = MN_TRUSTED_FINAL; // trusted final field
static final int ALL_ACCESS = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED;
static final int ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE;
static final int IS_INVOCABLE = IS_METHOD | IS_CONSTRUCTOR;
/** Utility method to query the modifier flags of this member; returns false if the member is not a method. */
public boolean isSynthetic() {
return allFlagsSet(SYNTHETIC);
}
! /** Query whether this member is a flat field */
+ public boolean isFlat() { return getLayout() != 0; }
+
+ /** Query whether this member is a null-restricted field */
+ public boolean isNullRestricted() { return (flags & MN_NULL_RESTRICTED) == MN_NULL_RESTRICTED; }
+
+ /**
+ * VM-internal layout code for this field, 0 if this field is not flat.
+ */
+ public int getLayout() { return (flags >>> MN_LAYOUT_SHIFT) & MN_LAYOUT_MASK; }
+
+ static final String CONSTRUCTOR_NAME = "<init>";
// modifiers exported by the JVM:
static final int RECOGNIZED_MODIFIERS = 0xFFFF;
// private flags, not part of RECOGNIZED_MODIFIERS:
static final int
! IS_METHOD = MN_IS_METHOD, // method (not constructor)
! IS_CONSTRUCTOR = MN_IS_CONSTRUCTOR, // constructor
! IS_FIELD = MN_IS_FIELD, // field
! IS_TYPE = MN_IS_TYPE, // nested type
! CALLER_SENSITIVE = MN_CALLER_SENSITIVE, // @CallerSensitive annotation detected
! TRUSTED_FINAL = MN_TRUSTED_FINAL; // trusted final field
static final int ALL_ACCESS = Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED;
static final int ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE;
static final int IS_INVOCABLE = IS_METHOD | IS_CONSTRUCTOR;
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.
*/
public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) {
! int initFlags = (name != null && name.equals(CONSTRUCTOR_NAME) ? IS_CONSTRUCTOR : IS_METHOD);
init(defClass, name, type, flagsMods(initFlags, 0, refKind));
initResolved(false);
}
/** Create a method, constructor, or field name from the given components:
* Reference kind, declaring class, name, type.
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.
*/
public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) {
! int initFlags = CONSTRUCTOR_NAME.equals(name) ? IS_CONSTRUCTOR : IS_METHOD;
init(defClass, name, type, flagsMods(initFlags, 0, refKind));
initResolved(false);
}
/** Create a method, constructor, or field name from the given components:
* Reference kind, declaring class, name, type.
< prev index next >