Java Code Examples for com.sun.source.tree.ModuleTree.ModuleKind#OPEN

The following examples show how to use com.sun.source.tree.ModuleTree.ModuleKind#OPEN . 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: Pretty.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void visitModuleDef(JCModuleDecl tree) {
    try {
        printDocComment(tree);
        printAnnotations(tree.mods.annotations);
        if (tree.getModuleType() == ModuleKind.OPEN) {
            print("open ");
        }
        print("module ");
        printExpr(tree.qualId);
        if (tree.directives == null) {
            print(";");
        } else {
            printBlock(tree.directives);
        }
        println();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example 2
Source File: Modules.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void visitModuleDef(JCModuleDecl tree) {
    sym = Assert.checkNonNull(tree.sym);

    if (tree.getModuleType() == ModuleKind.OPEN) {
        sym.flags.add(ModuleFlags.OPEN);
    }
    sym.flags_field |= (tree.mods.flags & Flags.DEPRECATED);

    sym.requires = List.nil();
    sym.exports = List.nil();
    sym.opens = List.nil();
    StreamSupport.stream(tree.directives).forEach(t -> t.accept(this));
    sym.requires = sym.requires.reverse();
    sym.exports = sym.exports.reverse();
    sym.opens = sym.opens.reverse();
    ensureJavaBase();
}
 
Example 3
Source File: Pretty.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitModuleDef(JCModuleDecl tree) {
    try {
        printDocComment(tree);
        printAnnotations(tree.mods.annotations);
        if (tree.getModuleType() == ModuleKind.OPEN) {
            print("open ");
        }
        print("module ");
        printExpr(tree.qualId);
        if (tree.directives == null) {
            print(";");
        } else {
            printBlock(tree.directives);
        }
        println();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example 4
Source File: Modules.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitModuleDef(JCModuleDecl tree) {
    sym = Assert.checkNonNull(tree.sym);

    if (tree.getModuleType() == ModuleKind.OPEN) {
        sym.flags.add(ModuleFlags.OPEN);
    }
    sym.flags_field |= (tree.mods.flags & Flags.DEPRECATED);

    sym.requires = List.nil();
    sym.exports = List.nil();
    sym.opens = List.nil();
    tree.directives.forEach(t -> t.accept(this));
    sym.requires = sym.requires.reverse();
    sym.exports = sym.exports.reverse();
    sym.opens = sym.opens.reverse();
    ensureJavaBase();
}
 
Example 5
Source File: JavacModuleParser.java    From pro with GNU General Public License v3.0 5 votes vote down vote up
public void visitModule(ModuleTree node, TreeVisitor<?, ?> visitor) {
  var name = qualifiedString(node.getName());
  var flags = node.getModuleType() == ModuleKind.OPEN? ACC_OPEN: 0;
  
  mv = moduleClassVisitor.visitModule(name, flags, null);
  
  node.getDirectives().forEach(n -> accept(visitor, n));
}