TypeEvalContext (@NotNull LocalInspectionToolSession session) { TypeEvalContext context; synchronized (INSPECTION_TYPE_EVAL_CONTEXT) { context = session.getUserData(INSPECTION_TYPE_EVAL_CONTEXT); if (context == null) { final PsiFile sessionFile = session.getFile(); final PsiFile contextFile = FileContextUtil.getContextFile(sessionFile); final PsiFile file = ObjectUtils.chooseNotNull(contextFile, sessionFile); context = TypeEvalContext.codeAnalysis(file.getProject(), file); session.putUserData(INSPECTION_TYPE_EVAL_CONTEXT, context); } } return context; }