Class MethodTreeUtils

java.lang.Object
org.sonar.java.checks.helpers.MethodTreeUtils

public final class MethodTreeUtils extends Object
  • Method Details

    • isMainMethod

      public static boolean isMainMethod(MethodTree m)
    • parentMethodInvocationOfArgumentAtPos

      @Nullable public static MethodInvocationTree parentMethodInvocationOfArgumentAtPos(@Nullable ExpressionTree argumentCandidate, int expectedArgumentPosition)
      Returns:
      null when: - argumentCandidate is null - the parent is not a method invocation (ignoring parent parentheses) - argumentCandidate is not at the expected argument position Otherwise, returns the parent method invocation.
    • lamdaArgumentAt

      @Nullable public static VariableTree lamdaArgumentAt(@Nullable LambdaExpressionTree lambdaExpressionTree, int argumentPosition)
    • isEqualsMethod

      public static boolean isEqualsMethod(MethodTree m)
    • isHashCodeMethod

      public static boolean isHashCodeMethod(MethodTree m)
    • isSetterMethod

      public static boolean isSetterMethod(MethodTree m)
    • consecutiveMethodInvocation

      public static Optional<MethodInvocationTree> consecutiveMethodInvocation(Tree tree)
    • subsequentMethodInvocation

      public static Optional<MethodInvocationTree> subsequentMethodInvocation(Tree tree, MethodMatchers methodMatchers)