1

sonarQube(4)常用api-其他

 2 years ago
source link: https://wakzz.cn/2017/10/03/sonarQube/(4)%E5%B8%B8%E7%94%A8api-%E5%85%B6%E4%BB%96/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

sonarQube(4)常用api-其他

祈雨的博客
2017-10-03

1、获取成员变量类型

@Override
public void visitNode(Tree tree) {
if (tree instanceof VariableTree) {
VariableTree variableTree = (VariableTree) tree;
System.out.println(variableTree.symbol().type().fullyQualifiedName());
}
}

2、获取节点的行号

@Override
public void visitNode(Tree tree) {
//获取该节点开始行,例如某方法的第一行行号
System.out.println(tree.firstToken().line());
//获取该节点结束行,例如某方法的最后一行行号
System.out.println(tree.lastToken().line());
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK