void () { final MethodOnlyUsedFromInnerClassInspection inspection = new MethodOnlyUsedFromInnerClassInspection(); inspection.ignoreMethodsAccessedFromAnonymousClass = true; myFixture.enableInspections(inspection); doTest(""" class X { private void foo() {} \s void x() { class Local { void test() {foo();} } } }"""); }