@Override protected void onMethodInvocationFound(MethodInvocationTree mit) { Type symbolType = mit.arguments().get(0).symbolType(); if (!(symbolType.is("long") || symbolType.is("java.lang.Long"))) { reportIssue(MethodsHelper.methodName(mit), "Remove this \"Double.longBitsToDouble\" call."); } }
@Override protected void onMethodInvocationFound(MethodInvocationTree mit) { Tree parent = mit.parent(); while (parent != null && !parent.is(Tree.Kind.METHOD)) { parent = parent.parent(); } if (parent != null && THREAD_RUN_METHOD_MATCHER.matches((MethodTree) parent)) { return; } reportIssue( MethodsHelper.methodName(mit), "Call the method Thread.start() to execute the content of the run() method in a dedicated thread."); }
@Override public void visitNode(Tree tree) { MethodInvocationTree methodTree = (MethodInvocationTree) tree; boolean isHibernateCall = isHibernateCall(methodTree); if (isHibernateCall || isExecuteQueryOrPrepareStatement(methodTree) || isEntityManagerCreateNativeQuery(methodTree)) { // We want to check the argument for the three methods. ExpressionTree arg = methodTree.arguments().get(0); parameterName = ""; if (isDynamicString(methodTree, arg, null, true)) { String message = "\"" + parameterName + "\" is provided externally to the method and not sanitized before use."; if (isHibernateCall) { message = "Use Hibernate's parameter binding instead of concatenation."; } reportIssue(MethodsHelper.methodName(methodTree), message); } } }
@Override protected void onMethodInvocationFound(MethodInvocationTree mit) { reportIssue(MethodsHelper.methodName(mit), "Remove this use of dynamic class loading."); }