@Nullable public ProblemDescriptor[] checkFile( @NotNull PsiFile psiFile, @NotNull InspectionManager inspectionManager, boolean isOnTheFly) { if (!(psiFile instanceof GroovyFileBase)) { return super.checkFile(psiFile, inspectionManager, isOnTheFly); } final GroovyFileBase groovyFile = (GroovyFileBase) psiFile; final ProblemsHolder problemsHolder = new ProblemsHolder(inspectionManager, psiFile, isOnTheFly); final BaseInspectionVisitor visitor = buildGroovyVisitor(problemsHolder, isOnTheFly); groovyFile.accept(visitor); final List<ProblemDescriptor> problems = problemsHolder.getResults(); return problems.toArray(new ProblemDescriptor[problems.size()]); }
@Override public void visitFile(GroovyFileBase file) { super.visitFile(file); final GrStatement[] statements = file.getStatements(); if (statements.length > 0) { handlePossibleReturn(statements[statements.length - 1]); } }