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

FP S2226 when field is annotated with @Inject

    Details

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

      Description

      In practice when a field is annotated with @Inject it won't be mutated.
      So fields annotated with this annotation should not raise issue RSPEC-2226. See the linked google group threads for explanation. This makes a lot of noise when this rule is ran on a JEE project.

      public class MyServlet extends HttpServlet {
      
          private @Inject MyService myService;
      //...
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nicolas.peru Nicolas Peru
                Reporter:
                nicolas.peru Nicolas Peru
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: