PsiType (Project project, Class<?> elementClass) { final List<String> methodNames = ContainerUtil.mapNotNull(elementClass.getMethods(), method -> { final String methodName = method.getName(); if (methodName.startsWith("set") || method.isSynthetic() || method.isBridge()) { //hide setters from completion list return null; } String parametersString = StringUtil.join(method.getParameters(), param -> param.getParameterizedType().getTypeName() + " " + param.getName(), ", "); return method.getGenericReturnType().getTypeName() + " " + methodName + "(" + parametersString + ");"; }); final String text = "interface " + elementClass.getSimpleName() + " {\n" + StringUtil.join(methodNames, "\n") + "}"; final PsiClass aClass = JavaPsiFacade.getElementFactory(project).createClassFromText(text, null).getInnerClasses()[0]; return JavaPsiFacade.getElementFactory(project).createType(aClass); }