commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1669753 - in /commons/proper/lang/trunk/src: changes/changes.xml main/java/org/apache/commons/lang3/SystemUtils.java test/java/org/apache/commons/lang3/SystemUtilsTest.java
Date Sat, 28 Mar 2015 12:26:01 GMT
Author: britter
Date: Sat Mar 28 12:26:01 2015
New Revision: 1669753

URL: http://svn.apache.org/r1669753
Log:
LANG-1103: Add SystemUtils.IS_JAVA_1_9

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java

Modified: commons/proper/lang/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1669753&r1=1669752&r2=1669753&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Sat Mar 28 12:26:01 2015
@@ -22,6 +22,7 @@
   <body>
 
   <release version="3.4" date="tba" description="tba">
+    <action issue="LANG-1103" type="add" dev="britter">Add SystemUtils.IS_JAVA_1_9</action>
     <action issue="LANG-1102" type="update" dev="britter">Make logic for comparing
OS versions in SystemUtils smarter</action>
     <action issue="LANG-1091" type="update" dev="britter" due-to="Fabian Lange">Shutdown
thread pools in test cases</action>
     <action issue="LANG-1101" type="update" dev="chas">FastDateParser and FastDatePrinter
support 'X' format</action>

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java?rev=1669753&r1=1669752&r2=1669753&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/SystemUtils.java Sat
Mar 28 12:26:01 2015
@@ -939,6 +939,18 @@ public class SystemUtils {
      */
     public static final boolean IS_JAVA_1_8 = getJavaVersionMatches("1.8");
 
+    /**
+     * <p>
+     * Is {@code true} if this is Java version 1.9 (also 1.9.x versions).
+     * </p>
+     * <p>
+     * The field will return {@code false} if {@link #JAVA_VERSION} is {@code null}.
+     * </p>
+     *
+     * @since 3.4
+     */
+    public static final boolean IS_JAVA_1_9 = getJavaVersionMatches("1.9");
+
     // Operating system checks
     // -----------------------------------------------------------------------
     // These MUST be declared after those above as they depend on the

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java?rev=1669753&r1=1669752&r2=1669753&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
Sat Mar 28 12:26:01 2015
@@ -105,6 +105,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.1")) {
             assertTrue(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -113,6 +115,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.2")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertTrue(SystemUtils.IS_JAVA_1_2);
@@ -121,6 +125,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.3")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -129,6 +135,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.4")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -137,6 +145,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.5")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -145,6 +155,8 @@ public class SystemUtilsTest {
             assertTrue(SystemUtils.IS_JAVA_1_5);
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.6")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -153,6 +165,8 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_5);
             assertTrue(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.7")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -162,6 +176,7 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertTrue(SystemUtils.IS_JAVA_1_7);
             assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
         } else if (javaVersion.startsWith("1.8")) {
             assertFalse(SystemUtils.IS_JAVA_1_1);
             assertFalse(SystemUtils.IS_JAVA_1_2);
@@ -171,6 +186,17 @@ public class SystemUtilsTest {
             assertFalse(SystemUtils.IS_JAVA_1_6);
             assertFalse(SystemUtils.IS_JAVA_1_7);
             assertTrue(SystemUtils.IS_JAVA_1_8);
+            assertFalse(SystemUtils.IS_JAVA_1_9);
+        } else if (javaVersion.startsWith("1.9")) {
+            assertFalse(SystemUtils.IS_JAVA_1_1);
+            assertFalse(SystemUtils.IS_JAVA_1_2);
+            assertFalse(SystemUtils.IS_JAVA_1_3);
+            assertFalse(SystemUtils.IS_JAVA_1_4);
+            assertFalse(SystemUtils.IS_JAVA_1_5);
+            assertFalse(SystemUtils.IS_JAVA_1_6);
+            assertFalse(SystemUtils.IS_JAVA_1_7);
+            assertFalse(SystemUtils.IS_JAVA_1_8);
+            assertTrue(SystemUtils.IS_JAVA_1_9);
         } else {
             System.out.println("Can't test IS_JAVA value: "+javaVersion);
         }



Mime
View raw message