本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCModuleDecl.getModuleType方法的典型用法代码示例。如果您正苦于以下问题:Java JCModuleDecl.getModuleType方法的具体用法?Java JCModuleDecl.getModuleType怎么用?Java JCModuleDecl.getModuleType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.tree.JCTree.JCModuleDecl
的用法示例。
在下文中一共展示了JCModuleDecl.getModuleType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitModuleDef
import com.sun.tools.javac.tree.JCTree.JCModuleDecl; //导入方法依赖的package包/类
@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();
}
示例2: diffModuleDef
import com.sun.tools.javac.tree.JCTree.JCModuleDecl; //导入方法依赖的package包/类
protected int diffModuleDef(JCModuleDecl oldT, JCModuleDecl newT, int[] bounds) {
int localPointer = bounds[0];
int[] qualBounds = getBounds(oldT.qualId);
if (oldT.getModuleType() == newT.getModuleType()) {
copyTo(localPointer, qualBounds[0]);
} else {
if (oldT.getModuleType() == ModuleTree.ModuleKind.OPEN) {
//removing "open":
moveFwdToToken(tokenSequence, localPointer, JavaTokenId.OPEN);
copyTo(localPointer, tokenSequence.offset());
} else {
copyTo(localPointer, qualBounds[0]);
printer.print("open ");
}
}
localPointer = diffTree(oldT.qualId, newT.qualId, qualBounds);
int insertHint = oldT.directives.isEmpty() ? endPos(oldT) - 1 : oldT.directives.get(0).getStartPosition() - 1;
tokenSequence.move(insertHint);
tokenSequence.moveNext();
insertHint = moveBackToToken(tokenSequence, insertHint, JavaTokenId.LBRACE) + 1;
int old = printer.indent();
PositionEstimator est = EstimatorFactory.members(oldT.directives, newT.directives, diffContext);
localPointer = copyUpTo(localPointer, insertHint);
// diff inner comments
insertHint = diffInnerComments(oldT, newT, insertHint);
localPointer = diffList(oldT.directives, newT.directives, insertHint, est, Measure.REAL_MEMBER, printer);
printer.undent(old);
if (localPointer != -1 && localPointer < origText.length()) {
if (origText.charAt(localPointer) == '}') {
// another stupid hack
printer.toLeftMargin();
}
copyTo(localPointer, bounds[1]);
}
return bounds[1];
}