From 5f91f79382ed41369e1541221348adc92c97bbe9 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 3 Dec 2020 22:51:00 +0300 Subject: [PATCH] Remove usage of idea file systems for checking js libraries The removed code is probably an outdated code from the age when Kotlin compiler was using VirtualFiles for operating. Previously the links were stored and passed further, but now it is only some additional check (files are unused after the check) with an implicit dependency to IDEA internals. The deleted check could probably be responsible for handling references to JS libraries because of the working compiler daemon. The code was spotted during an investigation for the 2bf22caeb7c687cd6b54b05b11e5c0f1a3caa07c commit (there's a detailed description in the commit message). --- .../jetbrains/kotlin/js/config/JsConfig.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java index 94ce2c8a774..63bf59de68e 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/config/JsConfig.java @@ -164,9 +164,6 @@ public class JsConfig { return false; } - VirtualFileSystem fileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL); - VirtualFileSystem jarFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JAR_PROTOCOL); - Set modules = new HashSet<>(); boolean skipMetadataVersionCheck = getLanguageVersionSettings().getFlag(AnalysisFlags.getSkipMetadataVersionCheck()); @@ -174,26 +171,12 @@ public class JsConfig { for (String path : libraries) { if (librariesToSkip != null && librariesToSkip.contains(path)) continue; - VirtualFile file; - File filePath = new File(path); if (!filePath.exists()) { report.error("Path '" + path + "' does not exist"); return true; } - if (path.endsWith(".jar") || path.endsWith(".zip")) { - file = jarFileSystem.findFileByPath(path + URLUtil.JAR_SEPARATOR); - } - else { - file = fileSystem.findFileByPath(path); - } - - if (file == null) { - report.error("File '" + path + "' does not exist or could not be read"); - return true; - } - List metadataList = KotlinJavascriptMetadataUtils.loadMetadata(path); if (metadataList.isEmpty()) { report.warning("'" + path + "' is not a valid Kotlin Javascript library");