When each of a pair of classes includes the other, a cycle is created. Class cycles make compilation difficult because each class requires the other to build correctly. Breaking a cycle may be as difficult as redesigning the classes in question, or it may be as simple as creating an interface for one of the classes to implement and the other to use.


== Noncompliant Code Example

----
// A.java
  import B;
  // ..

// B.java
  import A; // Noncompliant
----


== Compliant Solution

----
// A.java
  import MyInterface;
  // ..

// MyInterface.java
  interface MyInterface {
    //...

// B.java
  import A;
  import MyInterface;

  public class B implements MyInterface {
    //...
----

