Java Code Examples for java.lang.module.ModuleDescriptor.Opens#Modifier

The following examples show how to use java.lang.module.ModuleDescriptor.Opens#Modifier . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemModulesPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void newOpens(Set<Opens.Modifier> ms, String pn, Set<String> targets) {
    int modifiersSetIndex = dedupSetBuilder.indexOfOpensModifiers(ms);
    if (!targets.isEmpty()) {
        int stringSetIndex = dedupSetBuilder.indexOfStringSet(targets);
        mv.visitVarInsn(ALOAD, modifiersSetIndex);
        mv.visitLdcInsn(pn);
        mv.visitVarInsn(ALOAD, stringSetIndex);
        mv.visitMethodInsn(INVOKESTATIC, MODULE_DESCRIPTOR_BUILDER,
            "newOpens", OPENS_MODIFIER_SET_STRING_SET_SIG, false);
    } else {
        mv.visitVarInsn(ALOAD, modifiersSetIndex);
        mv.visitLdcInsn(pn);
        mv.visitMethodInsn(INVOKESTATIC, MODULE_DESCRIPTOR_BUILDER,
            "newOpens", OPENS_MODIFIER_SET_STRING_SIG, false);
    }
}
 
Example 2
Source File: ModuleDescriptorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Opens opens(Set<Opens.Modifier> mods, String pn) {
    return ModuleDescriptor.newModule("foo")
            .opens(mods, pn)
            .build()
            .opens()
            .iterator()
            .next();
}
 
Example 3
Source File: ModuleDescriptorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Opens opens(Set<Opens.Modifier> mods, String pn, String target) {
    return ModuleDescriptor.newModule("foo")
            .opens(mods, pn, Set.of(target))
            .build()
            .opens()
            .iterator()
            .next();
}
 
Example 4
Source File: ModuleHelper.java    From pro with GNU General Public License v3.0 5 votes vote down vote up
private static int modifierToInt(Opens.Modifier modifier) {
  switch(modifier) {
  case MANDATED:
    return ACC_MANDATED;
  case SYNTHETIC:
    return ACC_SYNTHETIC;
  default:
    throw new IllegalStateException("unknown modifier " + modifier);
  }
}
 
Example 5
Source File: Builder.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns an {@link Opens} for a qualified opens, with
 * the given (and possibly empty) set of modifiers,
 * to a set of target modules.
 */
public static Opens newOpens(Set<Opens.Modifier> ms,
                             String pn,
                             Set<String> targets) {
    return JLMA.newOpens(ms, pn, targets);
}
 
Example 6
Source File: Builder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns an {@link Opens} for a qualified opens, with
 * the given (and possibly empty) set of modifiers,
 * to a set of target modules.
 */
public static Opens newOpens(Set<Opens.Modifier> ms,
                             String pn,
                             Set<String> targets) {
    return JLMA.newOpens(ms, pn, targets);
}
 
Example 7
Source File: SystemModulesPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void opensModifiers(Set<Opens.Modifier> mods) {
    opensModifiersSets.computeIfAbsent(mods, s ->
                    new EnumSetBuilder<>(s, OPENS_MODIFIER_CLASSNAME,
                            enumSetVar, localVarSupplier)
    ).increment();
}
 
Example 8
Source File: Builder.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an {@link Opens} for an unqualified open with a given set of
 * modifiers.
 */
public static Opens newOpens(Set<Opens.Modifier> ms, String pn) {
    return JLMA.newOpens(ms, pn);
}
 
Example 9
Source File: JavaLangModuleAccess.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an unqualified {@code ModuleDescriptor.Opens}
 * of the given modifiers and package name source.
 */
Opens newOpens(Set<Opens.Modifier> ms, String source);
 
Example 10
Source File: JavaLangModuleAccess.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a qualified {@code ModuleDescriptor.Opens}
 * of the given modifiers, package name source and targets.
 */
Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets);
 
Example 11
Source File: Builder.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns an {@link Opens} for an unqualified open with a given set of
 * modifiers.
 */
public static Opens newOpens(Set<Opens.Modifier> ms, String pn) {
    return JLMA.newOpens(ms, pn);
}
 
Example 12
Source File: JavaLangModuleAccess.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns an unqualified {@code ModuleDescriptor.Opens}
 * of the given modifiers and package name source.
 */
Opens newOpens(Set<Opens.Modifier> ms, String source);
 
Example 13
Source File: JavaLangModuleAccess.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a qualified {@code ModuleDescriptor.Opens}
 * of the given modifiers, package name source and targets.
 */
Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets);
 
Example 14
Source File: SystemModulesPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieve the index to the given set of Opens.Modifier.
 * Emit code to generate it when EnumSetBuilder::build is called.
 */
int indexOfOpensModifiers(Set<Opens.Modifier> mods) {
    return opensModifiersSets.get(mods).build();
}