dweiss commented on code in PR #941:
URL: https://github.com/apache/lucene/pull/941#discussion_r887599889


##########
buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java:
##########
@@ -39,6 +39,15 @@
  * Has no dependencies outside of standard java libraries
  */
 public class WrapperDownloader {
+  private static final int REQUIRED_JAVA_VERSION_FEATURE = 17;

Review Comment:
   I think this should just use the Version API and parse from a simple String 
- much more concise:
   
https://docs.oracle.com/javase/9/docs/api/java/lang/Runtime.Version.html#parse-java.lang.String-



##########
buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java:
##########
@@ -55,9 +64,18 @@ public static void main(String[] args) {
   }
 
   public static void checkVersion() {
-    int major = Runtime.getRuntime().version().feature();
-    if (major != 17) {
-      throw new IllegalStateException("java version be exactly 17, your 
version: " + major);
+    Runtime.Version version = Runtime.version();
+    int feature = version.feature();
+    int interim = version.interim();
+    int update = version.update();
+    // Version.toString() can return arbitrary version string depending on 
vendors.
+    // Reformat as "$FEATURE.$INTERIM.$UPDATE"
+    final String runtimeVersionString = String.format("%d.%d.%d", feature, 
interim, update);

Review Comment:
   Why reformat these? I'd just display the versions as they were returned by 
the version API - including any build information. 



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to