IDEA-57233 Editor font antialising/appearance problems on Linux

Corrected JdkBundle tests to skip pure jres. Added Nullables and checks.
This commit is contained in:
Alexey Ushakov
2015-11-26 18:42:01 +03:00
parent cbcafae684
commit 03d72ab48d
4 changed files with 20 additions and 6 deletions
@@ -238,15 +238,20 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware {
private static final Version JDK8_VERSION = new Version(1, 8, 0);
@NotNull
private static JdkBundleList findJdkPaths() {
JdkBundle bootJdk = JdkBundle.createBoot();
JdkBundleList jdkBundleList = new JdkBundleList();
jdkBundleList.addBundle(bootJdk, true);
if (bootJdk != null) {
jdkBundleList.addBundle(bootJdk, true);
}
if (bundledJdkFile.exists()) {
JdkBundle bundledJdk = JdkBundle.createBundle(bundledJdkFile, false, true);
jdkBundleList.addBundle(bundledJdk, true);
if (bundledJdk != null) {
jdkBundleList.addBundle(bundledJdk, true);
}
}
if (SystemInfo.isMac) {
@@ -63,6 +63,7 @@ public class JdkBundle {
return new JdkBundle(jvm, nameVersionAndUpdate.first, nameVersionAndUpdate.second, boot, bundled);
}
@Nullable
public static JdkBundle createBoot() {
File bootJDK = new File(System.getProperty("java.home")).getParentFile();
if (SystemInfo.isMac) {
@@ -32,7 +32,7 @@ public class JdkBundleList {
private HashMap<String, JdkBundle> bundleMap = new HashMap<String, JdkBundle>();
private HashMap<String, JdkBundle> nameVersionMap = new HashMap<String, JdkBundle>();
public void addBundle(JdkBundle bundle, boolean forceOldVersion) {
public void addBundle(@NotNull JdkBundle bundle, boolean forceOldVersion) {
JdkBundle bundleDescr = bundleMap.get(bundle.getBundleAsFile().getAbsolutePath());
if (bundleDescr == null) {
addMostRecent(bundle, forceOldVersion);
@@ -43,7 +43,7 @@ public class JdkBundleList {
}
}
private void addMostRecent(JdkBundle bundleDescriptor, boolean forceOldVersion) {
private void addMostRecent(@NotNull JdkBundle bundleDescriptor, boolean forceOldVersion) {
Pair<Version, Integer> versionUpdate = bundleDescriptor.getVersionUpdate();
boolean updateVersionMap = versionUpdate != null;
if (!bundleList.isEmpty() && updateVersionMap) {
@@ -73,7 +73,7 @@ public class JdkBundleList {
}
}
public void addBundlesFromLocation(String location, @Nullable Version minVer, @Nullable Version maxVer) {
public void addBundlesFromLocation(@NotNull String location, @Nullable Version minVer, @Nullable Version maxVer) {
File jvmLocation = new File(location);
if (!jvmLocation.exists()) {
@@ -111,7 +111,7 @@ public class JdkBundleList {
return bundleList;
}
public boolean contains(String path) {
public boolean contains(@NotNull String path) {
return bundleMap.keySet().contains(path);
}
}
@@ -23,6 +23,7 @@ import org.junit.Test;
import java.io.File;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.TestCase.*;
public class JdkBundleTest {
@@ -31,6 +32,9 @@ public class JdkBundleTest {
public void testCreateBundle() throws Exception {
if (SystemInfo.isWindows) return; // Windows is not supported so far
File bootJDK = new File(System.getProperty("java.home")).getParentFile();
if (!new File(bootJDK, "lib/tools.jar").exists()) return; // Skip pure jre
if (SystemInfo.isMac) {
bootJDK = bootJDK.getParentFile().getParentFile();
}
@@ -54,6 +58,9 @@ public class JdkBundleTest {
public void testCreateBoot() throws Exception {
if (SystemInfo.isWindows) return; // Windows is not supported so far
File bootJDK = new File(System.getProperty("java.home")).getParentFile();
if (!new File(bootJDK, "lib/tools.jar").exists()) return; // Skip pure jre
if (SystemInfo.isMac) {
bootJDK = bootJDK.getParentFile().getParentFile();
}
@@ -61,6 +68,7 @@ public class JdkBundleTest {
JdkBundle bundle = JdkBundle.createBoot();
assertNotNull(bundle);
assertTrue(bundle.isBoot());
assertFalse(bundle.isBundled());