shyla226 commented on code in PR #2563:
URL: https://github.com/apache/cassandra/pull/2563#discussion_r1416463885


##########
bin/cassandra.in.sh:
##########
@@ -116,19 +116,34 @@ if [ -z $JAVA ] ; then
     exit 1;
 fi
 
+# Matches variable 'java.supported' in build.xml
+java_versions_supported=11,17
+
 # Determine the sort of JVM we'll be running on.
 java_ver_output=`"${JAVA:-java}" -version 2>&1`
 jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 
'NR==1 {print $2}' | cut -d\- -f1`
 JVM_VERSION=${jvmver%_*}
 short=$(echo "${jvmver}" | cut -c1-2)
 
-JAVA_VERSION=17
-if [ "$short" = "11" ]  ; then
-     JAVA_VERSION=11
-elif [ "$JVM_VERSION" \< "17" ] ; then
-    echo "Cassandra 5.0 requires Java 11 or Java 17."
+# Unsupported JDKs below the upper supported version are not allowed
+if [ "$short" != "$(echo "$java_versions_supported" | cut -d, -f1)" ] && [ 
"$JVM_VERSION" \< "$(echo "$java_versions_supported" | cut -d, -f2)" ] ; then
+    echo "Unsupported Java $JVM_VERSION. Supported are 
$java_versions_supported"
     exit 1;
 fi
+# Allow execution of supported Java versions, and newer if 
CASSANDRA_JDK_UNSUPPORTED is set
+supported_version=$(echo "$java_versions_supported" | tr "," '\n' | grep -F -x 
"$short")
+if [ -z "$supported_version" ] ; then
+    if [ -z "$CASSANDRA_JDK_UNSUPPORTED" ] ; then
+        echo "Unsupported Java $JVM_VERSION. Supported are 
$java_versions_supported"
+        echo "If you would like to test with newer Java versions set 
CASSANDRA_JDK_UNSUPPORTED=true"
+        exit 1;
+    else
+        echo 
"######################################################################"
+        echo "Warning! You are using JDK$short. Cassandra currently only 
supports $java_versions_supported."

Review Comment:
   Updated this



-- 
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]

Reply via email to