Interface ModulePackagesAttribute
- All Superinterfaces:
Attribute<ModulePackagesAttribute>, ClassElement, ClassFileElement
public sealed interface ModulePackagesAttribute
extends Attribute<ModulePackagesAttribute>, ClassElement
Models the
ModulePackages attribute (JVMS
4.7.26), which can appear on classes that represent module descriptors to indicate packages
in the module used by the module descriptor.
This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.
The attribute was introduced in the Java SE Platform version 9, major version 53.
- See Java Virtual Machine Specification:
-
4.7.26 The
ModulePackagesAttribute - Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ModulePackagesAttributeof(PackageEntry... packages) Returns aModulePackagesattribute.static ModulePackagesAttributeof(List<PackageEntry> packages) Returns aModulePackagesattribute.static ModulePackagesAttributeofNames(PackageDesc... packages) Returns aModulePackagesattribute.static ModulePackagesAttributeofNames(List<PackageDesc> packages) Returns aModulePackagesattribute.packages()Returns the packages used by the module descriptor.Methods declared in interface Attribute
attributeMapper, attributeNameModifier and TypeMethodDescriptionReturns theAttributeMapperassociated with this attribute.Returns the name of the attribute.
-
Method Details
-
packages
List<PackageEntry> packages()Returns the packages used by the module descriptor. This must include all packages opened or exported by the module, as well as the packages of any service providers, and the package for the main class.- Returns:
- the packages used by the module descriptor
-
of
Returns aModulePackagesattribute.- Parameters:
packages- the packages- Returns:
- a
ModulePackagesattribute - Throws:
IllegalArgumentException- if the number of packages exceeds the limit ofu2
-
of
Returns aModulePackagesattribute.- Parameters:
packages- the packages- Returns:
- a
ModulePackagesattribute - Throws:
IllegalArgumentException- if the number of packages exceeds the limit ofu2
-
ofNames
Returns aModulePackagesattribute.- Parameters:
packages- the packages- Returns:
- a
ModulePackagesattribute - Throws:
IllegalArgumentException- if the number of packages exceeds the limit ofu2
-
ofNames
Returns aModulePackagesattribute.- Parameters:
packages- the packages- Returns:
- a
ModulePackagesattribute - Throws:
IllegalArgumentException- if the number of packages exceeds the limit ofu2
-