PsiMethodPattern (@NonNls final String... inputTypes) { final String[] types = inputTypes.length == 0 ? ArrayUtilRt.EMPTY_STRING_ARRAY : inputTypes; return with(new PatternCondition<PsiMethod>("withParameters") { @Override public boolean accepts(@NotNull final PsiMethod psiMethod, final ProcessingContext context) { final PsiParameterList parameterList = psiMethod.getParameterList(); int dotsIndex = -1; while (++dotsIndex <types.length) { if (Objects.equals("..", types[dotsIndex])) break; } if (dotsIndex == types.length && parameterList.getParametersCount() != dotsIndex || dotsIndex < types.length && parameterList.getParametersCount() < dotsIndex) { return false; } if (dotsIndex > 0) { final PsiParameter[] psiParameters = parameterList.getParameters(); for (int i = 0; i < dotsIndex; i++) { if (!Objects.equals("?", types[i]) && !typeEquivalent(psiParameters[i].getType(), types[i])) { return false; } } } return true; } private boolean typeEquivalent(PsiType type, String expectedText) { PsiType erasure = TypeConversionUtil.erasure(type); return erasure != null && erasure.equalsToText(expectedText); } }); }