Spec-Zone.ru › OpenJDK 25

Interface ModuleRequireInfo

public sealed interface ModuleRequireInfo
Models a single "requires" declaration in the ModuleAttribute.
See Java Virtual Machine Specification:
4.7.25 The Module Attribute
Since:
24
See Also:
  • ModuleAttribute.requires()
  • ModuleDescriptor.requires()

Method Summary

Modifier and Type Method Description
default boolean has(AccessFlag flag)
Returns whether the specific access flag is set.
static ModuleRequireInfo of(ModuleEntry requires, int requiresFlags, Utf8Entry requiresVersion)
Returns a module requirement description.
static ModuleRequireInfo of(ModuleEntry requires, Collection<AccessFlag> requiresFlags, Utf8Entry requiresVersion)
Returns a module requirement description.
static ModuleRequireInfo of(ModuleDesc requires, int requiresFlags, String requiresVersion)
Returns a module requirement description.
static ModuleRequireInfo of(ModuleDesc requires, Collection<AccessFlag> requiresFlags, String requiresVersion)
Returns a module requirement description.
ModuleEntry requires()
Returns The module on which the current module depends.
default Set<AccessFlag> requiresFlags()
Returns the flags associated with this require declaration, as a set of flag enums.
int requiresFlagsMask()
Returns the flags associated with this require declaration, as a bit mask.
Optional<Utf8Entry> requiresVersion()
Returns the required version of the required module, if present.

Method Details

requires

ModuleEntry requires()
Returns The module on which the current module depends.
Returns:
The module on which the current module depends

requiresFlagsMask

int requiresFlagsMask()
Returns the flags associated with this require declaration, as a bit mask. It is in the range of unsigned short, [0, 0xFFFF].
Returns:
the flags associated with this require declaration, as a bit mask
See Also:
  • ModuleDescriptor.Requires.modifiers()
  • AccessFlag.Location.MODULE_REQUIRES

requiresFlags

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

requiresVersion

Optional<Utf8Entry> requiresVersion()
Returns the required version of the required module, if present.
Returns:
the required version of the required module, if present
See Also:
  • ModuleDescriptor.Requires.rawCompiledVersion()

has

default boolean has(AccessFlag flag)
Returns whether the specific access flag is set.
Parameters:
flag - the access flag
Returns:
whether the specific access flag is set
See Also:
  • AccessFlag.Location.MODULE_REQUIRES

of

static ModuleRequireInfo of(ModuleEntry requires, int requiresFlags, Utf8Entry requiresVersion)
Returns a module requirement description.
Parameters:
requires - the required module
requiresFlags - the require-specific flags
requiresVersion - the required version, may be null
Returns:
a module requirement description

of

static ModuleRequireInfo of(ModuleEntry requires, Collection<AccessFlag> requiresFlags, Utf8Entry requiresVersion)
Returns a module requirement description.
Parameters:
requires - the required module
requiresFlags - the require-specific flags
requiresVersion - the required version, may be null
Returns:
a module requirement description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_REQUIRES location

of

static ModuleRequireInfo of(ModuleDesc requires, int requiresFlags, String requiresVersion)
Returns a module requirement description.
Parameters:
requires - the required module
requiresFlags - the require-specific flags
requiresVersion - the required version, may be null
Returns:
a module requirement description

of

static ModuleRequireInfo of(ModuleDesc requires, Collection<AccessFlag> requiresFlags, String requiresVersion)
Returns a module requirement description.
Parameters:
requires - the required module
requiresFlags - the require-specific flags
requiresVersion - the required version, may be null
Returns:
a module requirement description
Throws:
IllegalArgumentException - if any flag cannot be applied to the AccessFlag.Location.MODULE_REQUIRES location

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, 2025, 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.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/attribute/ModuleRequireInfo.html

Spec-Zone.ru

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