I have the following classes:
public class User { public static final NonRegisteredUser NON_REG_USER = new NonRegisteredUser(); //... public static class NonRegisteredUser extends User { //... } }
And the code inspector detects this warning:
A reference to the NonRegisteredUser subclass from the superclass. The user initializer can lead to a dead end loading of classes.
What does it mean?
A deadlock can only happen if you have 2 threads, and one starts to load User, and one starts to load NonRegisteredUser. There is synchronization that will lead to a deadlock, but this requires separate threads. If loading occurs in one stream, there is no deadlock, since the stream has both locks.
User
NonRegisteredUser
, . , .
User.
, . , NonRegisteredUser User .
, . , NonRegisteredUser User ...
Source: https://habr.com/ru/post/1691467/More articles:Cannot start debugging on the web server. Visual Studio WITHOUT admin - c #Debugging a website on local IIS without administrative privileges - c #how to extend an object to a function as arguments? - javascriptSymfony Router redirects to http in https - httpR - combined fuzzy and exact match - matchingASP.NET Core API sending double quoted string - c #Replace the item and the following items in the list if the condition is met - pythonin APL how to turn a vector (of length n) into a diagonal matrix (nxn)? - jThe click handler does not start when the target element is moved - angularHow can I use a class from a vendor folder in a laravel project - phpAll Articles