com.sun.source.tree.ModuleTree.ModuleKind Java Examples

The following examples show how to use com.sun.source.tree.ModuleTree.ModuleKind. 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: JCTree.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected JCModuleDecl(JCModifiers mods, ModuleKind kind,
        JCExpression qualId, List<JCDirective> directives) {
    this.mods = mods;
    this.kind = kind;
    this.qualId = qualId;
    this.directives = directives;
}
 
Example #6
Source File: TreeMaker.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind,
        JCExpression qualid, List<JCDirective> directives) {
    JCModuleDecl tree = new JCModuleDecl(mods, kind, qualid, directives);
    tree.pos = pos;
    return tree;
}
 
Example #7
Source File: JCTree.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected JCModuleDecl(JCModifiers mods, ModuleKind kind,
        JCExpression qualId, List<JCDirective> directives) {
    this.mods = mods;
    this.kind = kind;
    this.qualId = qualId;
    this.directives = directives;
}
 
Example #8
Source File: TreeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind,
        JCExpression qualid, List<JCDirective> directives) {
    JCModuleDecl tree = new JCModuleDecl(mods, kind, qualid, directives);
    tree.pos = pos;
    return tree;
}
 
Example #9
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));
}
 
Example #10
Source File: JCTree.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public ModuleKind getModuleType() {
    return kind;
}
 
Example #11
Source File: JCTree.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public ModuleKind getModuleType() {
    return kind;
}
 
Example #12
Source File: JCTree.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License votes vote down vote up
JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives); 
Example #13
Source File: JCTree.java    From openjdk-jdk9 with GNU General Public License v2.0 votes vote down vote up
JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives);