Class ModifierUtils
java.lang.Object
io.micronaut.sourcegen.bytecode.core.ModifierUtils
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic intaccessFlags(Set<Modifier> modifiers) Maps the access modifiers alone -public,protectedandprivate- as a member that takes the access of its definition, the implicit canonical constructor of a record, is written.static intclassFileFlags(ObjectDef objectDef, @Nullable ClassTypeDef outerType) Maps the flags of the class file of a definition: the kind of type it is, itsclass flags,ACC_SYNTHETICfor a synthetic one andACC_ENUMfor the lowered class form of an enum.static intclassFlags(Set<Modifier> modifiers, @Nullable ClassTypeDef outerType) Maps the class-file flags of a class being emitted.static intfieldFlags(ObjectDef objectDef, FieldDef field) Maps the flags of a field: its modifiers,ACC_SYNTHETICfor a synthetic one andACC_ENUMfor the constant of an enum.static intinnerClassFlags(ObjectDef objectDef, boolean declaredInterface) Maps the flags carried by anInnerClassesentry.static intmemberFlags(Set<Modifier> modifiers) Maps member modifiers.static intmethodFlags(MethodDef method) Maps the flags of a method: its modifiers, andACC_SYNTHETICfor a synthetic one.static intobjectFlags(ObjectDef objectDef) Maps an object definition to its class-file flags.static intparameterFlags(ParameterDef parameter) Maps the flags of a method parameter, as theMethodParametersattribute carries them.
-
Field Details
-
ACC_PUBLIC
public static final int ACC_PUBLIC- See Also:
-
ACC_PRIVATE
public static final int ACC_PRIVATE- See Also:
-
ACC_PROTECTED
public static final int ACC_PROTECTED- See Also:
-
ACC_STATIC
public static final int ACC_STATIC- See Also:
-
ACC_FINAL
public static final int ACC_FINAL- See Also:
-
ACC_SUPER
public static final int ACC_SUPER- See Also:
-
ACC_SYNCHRONIZED
public static final int ACC_SYNCHRONIZED- See Also:
-
ACC_VOLATILE
public static final int ACC_VOLATILE- See Also:
-
ACC_BRIDGE
public static final int ACC_BRIDGE- See Also:
-
ACC_TRANSIENT
public static final int ACC_TRANSIENT- See Also:
-
ACC_VARARGS
public static final int ACC_VARARGS- See Also:
-
ACC_NATIVE
public static final int ACC_NATIVE- See Also:
-
ACC_INTERFACE
public static final int ACC_INTERFACE- See Also:
-
ACC_ABSTRACT
public static final int ACC_ABSTRACT- See Also:
-
ACC_STRICT
public static final int ACC_STRICT- See Also:
-
ACC_SYNTHETIC
public static final int ACC_SYNTHETIC- See Also:
-
ACC_ANNOTATION
public static final int ACC_ANNOTATION- See Also:
-
ACC_ENUM
public static final int ACC_ENUM- See Also:
-
-
Method Details
-
memberFlags
-
objectFlags
Maps an object definition to its class-file flags.- Parameters:
objectDef- The definition- Returns:
- JVMS flags
-
classFlags
Maps the class-file flags of a class being emitted. Visibility and static are represented by the enclosingInnerClassesentry instead of the class-file access field.- Parameters:
modifiers- Declared modifiersouterType- Enclosing type, ornull- Returns:
- JVMS class flags
-
innerClassFlags
Maps the flags carried by anInnerClassesentry.- Parameters:
objectDef- The nested definitiondeclaredInterface- Whether the enclosing type is an interface- Returns:
- JVMS flags
-
accessFlags
Maps the access modifiers alone -public,protectedandprivate- as a member that takes the access of its definition, the implicit canonical constructor of a record, is written.- Parameters:
modifiers- Java modifiers- Returns:
- JVMS access flags
- Since:
- 2.3
-
methodFlags
Maps the flags of a method: its modifiers, andACC_SYNTHETICfor a synthetic one.- Parameters:
method- The method- Returns:
- JVMS flags
- Since:
- 2.3
-
fieldFlags
Maps the flags of a field: its modifiers,ACC_SYNTHETICfor a synthetic one andACC_ENUMfor the constant of an enum.- Parameters:
objectDef- The definition declaring the field, in its lowered class form for an enumfield- The field- Returns:
- JVMS flags
- Since:
- 2.3
-
parameterFlags
Maps the flags of a method parameter, as theMethodParametersattribute carries them.- Parameters:
parameter- The parameter- Returns:
- JVMS flags
- Since:
- 2.3
-
classFileFlags
Maps the flags of the class file of a definition: the kind of type it is, itsclass flags,ACC_SYNTHETICfor a synthetic one andACC_ENUMfor the lowered class form of an enum. A record is final; theRecordattribute, not a flag, marks it as a record.- Parameters:
objectDef- The definition, in its lowered class form for an enumouterType- The enclosing type, ornull- Returns:
- JVMS class flags
- Since:
- 2.3
-