PsiVariable (PsiElement element) { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiLocalVariable) && !(parent instanceof PsiField)) { return null; } final PsiVariable var = (PsiVariable)element.getParent(); final PsiType type = var.getType(); if (!type.isValid()) return null; final PsiClass aClass = PsiTypesUtil.getPsiClass(type); if (aClass == null || !(AtomicLong.class.getName().equals(aClass.getQualifiedName()) || AtomicInteger.class.getName().equals(aClass.getQualifiedName()))) { return null; } final PsiExpression initializer = var.getInitializer(); if (initializer != null) { if (initializer instanceof PsiNewExpression) { return LongAdderConversionRule.getParametersCount((PsiCallExpression)initializer) == -1 ? null : var; } else { return null; } } return var; }