Spec-Zone.ru › OpenJDK 27

Interface ModuleOpenInfo

public sealed interface ModuleOpenInfo
Models a single "opens" declaration in the ModuleAttribute.
API Note:
Opening a package to another module allows that other module to gain the same full privilege access as members in this module. See MethodHandles.privateLookupIn(Class, MethodHandles.Lookup) for more details.
See Java Virtual Machine Specification:
4.7.25 The Module Attribute
Since:
24
See Also:
  • ModuleAttribute.exports()
  • ModuleDescriptor.Opens

Method Summary

Modifier and Type Method Description
default boolean has(AccessFlag flag)
Returns whether the open declaration has the specified access flag set.
static ModuleOpenInfo of(PackageEntry opens, int opensFlags, ModuleEntry... opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageEntry opens, int opensFlags, List<ModuleEntry> opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageEntry opens, Collection<AccessFlag> opensFlags, ModuleEntry... opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageEntry opens, Collection<AccessFlag> opensFlags, List<ModuleEntry> opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageDesc opens, int opensFlags, ModuleDesc... opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageDesc opens, int opensFlags, List<ModuleDesc> opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageDesc opens, Collection<AccessFlag> opensFlags, ModuleDesc... opensTo)
Returns a module open description.
static ModuleOpenInfo of(PackageDesc opens, Collection<AccessFlag> opensFlags, List<ModuleDesc> opensTo)
Returns a module open description.
PackageEntry openedPackage()
Returns the package being opened.
default Set<AccessFlag> opensFlags()
Returns the flags associated with this open declaration, as a set of flag enums.
int opensFlagsMask()
Returns the flags associated with this open declaration, as a bit mask.
List<ModuleEntry> opensTo()
Returns the modules to which this package is opened, or empty if this is an unqualified open.

Method Details

openedPackage

PackageEntry openedPackage()
Returns the package being opened.
Returns:
the package being opened
See Also:
  • ModuleDescriptor.Opens.source()

opensFlagsMask

int opensFlagsMask()
Returns the flags associated with this open declaration, as a bit mask. It is a u2 value.
Returns:
the flags associated with this open declaration, as a bit mask
See Also:
  • ModuleDescriptor.Opens.modifiers()
  • AccessFlag.Location.MODULE_OPENS

opensFlags

default Set<AccessFlag> opensFlags()
Returns the flags associated with this open declaration, as a set of flag enums.
Returns:
the flags associated with this open declaration, as a set of flag enums
Throws:
IllegalArgumentException - if the flags mask has any undefined bit set
See Also:
  • ModuleDescriptor.Opens.accessFlags()
  • AccessFlag.Location.MODULE_OPENS

has

default boolean has(AccessFlag flag)
Returns whether the open declaration has the specified access flag set.
Parameters:
flag - the access flag
Returns:
whether the open declaration has the specified access flag set
See Also:
  • AccessFlag.Location.MODULE_OPENS

opensTo

List<ModuleEntry> opensTo()
Returns the modules to which this package is opened, or empty if this is an unqualified open.
Returns:
the modules to which this package is opened, or empty if this is an unqualified open
See Also:
  • ModuleDescriptor.Opens.isQualified()
  • ModuleDescriptor.Opens.targets()

of

static ModuleOpenInfo of(PackageEntry opens, int opensFlags, List<ModuleEntry> opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if opensFlags is not u2 or if the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageEntry opens, Collection<AccessFlag> opensFlags, List<ModuleEntry> opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_OPENS location, or the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageEntry opens, int opensFlags, ModuleEntry... opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if opensFlags is not u2 or if the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageEntry opens, Collection<AccessFlag> opensFlags, ModuleEntry... opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_OPENS location, or the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageDesc opens, int opensFlags, List<ModuleDesc> opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, if it is a qualified open, or empty
Returns:
a module open description
Throws:
IllegalArgumentException - if opensFlags is not u2 or if the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageDesc opens, Collection<AccessFlag> opensFlags, List<ModuleDesc> opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the modules to which this package is opened, if it is a qualified open, or empty
Returns:
a module open description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_OPENS location, or the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageDesc opens, int opensFlags, ModuleDesc... opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the packages to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if opensFlags is not u2 or if the number of modules exceeds the limit of u2

of

static ModuleOpenInfo of(PackageDesc opens, Collection<AccessFlag> opensFlags, ModuleDesc... opensTo)
Returns a module open description.
Parameters:
opens - the package to open
opensFlags - the open flags
opensTo - the packages to which this package is opened, or empty if this is an unqualified open
Returns:
a module open description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_OPENS location, or the number of modules exceeds the limit of u2

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API