IDEA-166362 Show warning notification concerning outdated boot java runtime

Corrected warning message. Suggested switching to bundled java only if it exist in IDEA bundle and supported by underlying OS
This commit is contained in:
Alexey Ushakov
2017-01-12 00:51:55 +03:00
parent 27c498544c
commit 12ef5fea76
3 changed files with 35 additions and 7 deletions
@@ -28,6 +28,7 @@ import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Bitness;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.Version;
@@ -61,6 +62,7 @@ public class SystemHealthMonitor extends ApplicationComponent.Adapter {
private static final NotificationGroup GROUP = new NotificationGroup("System Health", NotificationDisplayType.STICKY_BALLOON, false);
private static final NotificationGroup LOG_GROUP = NotificationGroup.logOnlyGroup("System Health (minor)");
private static final String SWITCH_JDK_ACTION = "SwitchBootJdk";
public static final String LATEST_JDK_RELEASE = "1.8.0u112";
private final PropertiesComponent myProperties;
@@ -82,11 +84,15 @@ public class SystemHealthMonitor extends ApplicationComponent.Adapter {
showNotification(new KeyHyperlinkAdapter("unsupported.jvm.ea.message"));
}
JdkBundle bundle = JdkBundle.createBoot();
if (bundle != null) {
if (bundle != null && !bundle.isBundled()) {
Version version = bundle.getVersion();
Integer updateNumber = bundle.getUpdateNumber();
if (version != null && (version.lessThan(1, 8, 0) || (updateNumber != null && updateNumber < 112))) {
showNotification(new KeyHyperlinkAdapter("outdated.jvm.version.message") {
final String bundleVersion = version.toCompactString() + (updateNumber != null ? "u" + updateNumber : "");
if (JdkBundle.getBundledJDKAbsoluteLocation().exists() &&
(bundle.getBitness() == Bitness.x64 && (SystemInfo.isMacIntel64 || SystemInfo.isWindows || SystemInfo.isLinux)))
{
showNotification(new KeyHyperlinkAdapter("outdated.jvm.version.message1") {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
String url = e.getDescription();
@@ -100,8 +106,12 @@ public class SystemHealthMonitor extends ApplicationComponent.Adapter {
BrowserUtil.browse(url);
}
}
},
version.toCompactString() + (updateNumber != null ? "u" + updateNumber : ""), "1.8.0u112");
}, bundleVersion, LATEST_JDK_RELEASE);
}
else {
showNotification(new KeyHyperlinkAdapter("outdated.jvm.version.message2"),
bundleVersion, LATEST_JDK_RELEASE);
}
}
}
}
@@ -21,6 +21,7 @@ import com.intellij.execution.util.ExecUtil;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -113,11 +114,27 @@ public class JdkBundle {
@Nullable
static JdkBundle createBoot(boolean adjustToMacBundle) {
File bootJDK = new File(System.getProperty("java.home")).getParentFile();
JdkBundle bundle;
if (SystemInfo.isMac && adjustToMacBundle) {
bootJDK = bootJDK.getParentFile().getParentFile();
return createBundle(bootJDK, true, false);
bundle = createBundle(bootJDK, true, false);
}
return createBundle(bootJDK, "", true, false, true);
else {
bundle = createBundle(bootJDK, "", true, false, true);
}
if (bundle != null) {
if (isBundledJDK(bundle)) bundle.setBundled(true);
}
return bundle;
}
@NotNull
public static File getBundledJDKAbsoluteLocation() {
return new File(PathManager.getHomePath(), SystemInfo.isMac ? "jdk" : "jre");
}
static public boolean isBundledJDK(@NotNull JdkBundle bundle) {
return FileUtil.filesEqual(bundle.getAbsoluteLocation(), getBundledJDKAbsoluteLocation());
}
@NotNull
@@ -1143,7 +1143,8 @@ browsers.settings=Web Browsers
updates.check.period.on.exit=On every exit
unsupported.jvm.ea.message=Early Access Java versions may cause compatibility issues. Please use stable release.
outdated.jvm.version.message=Your java version ({0}) is outdated. It may cause stability issues. Please update to {1}+ or <a href="switch">switch</a> to the bundled java runtime
outdated.jvm.version.message1=IDE''s Java runtime ({0}) is outdated - this may cause stability issues. Please update to {1} or newer, or <a href="switch">switch</a> to the bundled Java runtime
outdated.jvm.version.message2=IDE''s Java runtime ({0}) is outdated - this may cause stability issues. Please update to {1} or newer
ibus.blocking.warn.message=IBus prior to 1.5.11 may cause input problems. See <a href="https://youtrack.jetbrains.com/issue/IDEA-78860">IDEA-78860</a> for details.
ide.sigint.ignored.message=The IDE ignores SIGINT - "Stop" button in run configurations may not work. \
See <a href="https://youtrack.jetbrains.com/issue/IDEA-157989">IDEA-157989</a> for details.