Non-abstract classes and enums with non-``++static++``, ``++private++`` members should explicitly initialize those members, either in a constructor or with a default value.

== Noncompliant Code Example

----
class A { // Noncompliant
  private int field;
}
----

== Compliant Solution

----
class A {
  private int field;

  A(int field) {
    this.field = field;
  }
}
----

== Exceptions

* Class implementing a Builder Pattern (name ending with "Builder").
* https://docs.oracle.com/javaee/7/tutorial/index.html[Java EE] class annotated with:
** https://docs.oracle.com/javaee/7/api/javax/annotation/ManagedBean.html[ManagedBean]
** https://docs.oracle.com/javaee/7/api/javax/ejb/MessageDriven.html[MessageDriven]
** https://docs.oracle.com/javaee/7/api/javax/ejb/Singleton.html[Singleton]
** https://docs.oracle.com/javaee/7/api/javax/ejb/Stateful.html[Stateful]
** https://docs.oracle.com/javaee/7/api/javax/ejb/Stateless.html[Stateless]
** https://docs.oracle.com/javaee/7/api/javax/jws/WebService.html[WebService]
** https://docs.oracle.com/javaee/7/api/javax/servlet/annotation/WebFilter.html[WebFilter]
** https://docs.oracle.com/javaee/7/api/javax/servlet/annotation/WebServlet.html[WebServlet]

* Class and field annotated with:
** https://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/index.html[Plexus Component Annotations]
** https://maven.apache.org/developers/mojo-api-specification.html[Maven Mojo]

* Field annotated with:
** https://docs.oracle.com/javaee/7/api/javax/annotation/Resource.html[Resource]
** https://docs.oracle.com/javaee/7/api/javax/ejb/EJB.html[EJB]
** https://docs.oracle.com/javaee/7/api/javax/inject/Inject.html[Inject]
** https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html[Autowired]

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
