NumberConversionContext (@NotNull PsiElement element) { if (element instanceof PsiJavaToken) { element = element.getParent(); } PsiLiteralExpression literal = ObjectUtils.tryCast(element, PsiLiteralExpression.class); if (literal == null) return null; Number value = ObjectUtils.tryCast(literal.getValue(), Number.class); if (value == null) return null; if (ExpressionUtils.isNegative(literal)) { value = Objects.requireNonNull(JavaPsiMathUtil.negate(value)); return new NumberConversionContext(element.getParent(), value, literal.getText(), true); } return new NumberConversionContext(element, value, literal.getText(), false); }