boolean (PsiSubstitutor substitutor, List<InferenceVariable> vars, UniqueNameGenerator nameGenerator) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getManager().getProject()); PsiSubstitutor ySubstitutor = PsiSubstitutor.EMPTY; final PsiTypeParameter[] yVars = new PsiTypeParameter[vars.size()]; for (int i = 0; i < vars.size(); i++) { InferenceVariable var = vars.get(i); final PsiTypeParameter parameter = var.getParameter(); yVars[i] = elementFactory.createTypeParameterFromText(nameGenerator.generateUniqueName(parameter.getName()), parameter); ySubstitutor = ySubstitutor.put(var, elementFactory.createType(yVars[i])); } for (int i = 0; i < yVars.length; i++) { PsiTypeParameter parameter = yVars[i]; final InferenceVariable var = vars.get(i); final PsiType upperBound = composeBound(var, InferenceBound.UPPER, UPPER_BOUND_FUNCTION, ySubstitutor.putAll(substitutor), true); final PsiType lub = getLowerBound(var, substitutor); PsiType lowerBound; if (lub != PsiTypes.nullType()) { for (PsiClassType upperBoundType : parameter.getExtendsListTypes()) { if (!TypeConversionUtil.isAssignable(upperBoundType, lub)) { return false; } } lowerBound = lub; } else if (myPolicy.inferLowerBoundForFreshVariables()) { lowerBound = upperBound; } else { lowerBound = null; } TypeConversionUtil.setInferredBoundsForSynthetic(parameter, lowerBound, upperBound); TypeConversionUtil.markAsFreshVariable(parameter, myContext); if (!var.addBound(elementFactory.createType(parameter), InferenceBound.EQ, myIncorporationPhase)) { return false; } } return true; }