void (PsiExpression expression) { final PsiType expressionType = expression.getType(); if (!TypeConversionUtil.isAssignableFromPrimitiveWrapper(expressionType)) { return; } final PsiType expectedType = ExpectedTypeUtils.findExpectedType(expression, false, true); if (!TypeConversionUtil.isPrimitiveAndNotNull(expectedType)) { return; } if (!(PsiUtil.skipParenthesizedExprUp(expression.getParent()) instanceof PsiTypeCastExpression)) { final PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(expressionType); if (unboxedType == null || !expectedType.isAssignableFrom(unboxedType)) { return; } } registerError(expression, expression); }