From dev-return-165984-archive-asf-public=cust-asf.ponee.io@commons.apache.org Thu Jan 11 14:49:43 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id E6FA2180656 for ; Thu, 11 Jan 2018 14:49:43 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D73F8160C20; Thu, 11 Jan 2018 13:49:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2A262160C1F for ; Thu, 11 Jan 2018 14:49:43 +0100 (CET) Received: (qmail 32235 invoked by uid 500); 11 Jan 2018 13:49:42 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 32222 invoked by uid 99); 11 Jan 2018 13:49:42 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jan 2018 13:49:42 +0000 Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id CC4FD1A00A0 for ; Thu, 11 Jan 2018 13:49:41 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id n81so1648525oig.8 for ; Thu, 11 Jan 2018 05:49:41 -0800 (PST) X-Gm-Message-State: AKwxytefSchQXgDN2ZYudB/vXJYQzbDhrhyQpn54/Bc0lRbFkxwkX5Xi If3yEsmDlZZn/3qtXHH9sOuo9irl2xRMymKt+8o= X-Google-Smtp-Source: ACJfBov43wA+D/X3XMF32NJu4JNmiXpqET3/nV2K+FpGHMFpz5qYIGCkRiSQqsXXOM1pnPo9UsMgg4fAYE4A72zeRdM= X-Received: by 10.202.7.2 with SMTP id 2mr553489oih.102.1515678581003; Thu, 11 Jan 2018 05:49:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.176.139 with HTTP; Thu, 11 Jan 2018 05:49:40 -0800 (PST) Received: by 10.74.176.139 with HTTP; Thu, 11 Jan 2018 05:49:40 -0800 (PST) In-Reply-To: References: From: Matt Benson Date: Thu, 11 Jan 2018 07:49:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [lang] To: Commons Developers List Content-Type: multipart/alternative; boundary="94eb2c13e4566a1a740562806bf1" --94eb2c13e4566a1a740562806bf1 Content-Type: text/plain; charset="UTF-8" On Jan 10, 2018 9:22 PM, "Gary Gregory" wrote: On Wed, Jan 10, 2018 at 5:44 PM, Matt Benson wrote: > As I'm sure you're aware, the planned obsolescence of this approach is its > obvious drawback (a similar drawback exists already in the JavaVersion > parameter type). I assume this is the reason you said "technical reasons." > However, wouldn't it be straight up simple, as well as future proof (if > done correctly), to provide a method that tests an int against the > available major Java version? > Hi Matt, What would that look like? The usage would look like: if (SystemUtils.isJavaMajorVersionAtLeast(8)) { ... } Or, as Gilles suggests, you could simply have SystemUtils.getJavaVersion() and have methods from there to test against another JavaVersion instance. The possibilities are wide open. For brevity, maybe do a number of relational methods with short names eq|ne|lt|le|gt|ge and overload like: boolean gt(JavaVersion v); boolean gt(int... v); boolean ge(JavaVersion v); boolean ge(int... v); Permitting: SystemUtils.getJavaVersion().ge(8); SystemUtils.getJavaVersion().gt(8, 0); etc. Matt Gary > > Matt > > > On Jan 10, 2018 6:35 PM, "Gary Gregory" wrote: > > Hi All: > > I find myself writing a lot of this kind of code: > > if (SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) ... > > and > > Assume.assumeTrue(SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)); > > I think this would be more tidy: > > if (SystemUtils.isJavaVersionAtLeast8()) ... > > If this makes your skin crawl, please present a (technical) argument > against it... > > Gary > --94eb2c13e4566a1a740562806bf1--