void () { final JavaPsiFacade facade = getJavaFacade(); final LanguageLevel prevLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel(); LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5); final PsiClass aClass; try { aClass = JavaPsiFacade.getElementFactory(getProject()).createEnum("E"); } finally { LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(prevLanguageLevel); } assertTrue(aClass.isEnum()); assertFalse(aClass.hasModifierProperty(PsiModifier.STATIC)); }