Language (Language baseLanguage, FileViewProvider viewProvider) { Set<Language> languages = viewProvider.getLanguages(); for (Language actualLanguage : languages) { if (actualLanguage.isKindOf(baseLanguage) && actualLanguage instanceof IgnoreLanguage) { return actualLanguage; } } throw new AssertionError("Language " + baseLanguage + " doesn't participate in view provider " + viewProvider + ": " + new ArrayList<>(languages)); }