Object (@Nullable UExpression expression, @NotNull Supplier<? extends PsiElement> accessPlace) { if (expression == null) return VALUE_IS_NOT_CONST; if (expression instanceof UExpressionList expressionList) { List<Object> exprValues = ContainerUtil.map(expressionList.getExpressions(), expr -> getAccessibleExpressionValue(expr, accessPlace)); return ContainerUtil.all(exprValues, value -> value == VALUE_IS_NOT_CONST) ? VALUE_IS_NOT_CONST : exprValues; } if (expression instanceof UReferenceExpression referenceExpression) { UElement resolved = UResolvableKt.resolveToUElement(referenceExpression); if (resolved instanceof UField uField) { PsiElement element = accessPlace.get(); if (uField.isStatic() && uField.isFinal()) { if (element == null || !isAccessible(uField, element)) { return VALUE_IS_NOT_CONST; } UDeclaration containingClass = UDeclarationKt.getContainingDeclaration(uField); if (containingClass instanceof UClass && ((UClass)containingClass).getQualifiedName() != null) { return uField; } } } } if (expression instanceof ULiteralExpression) { Object value = ((ULiteralExpression)expression).getValue(); if (value == null) { return null; } //don't unescape/escape to insert into the source file PsiElement sourcePsi = Objects.requireNonNull(expression.getSourcePsi()); return value instanceof String ? ("\"" + StringUtil.unquoteString(sourcePsi.getText()) + "\"") : convertToStringRepresentation(value); } Object value = expression.evaluate(); return value == null ? VALUE_IS_NOT_CONST : convertToStringRepresentation(value); }