void (@NotNull LanguageLevel level) { LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(getProject()); LanguageLevel prev = extension.getLanguageLevel(); extension.setLanguageLevel(level); Disposer.register(myFixture.getTestRootDisposable(), () -> extension.setLanguageLevel(prev)); }