Class ModifierUtils

java.lang.Object
io.micronaut.sourcegen.bytecode.core.ModifierUtils

@Internal public final class ModifierUtils extends Object
Maps Java model modifiers to JVMS access flags without depending on a bytecode library.

The integer values are the class-file values defined by the JVMS and are understood by both the ASM and JDK ClassFile backends.

Since:
2.2
  • Field Details

  • Method Details

    • memberFlags

      public static int memberFlags(Set<Modifier> modifiers)
      Maps member modifiers.
      Parameters:
      modifiers - Java modifiers
      Returns:
      JVMS flags
    • objectFlags

      public static int objectFlags(ObjectDef objectDef)
      Maps an object definition to its class-file flags.
      Parameters:
      objectDef - The definition
      Returns:
      JVMS flags
    • classFlags

      public static int classFlags(Set<Modifier> modifiers, @Nullable ClassTypeDef outerType)
      Maps the class-file flags of a class being emitted. Visibility and static are represented by the enclosing InnerClasses entry instead of the class-file access field.
      Parameters:
      modifiers - Declared modifiers
      outerType - Enclosing type, or null
      Returns:
      JVMS class flags
    • innerClassFlags

      public static int innerClassFlags(ObjectDef objectDef, boolean declaredInterface)
      Maps the flags carried by an InnerClasses entry.
      Parameters:
      objectDef - The nested definition
      declaredInterface - Whether the enclosing type is an interface
      Returns:
      JVMS flags