Package org.objectweb.asm.util
Class CheckModuleAdapter
- java.lang.Object
-
- org.objectweb.asm.ModuleVisitor
-
- org.objectweb.asm.util.CheckModuleAdapter
-
public class CheckModuleAdapter extends ModuleVisitor
AModuleVisitorthat checks that its methods are properly used.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCheckModuleAdapter.NameSet
-
Field Summary
Fields Modifier and Type Field Description (package private) intclassVersionThe class version number.private CheckModuleAdapter.NameSetexportedPackagesThe internal names of the packages exported by the visited module.private booleanisOpenWhether the visited module is open.private CheckModuleAdapter.NameSetopenedPackagesThe internal names of the packages opened by the visited module.private CheckModuleAdapter.NameSetprovidedServicesThe internal names of the services provided by the visited module.private CheckModuleAdapter.NameSetrequiredModulesThe fully qualified names of the dependencies of the visited module.private CheckModuleAdapter.NameSetusedServicesThe internal names of the services used by the visited module.private booleanvisitEndCalledWhether thevisitEnd()method has been called.-
Fields inherited from class org.objectweb.asm.ModuleVisitor
api, mv
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCheckModuleAdapter(int api, ModuleVisitor moduleVisitor, boolean isOpen)Constructs a newCheckModuleAdapter.CheckModuleAdapter(ModuleVisitor moduleVisitor, boolean isOpen)Constructs a newCheckModuleAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckVisitEndNotCalled()voidvisitEnd()Visits the end of the module.voidvisitExport(java.lang.String packaze, int access, java.lang.String... modules)Visit an exported package of the current module.voidvisitMainClass(java.lang.String mainClass)Visit the main class of the current module.voidvisitOpen(java.lang.String packaze, int access, java.lang.String... modules)Visit an open package of the current module.voidvisitPackage(java.lang.String packaze)Visit a package of the current module.voidvisitProvide(java.lang.String service, java.lang.String... providers)Visit an implementation of a service.voidvisitRequire(java.lang.String module, int access, java.lang.String version)Visits a dependence of the current module.voidvisitUse(java.lang.String service)Visit a service used by the current module.
-
-
-
Field Detail
-
isOpen
private final boolean isOpen
Whether the visited module is open.
-
requiredModules
private final CheckModuleAdapter.NameSet requiredModules
The fully qualified names of the dependencies of the visited module.
-
exportedPackages
private final CheckModuleAdapter.NameSet exportedPackages
The internal names of the packages exported by the visited module.
-
openedPackages
private final CheckModuleAdapter.NameSet openedPackages
The internal names of the packages opened by the visited module.
-
usedServices
private final CheckModuleAdapter.NameSet usedServices
The internal names of the services used by the visited module.
-
providedServices
private final CheckModuleAdapter.NameSet providedServices
The internal names of the services provided by the visited module.
-
classVersion
int classVersion
The class version number.
-
visitEndCalled
private boolean visitEndCalled
Whether thevisitEnd()method has been called.
-
-
Constructor Detail
-
CheckModuleAdapter
public CheckModuleAdapter(ModuleVisitor moduleVisitor, boolean isOpen)
Constructs a newCheckModuleAdapter. Subclasses must not use this constructor. Instead, they must use theCheckModuleAdapter(int, ModuleVisitor, boolean)version.- Parameters:
moduleVisitor- the module visitor to which this adapter must delegate calls.isOpen- whether the visited module is open. Open modules have theirOpcodes.ACC_OPENaccess flag set inClassVisitor.visitModule(java.lang.String, int, java.lang.String).- Throws:
java.lang.IllegalStateException- If a subclass calls this constructor.
-
CheckModuleAdapter
protected CheckModuleAdapter(int api, ModuleVisitor moduleVisitor, boolean isOpen)Constructs a newCheckModuleAdapter.- Parameters:
api- the ASM API version implemented by this visitor. Must be one ofOpcodes.ASM4,Opcodes.ASM5,Opcodes.ASM6orOpcodes.ASM7.moduleVisitor- the module visitor to which this adapter must delegate calls.isOpen- whether the visited module is open. Open modules have theirOpcodes.ACC_OPENaccess flag set inClassVisitor.visitModule(java.lang.String, int, java.lang.String).
-
-
Method Detail
-
visitMainClass
public void visitMainClass(java.lang.String mainClass)
Description copied from class:ModuleVisitorVisit the main class of the current module.- Overrides:
visitMainClassin 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:ModuleVisitorVisit a package of the current module.- Overrides:
visitPackagein 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:ModuleVisitorVisits a dependence of the current module.- Overrides:
visitRequirein 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_SYNTHETICandACC_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:ModuleVisitorVisit an exported package of the current module.- Overrides:
visitExportin classModuleVisitor- Parameters:
packaze- the internal name of the exported package.access- the access flag of the exported package, valid values are amongACC_SYNTHETICandACC_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:ModuleVisitorVisit an open package of the current module.- Overrides:
visitOpenin classModuleVisitor- Parameters:
packaze- the internal name of the opened package.access- the access flag of the opened package, valid values are amongACC_SYNTHETICandACC_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:ModuleVisitorVisit a service used by the current module. The name must be the internal name of an interface or a class.- Overrides:
visitUsein 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:ModuleVisitorVisit an implementation of a service.- Overrides:
visitProvidein 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:ModuleVisitorVisits 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:
visitEndin classModuleVisitor
-
checkVisitEndNotCalled
private void checkVisitEndNotCalled()
-
-