Language (@NotNull Language originalLang, @NotNull VirtualFile file, @NotNull Project project) { for (LanguageSubstitutor substitutor : forKey(originalLang)) { Language substitutedLang = substitutor.getLanguage(file, project); if (substitutedLang != null) { if (substitutedLang == Language.ANY) { LOG.error("For " + originalLang + " and " + file + ", " + substitutor.getClass().getName() + " returned Language.ANY, which is not allowed"); continue; } if (LOG.isDebugEnabled()) { LOG.debug("For " + originalLang + " and " + file + ", " + substitutor.getClass().getName() + " returned '" + substitutedLang + "' of " + substitutedLang.getClass()); } processLanguageSubstitution(file, originalLang, substitutedLang, project); return substitutedLang; } } return originalLang; }