Package org.objectweb.asm
Class ModuleWriter
- java.lang.Object
-
- org.objectweb.asm.ModuleVisitor
-
- org.objectweb.asm.ModuleWriter
-
final class ModuleWriter extends ModuleVisitor
AModuleVisitor
that generates the corresponding Module, ModulePackages and ModuleMainClass attributes, as defined in the Java Virtual Machine Specification (JVMS).- See Also:
- JVMS 4.7.25, JVMS 4.7.26, JVMS 4.7.27
-
-
Field Summary
Fields Modifier and Type Field Description private ByteVector
exports
The binary content of the 'exports' array of the JVMS Module attribute.private int
exportsCount
The exports_count field of the JVMS Module attribute.private int
mainClassIndex
The main_class_index field of the JVMS ModuleMainClass attribute, or 0.private int
moduleFlags
The module_flags field of the JVMS Module attribute.private int
moduleNameIndex
The module_name_index field of the JVMS Module attribute.private int
moduleVersionIndex
The module_version_index field of the JVMS Module attribute.private ByteVector
opens
The binary content of the 'opens' array of the JVMS Module attribute.private int
opensCount
The opens_count field of the JVMS Module attribute.private int
packageCount
The provides_count field of the JVMS ModulePackages attribute.private ByteVector
packageIndex
The binary content of the 'package_index' array of the JVMS ModulePackages attribute.private ByteVector
provides
The binary content of the 'provides' array of the JVMS Module attribute.private int
providesCount
The provides_count field of the JVMS Module attribute.private ByteVector
requires
The binary content of the 'requires' array of the JVMS Module attribute.private int
requiresCount
The requires_count field of the JVMS Module attribute.private SymbolTable
symbolTable
Where the constants used in this AnnotationWriter must be stored.private int
usesCount
The uses_count field of the JVMS Module attribute.private ByteVector
usesIndex
The binary content of the 'uses_index' array of the JVMS Module attribute.-
Fields inherited from class org.objectweb.asm.ModuleVisitor
api, mv
-
-
Constructor Summary
Constructors Constructor Description ModuleWriter(SymbolTable symbolTable, int name, int access, int version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
computeAttributesSize()
Returns the size of the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter.(package private) int
getAttributeCount()
Returns the number of Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter.(package private) void
putAttributes(ByteVector output)
Puts the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter in the given ByteVector.void
visitEnd()
Visits the end of the module.void
visitExport(java.lang.String packaze, int access, java.lang.String... modules)
Visit an exported package of the current module.void
visitMainClass(java.lang.String mainClass)
Visit the main class of the current module.void
visitOpen(java.lang.String packaze, int access, java.lang.String... modules)
Visit an open package of the current module.void
visitPackage(java.lang.String packaze)
Visit a package of the current module.void
visitProvide(java.lang.String service, java.lang.String... providers)
Visit an implementation of a service.void
visitRequire(java.lang.String module, int access, java.lang.String version)
Visits a dependence of the current module.void
visitUse(java.lang.String service)
Visit a service used by the current module.
-
-
-
Field Detail
-
symbolTable
private final SymbolTable symbolTable
Where the constants used in this AnnotationWriter must be stored.
-
moduleNameIndex
private final int moduleNameIndex
The module_name_index field of the JVMS Module attribute.
-
moduleFlags
private final int moduleFlags
The module_flags field of the JVMS Module attribute.
-
moduleVersionIndex
private final int moduleVersionIndex
The module_version_index field of the JVMS Module attribute.
-
requiresCount
private int requiresCount
The requires_count field of the JVMS Module attribute.
-
requires
private final ByteVector requires
The binary content of the 'requires' array of the JVMS Module attribute.
-
exportsCount
private int exportsCount
The exports_count field of the JVMS Module attribute.
-
exports
private final ByteVector exports
The binary content of the 'exports' array of the JVMS Module attribute.
-
opensCount
private int opensCount
The opens_count field of the JVMS Module attribute.
-
opens
private final ByteVector opens
The binary content of the 'opens' array of the JVMS Module attribute.
-
usesCount
private int usesCount
The uses_count field of the JVMS Module attribute.
-
usesIndex
private final ByteVector usesIndex
The binary content of the 'uses_index' array of the JVMS Module attribute.
-
providesCount
private int providesCount
The provides_count field of the JVMS Module attribute.
-
provides
private final ByteVector provides
The binary content of the 'provides' array of the JVMS Module attribute.
-
packageCount
private int packageCount
The provides_count field of the JVMS ModulePackages attribute.
-
packageIndex
private final ByteVector packageIndex
The binary content of the 'package_index' array of the JVMS ModulePackages attribute.
-
mainClassIndex
private int mainClassIndex
The main_class_index field of the JVMS ModuleMainClass attribute, or 0.
-
-
Constructor Detail
-
ModuleWriter
ModuleWriter(SymbolTable symbolTable, int name, int access, int version)
-
-
Method Detail
-
visitMainClass
public void visitMainClass(java.lang.String mainClass)
Description copied from class:ModuleVisitor
Visit the main class of the current module.- Overrides:
visitMainClass
in classModuleVisitor
- Parameters:
mainClass
- the internal name of the main class of the current module.
-
visitPackage
public void visitPackage(java.lang.String packaze)
Description copied from class:ModuleVisitor
Visit a package of the current module.- Overrides:
visitPackage
in classModuleVisitor
- Parameters:
packaze
- the internal name of a package.
-
visitRequire
public void visitRequire(java.lang.String module, int access, java.lang.String version)
Description copied from class:ModuleVisitor
Visits a dependence of the current module.- Overrides:
visitRequire
in classModuleVisitor
- Parameters:
module
- the fully qualified name (using dots) of the dependence.access
- the access flag of the dependence amongACC_TRANSITIVE
,ACC_STATIC_PHASE
,ACC_SYNTHETIC
andACC_MANDATED
.version
- the module version at compile time, or null.
-
visitExport
public void visitExport(java.lang.String packaze, int access, java.lang.String... modules)
Description copied from class:ModuleVisitor
Visit an exported package of the current module.- Overrides:
visitExport
in classModuleVisitor
- Parameters:
packaze
- the internal name of the exported package.access
- the access flag of the exported package, valid values are amongACC_SYNTHETIC
andACC_MANDATED
.modules
- the fully qualified names (using dots) of the modules that can access the public classes of the exported package, or null.
-
visitOpen
public void visitOpen(java.lang.String packaze, int access, java.lang.String... modules)
Description copied from class:ModuleVisitor
Visit an open package of the current module.- Overrides:
visitOpen
in classModuleVisitor
- Parameters:
packaze
- the internal name of the opened package.access
- the access flag of the opened package, valid values are amongACC_SYNTHETIC
andACC_MANDATED
.modules
- the fully qualified names (using dots) of the modules that can use deep reflection to the classes of the open package, or null.
-
visitUse
public void visitUse(java.lang.String service)
Description copied from class:ModuleVisitor
Visit a service used by the current module. The name must be the internal name of an interface or a class.- Overrides:
visitUse
in classModuleVisitor
- Parameters:
service
- the internal name of the service.
-
visitProvide
public void visitProvide(java.lang.String service, java.lang.String... providers)
Description copied from class:ModuleVisitor
Visit an implementation of a service.- Overrides:
visitProvide
in classModuleVisitor
- Parameters:
service
- the internal name of the service.providers
- the internal names of the implementations of the service (there is at least one provider).
-
visitEnd
public void visitEnd()
Description copied from class:ModuleVisitor
Visits the end of the module. This method, which is the last one to be called, is used to inform the visitor that everything have been visited.- Overrides:
visitEnd
in classModuleVisitor
-
getAttributeCount
int getAttributeCount()
Returns the number of Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter.- Returns:
- the number of Module, ModulePackages and ModuleMainClass attributes (between 1 and 3).
-
computeAttributesSize
int computeAttributesSize()
Returns the size of the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter. Also add the names of these attributes in the constant pool.- Returns:
- the size in bytes of the Module, ModulePackages and ModuleMainClass attributes.
-
putAttributes
void putAttributes(ByteVector output)
Puts the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter in the given ByteVector.- Parameters:
output
- where the attributes must be put.
-
-