< prev index next >

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

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 25,10 ***
--- 25,11 ---
  
  package java.lang.invoke;
  
  import sun.invoke.util.VerifyAccess;
  
+ import java.lang.classfile.ClassFile;
  import java.lang.reflect.Constructor;
  import java.lang.reflect.Field;
  import java.lang.reflect.Member;
  import java.lang.reflect.Method;
  import java.lang.reflect.Modifier;

*** 386,10 ***
--- 387,14 ---
          return Modifier.isProtected(flags);
      }
      /** Utility method to query the modifier flags of this member. */
      public boolean isFinal() {
          return Modifier.isFinal(flags);
+     }
+      /** Utility method to query the ACC_STRICT_INIT flag of this member. */
+     public boolean isStrictInit() {
+         return (flags & ClassFile.ACC_STRICT_INIT) != 0;
      }
      /** Utility method to query whether this member or its defining class is final. */
      public boolean canBeStaticallyBound() {
          return Modifier.isFinal(flags | clazz.getModifiers());
      }

*** 425,10 ***
--- 430,21 ---
      /** 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;
  
< prev index next >