Reports public methods in classes which are not exposed as in interface. Exposing all public methods via interface is important for maintaining loose coupling, and may be necessary for certain component-based programming styles.

Example:

interface Person {
  String getName();
}
  
class PersonImpl implements Person {
  private String name;
  
  // ok: the method is exposed in the interface
  @Override
  public String getName() {
    return name;
  }
  
  // warning: the method is public but not exposed in the interface
  public void setName() {
    this.name = name;
  }
}

Use the list below to specify special annotations. Methods annotated with one of these annotations will be ignored by this inspection.

Use the checkbox below to ignore methods of which the containing class does not implement a non-library interface.