All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.S1610.html Maven / Gradle / Ivy

There is a newer version: 8.6.0.37351
Show newest version

With Java 8's "default method" feature, any abstract class without direct or inherited field should be converted into an interface.

Note that this rule is automatically disabled when the project's java.source.version is lower than 8.

Noncompliant Code Example

public abstract class Car {
  public abstract void start(Environment c);

  public void stop(Environment c) {
    c.freeze(this);
  }
}

Compliant Solution

public interface Car {
  public void start(Environment c);

  public default void stop(Environment c) {
    c.freeze(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy