本文整理汇总了Java中com.sun.tools.javac.tree.DCTree.DCReference类的典型用法代码示例。如果您正苦于以下问题:Java DCReference类的具体用法?Java DCReference怎么用?Java DCReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DCReference类属于com.sun.tools.javac.tree.DCTree包,在下文中一共展示了DCReference类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitReference
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override
public Void visitReference(ReferenceTree node, Void p) {
//TODO: should use formatting settings:
DCReference refNode = (DCReference) node;
if (refNode.qualifierExpression != null) {
print(refNode.qualifierExpression);
}
if (refNode.memberName != null) {
print("#");
print(refNode.memberName);
}
if (refNode.paramTypes != null) {
print("(");
boolean first = true;
for (Tree param : refNode.paramTypes) {
if (!first) print(", ");
print(param.toString());
first = false;
}
print(")");
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:VeryPretty.java
示例2: rewriteChildren
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
protected final ReferenceTree rewriteChildren(ReferenceTree tree) {
DCReference refTree = (DCReference) tree;
ReferenceTree value = tree;
ExpressionTree classReference = (ExpressionTree) translate(refTree.qualifierExpression);
List<? extends Tree> methodParameters = translate(refTree.paramTypes);
if(classReference != refTree.qualifierExpression || methodParameters != refTree.paramTypes) {
value = make.Reference(classReference, refTree.memberName, methodParameters);
}
return value;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ImmutableDocTreeTranslator.java
示例3: findNameSpan
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
/**Find span of the name in the DocTree's reference tree (see {@link #getReferenceName(com.sun.source.util.DocTreePath)}
* identifier in the source. Returns starting and ending offset of the name in
* the source code that was parsed (ie. {@link CompilationInfo.getText()}, which
* may differ from the positions in the source document if it has been already
* altered.
*
* @param ref reference for which the identifier should be found
* @return the span of the name, or null if cannot be found
* @since 0.124
*/
public int[] findNameSpan(DocCommentTree docTree, ReferenceTree ref) {
Name name = ((DCReference) ref).memberName;
if (name == null || !SourceVersion.isIdentifier(name)) {
//names like "<error>", etc.
return null;
}
int pos = (int) info.getDocTrees().getSourcePositions().getStartPosition(info.getCompilationUnit(), docTree, ref);
if (pos < 0)
return null;
TokenSequence<JavaTokenId> tokenSequence = info.getTokenHierarchy().tokenSequence(JavaTokenId.language());
tokenSequence.move(pos);
if (!tokenSequence.moveNext() || tokenSequence.token().id() != JavaTokenId.JAVADOC_COMMENT) return null;
TokenSequence<JavadocTokenId> jdocTS = tokenSequence.embedded(JavadocTokenId.language());
jdocTS.move(pos);
boolean wasNext;
while ((wasNext = jdocTS.moveNext()) && jdocTS.token().id() != JavadocTokenId.HASH)
;
if (wasNext && jdocTS.moveNext()) {
if (jdocTS.token().id() == JavadocTokenId.IDENT &&
name.contentEquals(jdocTS.token().text())) {
return new int[] {
jdocTS.offset(),
jdocTS.offset() + jdocTS.token().length()
};
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:TreeUtilities.java
示例4: getReferenceClass
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
/**Find the type (the part before {@code #}) that is being referenced by the given {@link ReferenceTree}.
*
* @param path the leaf must be {@link ReferenceTree}
* @return the referred type, or {@code null} if none.
* @since 0.124
*/
public @CheckForNull ExpressionTree getReferenceClass(@NonNull DocTreePath path) {
TreePath tp = path.getTreePath();
DCReference ref = (DCReference) path.getLeaf();
((DocTrees) this.info.getTrees()).getElement(path);
// was:
// ((JavacTrees) this.info.getTrees()).ensureDocReferenceAttributed(tp, ref);
return (ExpressionTree) ref.qualifierExpression;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TreeUtilities.java
示例5: getReferenceParameters
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
/**Find the parameters that are specified in the given {@link ReferenceTree}.
*
* @param path the leaf must be {@link ReferenceTree}
* @return the parameters for the referred method, or {@code null} if none.
* @since 0.124
*/
public @CheckForNull List<? extends Tree> getReferenceParameters(@NonNull DocTreePath path) {
TreePath tp = path.getTreePath();
DCReference ref = (DCReference) path.getLeaf();
((DocTrees) this.info.getTrees()).getElement(path);
// was:
// ((JavacTrees) this.info.getTrees()).ensureDocReferenceAttributed(tp, ref);
return ref.paramTypes;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TreeUtilities.java
示例6: getElement
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override
public Element getElement(DocTreePath path) {
DocTree forTree = path.getLeaf();
if (forTree instanceof DCReference)
return attributeDocReference(path.getTreePath(), ((DCReference) forTree));
if (forTree instanceof DCIdentifier) {
if (path.getParentPath().getLeaf() instanceof DCParam) {
return attributeParamIdentifier(path.getTreePath(), (DCParam) path.getParentPath().getLeaf());
}
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:JavacTrees.java
示例7: newExceptionTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCThrows newExceptionTree(ReferenceTree name, List<? extends DocTree> description) {
// TODO: verify the reference is just to a type (not a field or method)
DCThrows tree = new DCThrows(Kind.EXCEPTION, (DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DocTreeMaker.java
示例8: newReferenceTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCReference newReferenceTree(String signature) {
try {
ReferenceParser.Reference ref = referenceParser.parse(signature);
DCReference tree = new DCReference(signature, ref.qualExpr, ref.member, ref.paramTypes);
tree.pos = pos;
return tree;
} catch (ReferenceParser.ParseException e) {
throw new IllegalArgumentException("invalid signature", e);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DocTreeMaker.java
示例9: newThrowsTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCThrows newThrowsTree(ReferenceTree name, List<? extends DocTree> description) {
// TODO: verify the reference is just to a type (not a field or method)
DCThrows tree = new DCThrows(Kind.THROWS, (DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DocTreeMaker.java
示例10: newValueTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCValue newValueTree(ReferenceTree ref) {
// TODO: verify the reference is to a constant value
DCValue tree = new DCValue((DCReference) ref);
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DocTreeMaker.java
示例11: getElement
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Element getElement(DocTreePath path) {
DocTree forTree = path.getLeaf();
if (forTree instanceof DCReference)
return attributeDocReference(path.getTreePath(), ((DCReference) forTree));
if (forTree instanceof DCIdentifier) {
if (path.getParentPath().getLeaf() instanceof DCParam) {
return attributeParamIdentifier(path.getTreePath(), (DCParam) path.getParentPath().getLeaf());
}
}
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JavacTrees.java
示例12: diffReference
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
private int diffReference(DCDocComment doc, DCReference oldT, DCReference newT, int[] elementBounds) {
printer.print(newT);
return elementBounds[1];
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CasualDiff.java
示例13: newLinkTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCLink newLinkTree(ReferenceTree ref, List<? extends DocTree> label) {
DCLink tree = new DCLink(Kind.LINK, (DCReference) ref, cast(label));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeMaker.java
示例14: newLinkPlainTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCLink newLinkPlainTree(ReferenceTree ref, List<? extends DocTree> label) {
DCLink tree = new DCLink(Kind.LINK_PLAIN, (DCReference) ref, cast(label));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeMaker.java
示例15: newProvidesTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCProvides newProvidesTree(ReferenceTree name, List<? extends DocTree> description) {
DCProvides tree = new DCProvides((DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeMaker.java
示例16: newSerialFieldTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCSerialField newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) {
DCSerialField tree = new DCSerialField((DCIdentifier) name, (DCReference) type, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeMaker.java
示例17: newUsesTree
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public DCUses newUsesTree(ReferenceTree name, List<? extends DocTree> description) {
DCUses tree = new DCUses((DCReference) name, cast(description));
tree.pos = pos;
return tree;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeMaker.java
示例18: getReferenceName
import com.sun.tools.javac.tree.DCTree.DCReference; //导入依赖的package包/类
/**Find the name (the name after {@code #}) that is being referenced by the given {@link ReferenceTree}.
*
* @param path the leaf must be {@link ReferenceTree}
* @return the referred member name, or {@code null} if none.
* @since 0.124
*/
public @CheckForNull Name getReferenceName(@NonNull DocTreePath path) {
return ((DCReference) path.getLeaf()).memberName;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TreeUtilities.java
注:本文中的com.sun.tools.javac.tree.DCTree.DCReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论