java: fix computation of path to jdkAnnotation for case when Java support is installed as a plugin (IDEA-195719)

This commit is contained in:
nik
2019-03-29 20:10:53 +03:00
parent 3316b57a54
commit 69e838ead8
@@ -272,9 +272,19 @@ public class JavaSdkImpl extends JavaSdk {
pathsChecked.add(path);
if (root == null) { // build
String url = "jar://" + FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar!/";
root = VirtualFileManager.getInstance().findFileByUrl(url);
pathsChecked.add(FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar");
String javaPluginClassesRootPath = PathManager.getJarPathForClass(JavaSdkImpl.class);
LOG.assertTrue(javaPluginClassesRootPath != null);
File javaPluginClassesRoot = new File(javaPluginClassesRootPath);
if (javaPluginClassesRoot.isFile()) {
String annotationsJarPath = FileUtil.toSystemIndependentName(new File(javaPluginClassesRoot.getParentFile(), "jdkAnnotations.jar").getAbsolutePath());
root = VirtualFileManager.getInstance().findFileByUrl("jar://" + annotationsJarPath + "!/");
pathsChecked.add(annotationsJarPath);
}
if (root == null) {
String url = "jar://" + FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar!/";
root = VirtualFileManager.getInstance().findFileByUrl(url);
pathsChecked.add(FileUtil.toSystemIndependentName(PathManager.getHomePath()) + "/lib/jdkAnnotations.jar");
}
}
if (root == null) {