public static boolean isValidPropertyReference(
     @NotNull Project project,
     @NotNull PsiLiteralExpression expression,
     @NotNull String key,
     @NotNull Ref<String> outResourceBundle) {
   final HashMap<String, Object> annotationAttributeValues = new HashMap<String, Object>();
   annotationAttributeValues.put(AnnotationUtil.PROPERTY_KEY_RESOURCE_BUNDLE_PARAMETER, null);
   if (mustBePropertyKey(project, expression, annotationAttributeValues)) {
     final Object resourceBundleName =
         annotationAttributeValues.get(AnnotationUtil.PROPERTY_KEY_RESOURCE_BUNDLE_PARAMETER);
     if (!(resourceBundleName instanceof PsiExpression)) {
       return false;
     }
     PsiExpression expr = (PsiExpression) resourceBundleName;
     final Object value =
         JavaPsiFacade.getInstance(expr.getProject())
             .getConstantEvaluationHelper()
             .computeConstantExpression(expr);
     if (value == null) {
       return false;
     }
     String bundleName = value.toString();
     outResourceBundle.set(bundleName);
     return isPropertyRef(expression, key, bundleName);
   }
   return true;
 }
 @Nullable
 private static PsiType getQualifierCastType(
     PsiJavaReference javaReference, CompletionParameters parameters) {
   if (javaReference instanceof PsiReferenceExpression) {
     final PsiReferenceExpression refExpr = (PsiReferenceExpression) javaReference;
     final PsiExpression qualifier = refExpr.getQualifierExpression();
     if (qualifier != null) {
       final Project project = qualifier.getProject();
       PsiType type = null;
       final PairFunction<PsiExpression, CompletionParameters, PsiType> evaluator =
           refExpr.getContainingFile().getCopyableUserData(DYNAMIC_TYPE_EVALUATOR);
       if (evaluator != null) {
         type = evaluator.fun(qualifier, parameters);
       }
       if (type == null) {
         type = GuessManager.getInstance(project).getControlFlowExpressionType(qualifier);
       }
       return type;
     }
   }
   return null;
 }
  private static boolean processValuesFlownTo(
      @NotNull final PsiExpression argument,
      PsiElement scope,
      @NotNull final Processor<PsiExpression> processor) {
    SliceAnalysisParams params = new SliceAnalysisParams();
    params.dataFlowToThis = true;
    params.scope = new AnalysisScope(new LocalSearchScope(scope), argument.getProject());

    SliceRootNode rootNode =
        new SliceRootNode(
            scope.getProject(), new DuplicateMap(), SliceManager.createRootUsage(argument, params));

    Collection<? extends AbstractTreeNode> children =
        rootNode.getChildren().iterator().next().getChildren();
    for (AbstractTreeNode child : children) {
      SliceUsage usage = (SliceUsage) child.getValue();
      PsiElement element = usage.getElement();
      if (element instanceof PsiExpression && !processor.process((PsiExpression) element))
        return false;
    }

    return !children.isEmpty();
  }