Collection<PsiMethod> (@NotNull PsiClass psiParentClass, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiBuilderClass) { final PsiTypeParameter[] typeParameters = psiBuilderClass.getTypeParameters(); final PsiClass bTypeClass, cTypeClass; if (typeParameters.length >= 2) { bTypeClass = typeParameters[typeParameters.length - 1]; cTypeClass = typeParameters[typeParameters.length - 2]; } else { //Fallback only bTypeClass = new LightTypeParameterBuilder("B", psiBuilderClass, 1); cTypeClass = new LightTypeParameterBuilder("C", psiBuilderClass, 0); } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiParentClass.getProject()); final PsiClassType bType = factory.createType(bTypeClass); final PsiClassType cType = factory.createType(cTypeClass); final List<BuilderInfo> builderInfos = createBuilderInfos(psiParentClass, psiAnnotation, psiBuilderClass); initBuilderInfosBuilderClassType(builderInfos, bType); // create all methods return addAllMethodsForBaseBuilderClass(psiParentClass, psiAnnotation, psiBuilderClass, builderInfos, bType, cType); }