private static TreePath adjustPathForModuleName(TreePath path) { TreePath tp = path; while (tp != null && (tp.getLeaf().getKind() == Kind.IDENTIFIER || tp.getLeaf().getKind() == Kind.MEMBER_SELECT)) { Tree parent = tp.getParentPath().getLeaf(); if (parent.getKind() == Kind.MODULE && ((ModuleTree)parent).getName() == tp.getLeaf()) { return tp.getParentPath(); } if (parent.getKind() == Kind.REQUIRES && ((RequiresTree)parent).getModuleName() == tp.getLeaf() || parent.getKind() == Kind.EXPORTS && ((ExportsTree)parent).getModuleNames() != null && ((ExportsTree)parent).getModuleNames().contains(tp.getLeaf()) || parent.getKind() == Kind.OPENS && ((OpensTree)parent).getModuleNames() != null && ((OpensTree)parent).getModuleNames().contains(tp.getLeaf())) { return tp; } tp = tp.getParentPath(); } return path; }
@Override public Tree visitExports(ExportsTree tree, Void p) { ExportsTree n = make.Exports(tree.getPackageName(), tree.getModuleNames()); model.setType(n, model.getType(tree)); comments.copyComments(tree, n); model.setPos(n, model.getPos(tree)); return n; }
@Override public Void visitExports(ExportsTree tree, EnumSet<UseTypes> d) { tl.moveToOffset(sourcePositions.getStartPosition(info.getCompilationUnit(), tree)); Token t = firstIdentifierToken("exports"); //NOI18N if (t != null) { contextKeywords.add(t); } scan(tree.getPackageName(), d); tl.moveToOffset(sourcePositions.getEndPosition(info.getCompilationUnit(), tree.getPackageName())); t = firstIdentifierToken("to"); //NOI18N if (t != null) { contextKeywords.add(t); } return scan(tree.getModuleNames(), d); }
@Override public Void visitExports(ExportsTree tree, List<Node> d) { List<Node> below = new ArrayList<Node>(); addCorrespondingType(below); addCorrespondingComments(below); super.visitExports(tree, below); d.add(new TreeNode(info, getCurrentPath(), below)); return null; }
@Override public List<? extends TypeMirror> visitExports(ExportsTree node, Object p) { return null; }
@Override public Mirror visitExports(ExportsTree node, EvaluationContext p) { Assert.error(node, "noModules"); return super.visitExports(node, p); }
@Override public Boolean visitExports(ExportsTree node, EvaluationContext p) { return Boolean.FALSE; }
public void visitExports(ExportsTree node, @SuppressWarnings("unused") TreeVisitor<?, ?> __) { mv.visitExport(qualifiedString(node.getPackageName()), 0, toArray(node.getModuleNames())); }