private Description doUnboxingCheck ( VisitorState state , ExpressionTree ... expressions ) { for ( ExpressionTree tree : expressions ) { Type type = ASTHelpers . getType ( tree ) ; if ( type == null ) { throw new RuntimeException ( "was not expecting null type" ) ; } if ( ! type . isPrimitive ( ) ) { if ( mayBeNullExpr ( state , tree ) ) { final ErrorMessage errorMessage = new ErrorMessage ( MessageTypes . UNBOX_NULLABLE , "unboxing of a @Nullable value" ) ; return errorBuilder . createErrorDescription ( errorMessage , state . getPath ( ) , buildDescription ( tree ) ) ; } } } return Description . NO_MATCH ; }
if any expression has non - primitive type we should check that it can t be null as it is getting unboxed