PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitCallExpression(@NotNull PsiCallExpression callExpression) { final PsiExpressionList argumentList = callExpression.getArgumentList(); final PsiMethod method = callExpression.resolveMethod(); if (method != null && argumentList != null && (method.isConstructor() || NEXT_TOKEN.equals(method.getName()))) { final PsiClass stringTokenizer = method.getContainingClass(); if (stringTokenizer != null && STRING_TOKENIZER.equals(stringTokenizer.getQualifiedName())) { final PsiExpression[] arguments = argumentList.getExpressions(); final int argCount = arguments.length; if (method.isConstructor()) { if (argCount == 2 || argCount == 3) { hasArgumentDuplicates(arguments[1], holder); } } else { if (argCount == 1) { hasArgumentDuplicates(arguments[0], holder); } } } } } }; }