Object (@Nullable GrExpression expression) { GrExpression operand = skipParenthesesDownOrNull(expression); if (operand instanceof GrLiteral) { return ((GrLiteral)operand).getValue(); } if (operand instanceof GrUnaryExpression) { var evaluatedOperand = evaluate(((GrUnaryExpression)operand).getOperand()); if (((GrUnaryExpression)operand).getOperationTokenType() == GroovyElementTypes.T_MINUS && evaluatedOperand instanceof Number) { if (evaluatedOperand instanceof Integer) { return -(Integer)evaluatedOperand; } else if (evaluatedOperand instanceof Byte) { return -(Byte)evaluatedOperand; } else if (evaluatedOperand instanceof Short) { return -(Short)evaluatedOperand; } else if (evaluatedOperand instanceof Long) { return -(Long)evaluatedOperand; } else if (evaluatedOperand instanceof Double) { return -(Double)evaluatedOperand; } else if (evaluatedOperand instanceof Float) { return -(Float)evaluatedOperand; } } } if (expression instanceof GrReferenceExpression) { PsiElement resolved = ((GrReferenceExpression)expression).resolve(); if (resolved instanceof PsiField) { return ((PsiField)resolved).computeConstantValue(); } } return null; }