I have this classes:
public class User {
public static final NonRegisteredUser NON_REG_USER = new NonRegisteredUser();
//...
public static class NonRegisteredUser extends User {
//...
}
}
And code inspector is detecting this warning:
Referencing subclass NonRegisteredUser from superclass User initializer might lead to class loading deadlock
What does it mean exactly?
NonRegisteredUser
in theUser
class. Every time you load theUser
class, since theNON_REG_USER
is static it will lead to an eternal loop cause theNonRegisteredUser
extends theUser
and so on.. – giannis christofakis Dec 28 '17 at 14:44