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

The following examples show how to use java.lang.module.ModuleDescriptor.Exports#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 newExports(Set<Exports.Modifier> ms, String pn, Set<String> targets) {
    int modifiersSetIndex = dedupSetBuilder.indexOfExportsModifiers(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,
            "newExports", EXPORTS_MODIFIER_SET_STRING_SET_SIG, false);
    } else {
        mv.visitVarInsn(ALOAD, modifiersSetIndex);
        mv.visitLdcInsn(pn);
        mv.visitMethodInsn(INVOKESTATIC, MODULE_DESCRIPTOR_BUILDER,
            "newExports", EXPORTS_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 Exports exports(Set<Exports.Modifier> mods, String pn) {
    return ModuleDescriptor.newModule("foo")
        .exports(mods, pn)
        .build()
        .exports()
        .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 Exports exports(Set<Exports.Modifier> mods, String pn, String target) {
    return ModuleDescriptor.newModule("foo")
        .exports(mods, pn, Set.of(target))
        .build()
        .exports()
        .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(Exports.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 a {@link Exports} for a qualified export, with
 * the given (and possibly empty) set of modifiers,
 * to a set of target modules.
 */
public static Exports newExports(Set<Exports.Modifier> ms,
                                 String pn,
                                 Set<String> targets) {
    return JLMA.newExports(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 a {@link Exports} for a qualified export, with
 * the given (and possibly empty) set of modifiers,
 * to a set of target modules.
 */
public static Exports newExports(Set<Exports.Modifier> ms,
                                 String pn,
                                 Set<String> targets) {
    return JLMA.newExports(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 exportsModifiers(Set<Exports.Modifier> mods) {
    exportsModifiersSets.computeIfAbsent(mods, s ->
                    new EnumSetBuilder<>(s, EXPORTS_MODIFIER_CLASSNAME,
                            enumSetVar, localVarSupplier)
    ).increment();
}
 
Example 8
Source File: SystemModulesPlugin.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
int indexOfExportsModifiers(Set<Exports.Modifier> mods) {
    return exportsModifiersSets.get(mods).build();
}
 
Example 9
Source File: Builder.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@link Exports} for an unqualified export with a given set
 * of modifiers.
 */
public static Exports newExports(Set<Exports.Modifier> ms, String pn) {
    return JLMA.newExports(ms, pn);
}
 
Example 10
Source File: JavaLangModuleAccess.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an unqualified {@code ModuleDescriptor.Exports}
 * of the given modifiers and package name source.
 */
Exports newExports(Set<Exports.Modifier> ms,
                   String source);
 
Example 11
Source File: JavaLangModuleAccess.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a qualified {@code ModuleDescriptor.Exports}
 * of the given modifiers, package name source and targets.
 */
Exports newExports(Set<Exports.Modifier> ms,
                   String source,
                   Set<String> targets);
 
Example 12
Source File: Builder.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@link Exports} for an unqualified export with a given set
 * of modifiers.
 */
public static Exports newExports(Set<Exports.Modifier> ms, String pn) {
    return JLMA.newExports(ms, pn);
}
 
Example 13
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.Exports}
 * of the given modifiers and package name source.
 */
Exports newExports(Set<Exports.Modifier> ms,
                   String source);
 
Example 14
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.Exports}
 * of the given modifiers, package name source and targets.
 */
Exports newExports(Set<Exports.Modifier> ms,
                   String source,
                   Set<String> targets);