title: SonarQube (Sonar) + EclipseLink: incorrect error 'Comparison of String parameter using == or !='
body: <p>I have the following class, using EclipseLink JPA: </p>
  
  <pre><code>package my.package;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.SequenceGenerator;
  import javax.persistence.Version;
  
  import my.package.api.Address;
  
  @Entity(name = "Address")
  @SequenceGenerator(name = "sequence", sequenceName = "seq_address")
  public class AddressJpaEntity implements Address {
  
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
      private Long id;
      @Version
      private Long version;
      private String street;
  
      public AddressJpaEntity() {
      }
  
      public AddressJpaEntity(String street) {
          this.street = street;
      }
  
      @Override
      public Long getId() {
          return id;
      }
  
      public Long getVersion() {
          return version;
      }
  
      public void setVersion(Long version) {
          this.version = version;
      }
  
      @Override
      public String getStreet() {
          return street;
      }
  
      @Override
      public void setStreet(String street) {
          this.street = street;
      }
  
  }
  </code></pre>
  
  <p>When I do a SonarQube-run, I get a lot of the following (incorrect) errors:</p>
  
  <blockquote>
    <p>Bad practice - Comparison of String parameter using == or != </p>
    
    <p>This code compares a java.lang.String parameter for reference equality using the == or != operators. Requiring callers to pass only String constants or interned strings to a method is unnecessarily fragile, and rarely leads to measurable performance gains. Consider using the equals(Object) method instead.</p>
    
    <p>findbugs | ES_COMPARING_PARAMETER_STRING_WITH_EQ
    Comparison of String parameter using == or != in  my.package.AddressJpaEntity._persistence_set(String, Object)</p>
  </blockquote>
  
  <p>For now, I solved it by setting the issues as false positive, but we will add more similar classes in the future and I don't want to do this each time.</p>
  
  <p>How can I make Sonar not mark these errors, without using 'False positive' all the time?</p>