Bag (@NotNull PsiElement usage, @NotNull PsiElement context) { final PsiElement parentControlStatement = PsiTreeUtil.findFirstParent(context, true, element -> element instanceof PsiConditionalLoopStatement || element instanceof PsiIfStatement); if (parentControlStatement instanceof PsiConditionalLoopStatement) { final PsiExpression conditionExpression = ((PsiConditionalLoopStatement)parentControlStatement).getCondition(); if (conditionExpression != null) { return new JavaSimilarityFeaturesExtractor(usage ,conditionExpression).getFeatures(); } } if (parentControlStatement instanceof PsiIfStatement) { final PsiExpression conditionExpression = ((PsiIfStatement)parentControlStatement).getCondition(); if (conditionExpression != null) { return new JavaSimilarityFeaturesExtractor(usage, conditionExpression).getFeatures(); } } return Bag.EMPTY_BAG; }