Java Code Examples for com.sun.source.doctree.ParamTree#getName()
The following examples show how to use
com.sun.source.doctree.ParamTree#getName() .
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: Checker.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 2
Source File: Checker.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 3
Source File: Checker.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 4
Source File: ImmutableDocTreeTranslator.java From netbeans with Apache License 2.0 | 5 votes |
protected final ParamTree rewriteChildren(ParamTree tree) { ParamTree value = tree; IdentifierTree name = (IdentifierTree) translate(tree.getName()); List<? extends DocTree> description = translateDoc(tree.getDescription()); if (name != tree.getName() || description != tree.getDescription()) { value = make.Param(tree.isTypeParameter(), name, description); } return value; }
Example 5
Source File: Checker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 6
Source File: Checker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override @DefinedBy(Api.COMPILER_TREE) @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { boolean unique = foundParams.add(paramElement); if (!unique) { env.messages.warning(REFERENCE, tree, "dc.exists.param", nameTree); } } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 7
Source File: Checker.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 8
Source File: Checker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 9
Source File: Checker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("fallthrough") public Void visitParam(ParamTree tree, Void ignore) { boolean typaram = tree.isTypeParameter(); IdentifierTree nameTree = tree.getName(); Element paramElement = nameTree != null ? env.trees.getElement(new DocTreePath(getCurrentPath(), nameTree)) : null; if (paramElement == null) { switch (env.currElement.getKind()) { case CLASS: case INTERFACE: { if (!typaram) { env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } case METHOD: case CONSTRUCTOR: { env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); break; } default: env.messages.error(REFERENCE, tree, "dc.invalid.param"); break; } } else { foundParams.add(paramElement); } warnIfEmpty(tree, tree.getDescription()); return super.visitParam(tree, ignore); }
Example 10
Source File: JavadocConverter.java From j2objc with Apache License 2.0 | 5 votes |
@Override public Void visitParam(ParamTree node, TagElement tag) { IdentifierTree identifier = node.getName(); if (identifier == null || node.isTypeParameter()) { return null; } List<? extends VariableElement> params = element instanceof ExecutableElement ? ((ExecutableElement) element).getParameters() : Collections.emptyList(); tag.setTagKind(TagElement.TagKind.PARAM); String name = identifier.toString(); VariableElement param = null; for (VariableElement p : params) { if (name.equals(p.getSimpleName().toString())) { param = p; break; } } // param will be null if the @param tag refers to a nonexistent parameter. TreeNode nameNode = param != null ? new SimpleName(param) : new SimpleName(name); setPos(identifier, nameNode); tag.addFragment(nameNode); scan(node.getDescription(), tag); int lastEnd = nameNode.getStartPosition(); for (TreeNode fragment : tag.getFragments()) { // Fix up positions to match JDT's. // TODO(tball): remove and fix JavadocGenerator after javac switch. if (fragment.getKind() == TreeNode.Kind.TEXT_ELEMENT) { TextElement text = (TextElement) fragment; text.setText(" " + text.getText()); text.setSourceRange(text.getStartPosition(), text.getLength() + 1); } int thisEnd = lastEnd + fragment.getLength(); setPos(fragment, lastEnd, thisEnd); lastEnd = thisEnd; } setPos(tag, pos(node), endPos(node)); tag.setLineNumber(nameNode.getLineNumber()); return null; }