CheckForNull annotation in Adaptable.adaptTo
Hello,
I would like to discuss Adaptable.adaptTo().
This method has annotation CheckForNull.
For example I have some part of code:
Session session = resourceResolver.adaptTo(Session.class); Node node = session.getNode("somepath");Sonar will have blocker issue - NullPointerException might be thrown as 'session' is nullable here
From one side resourceResolver should always return non null Session (If it return null, that means that something wrong with AEM instance).
From the other side checkfornull force to add additional check that session != null.
Should we add check for null in current situation or not?
Thanks