Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3141

FP S1172: ignore method used through method reference

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.14
    • Component/s: Rules
    • Labels:
      None

      Description

      When a method is used through a method reference it might mean that this method should conform to some particular parameter signature. In that case not all parameters can be used in that method implementation, which will lead to FP for RSPEC-1172.

      import java.util.function.BiConsumer;
      
      public class Example {
      
        void foo() {
          BiConsumer<String, String> m = this::method;
        }
      
        private void method(String a, String b) { // we should ignore this method as it is used by reference
          System.out.println(a);
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael.gumowski Michael Gumowski
                Reporter:
                elena.vilchik Elena Vilchik
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: