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

FP in S1905 when casted argument is a method reference to a varargs.

    XMLWordPrintable

    Details

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

      Description

      In SONARJAVA-3468, we removed many FP with ambiguous method references.
      Hovewer, we are still reporting FP when the method reference is a varargs.

        static class Vargargs{
          static String varargs(String... arg) {
            return null;
          }
        }
      
        foo((Function<String, String>) Vargargs::varargs); // Compliant, cast is mandatory
        foo((Supplier<String>) Vargargs::varargs); // Compliant, cast is mandatory
      
        void foo(Supplier<String> supplier) {
        }
        void foo(Function<String, String> function) {
        }
      
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              margarita.nedzelska Margarita Nedzelska
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: