boolean (final Project project, final PsiModifierListOwner modifierListOwner, @NotNull PsiLanguageInjectionHost host, final String languageId) { return doAddLanguageAnnotation(project, modifierListOwner, host, languageId, host1 -> { final Configuration.AdvancedConfiguration configuration = Configuration.getProjectInstance(project).getAdvancedConfiguration(); boolean allowed = configuration.isSourceModificationAllowed(); configuration.setSourceModificationAllowed(true); try { return doInjectInJava(project, host1, host1, languageId); } finally { configuration.setSourceModificationAllowed(allowed); } }); }