After further investigation, I was initially mistaken.
The technical explanation for the behavior you noticed is as follows
In the chapter "Java Language Specification" on Superclasses and Subclasses
The class C directly depends on the type of T if T is referred to in extends or implements in C either as a superclass, or as a superinterface, or as a qualifier in the full form of a superclass or superinterface.
Class C depends on the reference type T if any of the following is true:
C directly depends on TC directly depends on interface I , which depends (ยง9.1.3) on TC directly depends on the class D , which depends on T (using this definition recursively).
This is a compile-time error if the class depends on itself.
Take your full-name code for using types, assuming the classes were declared in the com.example package:
public class A implements com.example.B.BListener { public interface AListener {} } public class B implements com.example.A.AListener { public interface BListener {} }
Following the rules from JLS above
A directly dependent on BListener , as it is mentioned in its implements clause.A directly depends on B , as it is referred to as a qualifier in the fully qualified name of the superinterface ( BListener is com.example.B.BListener )B directly dependent on AListener , as it is mentioned in its implements clause.B directly depends on A , since it is referred to as a qualifier in the fully qualified name of the superinterface ( AListener is com.example.A.AListener )A directly depends on B , which depends on A
Therefore, A depends on A and a compilation error should occur.
In Eclipse, an error occurs if you qualify names
class A implements B.BListener { public static interface AListener { } } class B implements A.AListener { public static interface BListener { } }
If you use import statements, however, this is not the case. I will open a mistake with them.
source share