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

NPE on S2293 when using parametrized types in lambda

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.10, 3.11
    • Fix Version/s: 3.13
    • Component/s: Rules
    • Labels:
      None

      Description

      the following code snippet generate a NPE:

      import java.util.ArrayList;
      import java.util.function.Function;
      
      public enum SonarProblemCase {
          MY_BUCKET(rp -> { return new ArrayList<Integer>(); }), // crashes
          MY_BUCKET2(rp -> new ArrayList<Integer>() ); // works fine
      
          SonarProblemCase(Function<Object,Object> bucketer) {
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.gumowski Michael Gumowski
              Reporter:
              michael.gumowski Michael Gumowski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: