matthiasblaesing commented on code in PR #9237:
URL: https://github.com/apache/netbeans/pull/9237#discussion_r3052943489
##########
enterprise/payara.tooling/src/org/netbeans/modules/payara/tooling/data/JDKVersion.java:
##########
@@ -283,24 +284,52 @@ public static JDKVersion getDefaultPlatformVersion() {
return IDE_JDK_VERSION;
}
- public static boolean isCorrectJDK(JDKVersion jdkVersion, Optional<String>
vendorOrVM, Optional<JDKVersion> minVersion, Optional<JDKVersion> maxVersion) {
+ public boolean isOptionSupported(
+ JvmConfigReader.JvmOption jvmOption,
+ String javaHome) {
+
boolean correctJDK = true;
- if (vendorOrVM.isPresent()) {
- correctJDK = jdkVersion.getVendor().map(vendor ->
vendor.contains(vendorOrVM.get())).orElse(false)
- || jdkVersion.getVM().map(vm ->
vm.contains(vendorOrVM.get())).orElse(false);
+ if (jvmOption.vendorOrVM.isPresent()) {
+ correctJDK
+ = this.getVendor()
+ .map(v -> v.contains(jvmOption.vendorOrVM.get()))
+ .orElse(false)
+ || this.getVM()
+ .map(vm -> vm.contains(jvmOption.vendorOrVM.get()))
+ .orElse(false);
}
- if (correctJDK && minVersion.isPresent()) {
- correctJDK = jdkVersion.ge(minVersion.get());
+
+ if (correctJDK && jvmOption.minVersion.isPresent()) {
+ correctJDK = this.ge(jvmOption.minVersion.get());
}
- if (correctJDK && maxVersion.isPresent()) {
- correctJDK = jdkVersion.le(maxVersion.get());
+
+ if (correctJDK && jvmOption.maxVersion.isPresent()) {
+ correctJDK = this.le(jvmOption.maxVersion.get());
+ }
+
+ if (correctJDK
+ && jvmOption.option != null
+ && jvmOption.option.matches("^-XX:[+-]?CRaC.*")) {
+
+ correctJDK = isCRaCSupported(javaHome);
}
+
return correctJDK;
}
- public static boolean isCorrectJDK(Optional<JDKVersion> minVersion,
Optional<JDKVersion> maxVersion) {
- return isCorrectJDK(IDE_JDK_VERSION, Optional.empty(), minVersion,
maxVersion);
+ /**
+ * Checks whether the given JDK installation supports CRaC by verifying the
+ * presence of the lib/criu directory.
+ *
+ * @param javaHome Java home directory to check
+ * @return true if CRaC-enabled JDK
+ */
+ public boolean isCRaCSupported(String javaHome) {
Review Comment:
Please make this private. This is only used from `#isOptionSupported`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists