[GitHub] commons-lang pull request #187: LANG-1263 Add possibility to retrieve the cu...
Github user britter closed the pull request at: https://github.com/apache/commons-lang/pull/187 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #187: LANG-1263 Add possibility to retrieve the cu...
Github user PascalSchumacher commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/187#discussion_r78299605 --- Diff: src/test/java/org/apache/commons/lang3/JavaVersionTest.java --- @@ -72,4 +73,28 @@ public void testToString() { assertEquals("1.2", JAVA_1_2.toString()); } +@Test +public void testCurrent() throws Exception { +if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.1")) { +assertEquals(JAVA_1_1, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.2")) { +assertEquals(JAVA_1_2, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.3")) { +assertEquals(JAVA_1_3, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.4")) { +assertEquals(JAVA_1_4, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.5")) { +assertEquals(JAVA_1_5, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.6")) { +assertEquals(JAVA_1_6, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.7")) { +assertEquals(JAVA_1_7, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("1.8")) { +assertEquals(JAVA_1_8, JavaVersion.CURRENT); +} else if (SystemUtils.JAVA_SPECIFICATION_VERSION.equals("9.0.0")) { --- End diff -- Not sure if this is correct. Shouldn't it be something like `9.` if I understand http://openjdk.java.net/jeps/223 correctly? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #187: LANG-1263 Add possibility to retrieve the cu...
GitHub user britter opened a pull request: https://github.com/apache/commons-lang/pull/187 LANG-1263 Add possibility to retrieve the current JavaVersion Added a constant `CURRENT` to the `JavaVersion` enum which represents the JavaVersion for the `java.specification.version` system property. This allows for checks like this: ```java if(JavaVersion.CURRENT.atLeast(JAVA_1_6) { // do something only possible in Java 1.6+ } ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/britter/commons-lang LANG-1263 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/187.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #187 commit 7c541954449659cf0bc8244ebf74d212cf7d9644 Author: Benedikt RitterDate: 2016-09-11T15:25:24Z Remove method which merely delegates to JavaVersion.get(String) commit 71f1b05f085dde9867551c67bfbb03f584bf55aa Author: Benedikt Ritter Date: 2016-09-11T15:26:24Z Don't use wildcard imports commit ef2e99772096885bf3302a617912d3519543d2b0 Author: Benedikt Ritter Date: 2016-09-11T15:47:53Z Add missing @since tags to JavaVersion commit 565bd90e5be3a93c07292ee35dccb76d960dbac6 Author: Benedikt Ritter Date: 2016-09-11T16:50:04Z LANG-1263: Add possibility to retrieve the current JavaVersion. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---