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


##########
buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java:
##########
@@ -64,15 +57,13 @@ public static void main(String[] args) {
   }
 
   public static void checkVersion() {
-    Runtime.Version version = Runtime.version();
-    int feature = version.feature();
-    int interim = version.interim();
-    int update = version.update();
-    if (feature != REQUIRED_JAVA_VERSION_FEATURE) {
-      throw new IllegalStateException("java version be exactly " + 
REQUIRED_JAVA_VERSION_FEATURE + " (>=" + REQUIRED_JAVA_VERSION_STRING + "), 
your version: " + version);
+    final Runtime.Version requiredVersion = 
Runtime.Version.parse(REQUIRED_JAVA_VERSION_STRING);
+    final Runtime.Version version = Runtime.version();
+    if (version.feature() != requiredVersion.feature()) {
+      throw new IllegalStateException("java version be exactly " + 
requiredVersion.feature() + " (>=" + requiredVersion + "), your version: " + 
version);

Review Comment:
   ```
   java version [must] be exactly
   ```



##########
buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java:
##########
@@ -39,14 +39,7 @@
  * Has no dependencies outside of standard java libraries
  */
 public class WrapperDownloader {
-  private static final int REQUIRED_JAVA_VERSION_FEATURE = 17;
-  private static final int REQUIERD_JAVA_VERSION_INTERIM = 0;
-  private static final int REQUIRED_JAVA_VERSION_UPDATE = 3;
-  private static final String REQUIRED_JAVA_VERSION_STRING = String.format(
-    "%d.%d.%d",
-    REQUIRED_JAVA_VERSION_FEATURE,
-    REQUIERD_JAVA_VERSION_INTERIM,
-    REQUIRED_JAVA_VERSION_UPDATE);
+  private static final String REQUIRED_JAVA_VERSION_STRING = "17.0.3";

Review Comment:
   What I meant here was to keep the Version as a constant directly:
   ```
   private static final Runtime.Version REQUIRED_VERSION = 
Runtime.Version.parse("17.0.3");
   ```
   
   



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