boolean (@NotNull Project project, @NotNull PsiExpression expression, @NotNull String key, @NotNull Ref<? super String> outResourceBundle) { Ref<PsiAnnotationMemberValue> resourceBundleRef = Ref.create(); if (mustBePropertyKey(expression, resourceBundleRef)) { final Object resourceBundleName = resourceBundleRef.get(); if (!(resourceBundleName instanceof PsiExpression expr)) { return false; } final PsiConstantEvaluationHelper constantEvaluationHelper = JavaPsiFacade.getInstance(project).getConstantEvaluationHelper(); Object value = constantEvaluationHelper.computeConstantExpression(expr); if (value == null) { if (expr instanceof PsiReferenceExpression) { final PsiElement resolve = ((PsiReferenceExpression)expr).resolve(); if (resolve instanceof PsiField && ((PsiField)resolve).hasModifierProperty(PsiModifier.FINAL)) { value = constantEvaluationHelper.computeConstantExpression(((PsiField)resolve).getInitializer()); if (value == null) { return false; } } } if (value == null) { final ResourceBundle resourceBundle = resolveResourceBundleByKey(key, project); if (resourceBundle == null) { return false; } final PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile(); final String bundleName = BundleNameEvaluator.DEFAULT.evaluateBundleName(defaultPropertiesFile.getContainingFile()); if (bundleName == null) { return false; } value = bundleName; } } String bundleName = value.toString(); outResourceBundle.set(bundleName); return isPropertyRef(expression, key, bundleName); } return true; }