use of org.sonar.plugins.java.api.tree.LiteralTree in project sonar-java by SonarSource.
the class UnderscoreOnNumberCheck method visitNode.
@Override
public void visitNode(Tree tree) {
LiteralTree literalTree = (LiteralTree) tree;
String value = literalTree.value();
if (!containsUnderscore(value) && !isSerialVersionUID(tree) && shouldUseUnderscore(value)) {
reportIssue(literalTree, "Add underscores to this numeric value for readability");
}
}
use of org.sonar.plugins.java.api.tree.LiteralTree in project sonar-java by SonarSource.
the class WeakSSLContextCheck method visitNode.
@Override
public void visitNode(Tree tree) {
if (hasSemantic()) {
MethodInvocationTree mit = (MethodInvocationTree) tree;
Arguments arguments = mit.arguments();
if (SSLCONTEXT_GETINSTANCE_MATCHER.matches(mit)) {
ExpressionTree firstArgument = arguments.get(0);
if (firstArgument.is(Tree.Kind.STRING_LITERAL) && !STRONG_PROTOCOLS.contains(trimQuotes(((LiteralTree) firstArgument).value()))) {
reportIssue(firstArgument, "Change this code to use a stronger protocol.");
}
}
}
}
Aggregations