Top Description Fields Constructors Methods
jdk.internal.org.objectweb.asm

pack-priv final Class FieldWriter

extends FieldVisitor
Class Inheritance

A FieldVisitor that generates a corresponding 'field_info' structure, as defined in the Java Virtual Machine Specification (JVMS).
Author
Eric Bruneton
See Also
JVMS 4.5

Field Summary

Modifier and TypeField and Description
private final int
accessFlags

The access_flags field of the field_info JVMS structure.

private int
constantValueIndex

The constantvalue_index field of the ConstantValue attribute of this field_info, or 0 if there is no ConstantValue attribute.

private final int
descriptorIndex

The descriptor_index field of the field_info JVMS structure.

private Attribute
firstAttribute

The first non standard attribute of this field.

private AnnotationWriter
lastRuntimeInvisibleAnnotation

The last runtime invisible annotation of this field.

private AnnotationWriter
lastRuntimeInvisibleTypeAnnotation

The last runtime invisible type annotation of this field.

private AnnotationWriter
lastRuntimeVisibleAnnotation

The last runtime visible annotation of this field.

private AnnotationWriter
lastRuntimeVisibleTypeAnnotation

The last runtime visible type annotation of this field.

private final int
nameIndex

The name_index field of the field_info JVMS structure.

private int
signatureIndex

The signature_index field of the Signature attribute of this field_info, or 0 if there is no Signature attribute.

private final SymbolTable
symbolTable

Where the constants used in this FieldWriter must be stored.

Inherited from jdk.internal.org.objectweb.asm.FieldVisitor:
apifv

Constructor Summary

AccessConstructor and Description
pack-priv
FieldWriter(final SymbolTable
where the constants used in this FieldWriter must be stored.
symbolTable
,
final int
the field's access flags (see Opcodes).
access
,
final String
the field's name.
name
,
final String
the field's descriptor (see Type).
descriptor
,
final String
the field's signature. May be null.
signature
,
final Object
the field's constant value. May be null.
constantValue
)

Constructs a new FieldWriter.

Method Summary

Modifier and TypeMethod and Description
pack-priv final void
collectAttributePrototypes(final Attribute.Set
a set of attribute prototypes.
attributePrototypes
)

Collects the attributes of this field into the given set of attribute prototypes.

pack-priv int

Returns:

the size in bytes of the field_info JVMS structure.
computeFieldInfoSize
()

Returns the size of the field_info JVMS structure generated by this FieldWriter.

pack-priv void
putFieldInfo(final ByteVector
where the field_info structure must be put.
output
)

Puts the content of the field_info JVMS structure generated by this FieldWriter into the given ByteVector.

public AnnotationVisitor
visitAnnotation(final String
the class descriptor of the annotation class.
descriptor
,
final boolean
true if the annotation is visible at runtime.
visible
)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitAnnotation.

Visits an annotation of the field.
public void
visitAttribute(final Attribute
an attribute.
attribute
)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitAttribute.

Visits a non standard attribute of the field.
public void
visitEnd()

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitEnd.

Visits the end of the field.
public AnnotationVisitor
visitTypeAnnotation(final int
a reference to the annotated type. The sort of this type reference must be TypeReference#FIELD. See TypeReference.
typeRef
,
final TypePath
the path to the annotated type argument, wildcard bound, array element type, or static inner type within 'typeRef'. May be null if the annotation targets 'typeRef' as a whole.
typePath
,
final String
the class descriptor of the annotation class.
descriptor
,
final boolean
true if the annotation is visible at runtime.
visible
)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitTypeAnnotation.

Visits an annotation on the type of the field.

Field Detail

accessFlagsback to summary
private final int accessFlags

The access_flags field of the field_info JVMS structure. This field can contain ASM specific access flags, such as Opcodes#ACC_DEPRECATED, which are removed when generating the ClassFile structure.

constantValueIndexback to summary
private int constantValueIndex

The constantvalue_index field of the ConstantValue attribute of this field_info, or 0 if there is no ConstantValue attribute.

descriptorIndexback to summary
private final int descriptorIndex

The descriptor_index field of the field_info JVMS structure.

firstAttributeback to summary
private Attribute firstAttribute

The first non standard attribute of this field. The next ones can be accessed with the Attribute#nextAttribute field. May be null.

Warning

this list stores the attributes in the reverse order of their visit. firstAttribute is actually the last attribute visited in visitAttribute. The putFieldInfo method writes the attributes in the order defined by this list, i.e. in the reverse order specified by the user.

lastRuntimeInvisibleAnnotationback to summary
private AnnotationWriter lastRuntimeInvisibleAnnotation

The last runtime invisible annotation of this field. The previous ones can be accessed with the AnnotationWriter#previousAnnotation field. May be null.

lastRuntimeInvisibleTypeAnnotationback to summary
private AnnotationWriter lastRuntimeInvisibleTypeAnnotation

The last runtime invisible type annotation of this field. The previous ones can be accessed with the AnnotationWriter#previousAnnotation field. May be null.

lastRuntimeVisibleAnnotationback to summary
private AnnotationWriter lastRuntimeVisibleAnnotation

The last runtime visible annotation of this field. The previous ones can be accessed with the AnnotationWriter#previousAnnotation field. May be null.

lastRuntimeVisibleTypeAnnotationback to summary
private AnnotationWriter lastRuntimeVisibleTypeAnnotation

The last runtime visible type annotation of this field. The previous ones can be accessed with the AnnotationWriter#previousAnnotation field. May be null.

nameIndexback to summary
private final int nameIndex

The name_index field of the field_info JVMS structure.

signatureIndexback to summary
private int signatureIndex

The signature_index field of the Signature attribute of this field_info, or 0 if there is no Signature attribute.

symbolTableback to summary
private final SymbolTable symbolTable

Where the constants used in this FieldWriter must be stored.

Constructor Detail

FieldWriterback to summary
pack-priv FieldWriter(final SymbolTable symbolTable, final int access, final String name, final String descriptor, final String signature, final Object constantValue)

Constructs a new FieldWriter.

Parameters
symbolTable:SymbolTable

where the constants used in this FieldWriter must be stored.

access:int

the field's access flags (see Opcodes).

name:String

the field's name.

descriptor:String

the field's descriptor (see Type).

signature:String

the field's signature. May be null.

constantValue:Object

the field's constant value. May be null.

Method Detail

collectAttributePrototypesback to summary
pack-priv final void collectAttributePrototypes(final Attribute.Set attributePrototypes)

Collects the attributes of this field into the given set of attribute prototypes.

Parameters
attributePrototypes:Attribute.Set

a set of attribute prototypes.

computeFieldInfoSizeback to summary
pack-priv int computeFieldInfoSize()

Returns the size of the field_info JVMS structure generated by this FieldWriter. Also adds the names of the attributes of this field in the constant pool.

Returns:int

the size in bytes of the field_info JVMS structure.

putFieldInfoback to summary
pack-priv void putFieldInfo(final ByteVector output)

Puts the content of the field_info JVMS structure generated by this FieldWriter into the given ByteVector.

Parameters
output:ByteVector

where the field_info structure must be put.

visitAnnotationback to summary
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitAnnotation.

Doc from jdk.internal.org.objectweb.asm.FieldVisitor.visitAnnotation.

Visits an annotation of the field.

Parameters
descriptor:String

the class descriptor of the annotation class.

visible:boolean

true if the annotation is visible at runtime.

Returns:AnnotationVisitor

a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.

Annotations
@Override
visitAttributeback to summary
public void visitAttribute(final Attribute attribute)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitAttribute.

Doc from jdk.internal.org.objectweb.asm.FieldVisitor.visitAttribute.

Visits a non standard attribute of the field.

Parameters
attribute:Attribute

an attribute.

Annotations
@Override
visitEndback to summary
public void visitEnd()

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitEnd.

Doc from jdk.internal.org.objectweb.asm.FieldVisitor.visitEnd.

Visits the end of the field. This method, which is the last one to be called, is used to inform the visitor that all the annotations and attributes of the field have been visited.

Annotations
@Override
visitTypeAnnotationback to summary
public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String descriptor, final boolean visible)

Overrides jdk.internal.org.objectweb.asm.FieldVisitor.visitTypeAnnotation.

Doc from jdk.internal.org.objectweb.asm.FieldVisitor.visitTypeAnnotation.

Visits an annotation on the type of the field.

Parameters
typeRef:int

a reference to the annotated type. The sort of this type reference must be TypeReference#FIELD. See TypeReference.

typePath:TypePath

the path to the annotated type argument, wildcard bound, array element type, or static inner type within 'typeRef'. May be null if the annotation targets 'typeRef' as a whole.

descriptor:String

the class descriptor of the annotation class.

visible:boolean

true if the annotation is visible at runtime.

Returns:AnnotationVisitor

a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.

Annotations
@Override