void () { PsiClass sam = myFixture.addClass("interface I { void foo(); }"); PsiFile usages = myFixture.addFileToProject("Some.java", "class Some { " + "{ I[] is = { () -> {}, this::toString }; }" + "}"); assertFalse(((PsiFileImpl) usages).isContentsLoaded()); assertNull(((PsiFileImpl) usages).derefStub()); Collection<PsiFunctionalExpression> all = FunctionalExpressionSearch.search(sam).findAll(); assertSize(2, all); for (PsiFunctionalExpression expression : all) { LeakHunter.checkLeak(expression, ASTNode.class); } }