According to the sleep mode documentation, this is the getClass () method in the org.hibernate.Hibernate class.
public static Class getClass(Object proxy) { if ( proxy instanceof HibernateProxy ) { return ( ( HibernateProxy ) proxy ).getHibernateLazyInitializer() .getImplementation() .getClass(); } else { return proxy.getClass(); } }
According to the documentation, a HibernateException is NestableRuntimeException in case of a null parameter, which is an extended class of NestableRuntimeException also a RuntimeException .
Intellij is able to analyze this using its code checks, it is easy to find that loc
entityClazz = Hibernate.getClass(bar);
will throw NPE. If it throws an NPE, the if condition is never reached, since the NestableRuntimeException is an exception.
You can put an if condition above Hibernate.getClass (bar), which would be ideal for a null safe method.
Hope this clears up.
References
Hibernate documentation
Code Analysis - Intellij
Code Verification - Intellij
source share