PsiType (PsiType type, boolean variableType) { if(!(type instanceof PsiClassType)) return null; PsiClass aClass = ((PsiClassType)type).resolve(); if(com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, false, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) { return PsiTypes.intType(); } if(com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, false, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) { return PsiTypes.longType(); } if(com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, false, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) { return PsiTypes.doubleType(); } if(!com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, false, CommonClassNames.JAVA_UTIL_STREAM_STREAM)) { return null; } PsiType streamType = PsiUtil.substituteTypeParameter(type, CommonClassNames.JAVA_UTIL_STREAM_STREAM, 0, false); if (variableType) { if (streamType instanceof PsiIntersectionType) { return null; } streamType = GenericsUtil.getVariableTypeByExpressionType(streamType); } return streamType; }