[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15500832#comment-15500832 ] ASF GitHub Bot commented on LANG-1263: -- Github user britter commented on the issue: https://github.com/apache/commons-lang/pull/187 We already have `SystemUtils.isJavaVersionAtLeast(JavaVersion)` so there is no reason to add this API. > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15500831#comment-15500831 ] ASF GitHub Bot commented on LANG-1263: -- Github user britter closed the pull request at: https://github.com/apache/commons-lang/pull/187 > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15499224#comment-15499224 ] ASF GitHub Bot commented on LANG-1263: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/187 [![Coverage Status](https://coveralls.io/builds/7932625/badge)](https://coveralls.io/builds/7932625) Coverage increased (+0.007%) to 93.57% when pulling **dedddbd8df9791cf644c5ec3c8c2f7806e9cad21 on britter:LANG-1263** into **49e8d539fb248b9dff23e2c5b0766c0f966cee64 on apache:master**. > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15483283#comment-15483283 ] ASF GitHub Bot commented on LANG-1263: -- Github user britter commented on the issue: https://github.com/apache/commons-lang/pull/187 @PascalSchumacher I've changed the implementation to use the `IS_JAVA_XX` fields from `SystemUtils`. However, Java 9 detection is still broken, since it is broken in `SystemUtils` > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482314#comment-15482314 ] ASF GitHub Bot commented on LANG-1263: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/187 [![Coverage Status](https://coveralls.io/builds/7836644/badge)](https://coveralls.io/builds/7836644) Coverage increased (+0.02%) to 93.593% when pulling **de0de45fedd9dbf012be3b12a24b1b7433d25f77 on britter:LANG-1263** into **dad86bc0a29689fd29bf03b382a39621718e8b05 on apache:master**. > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482167#comment-15482167 ] ASF GitHub Bot commented on LANG-1263: -- 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? > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482053#comment-15482053 ] ASF GitHub Bot commented on LANG-1263: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/187 [![Coverage Status](https://coveralls.io/builds/7835751/badge)](https://coveralls.io/builds/7835751) Coverage increased (+0.02%) to 93.591% when pulling **565bd90e5be3a93c07292ee35dccb76d960dbac6 on britter:LANG-1263** into **05a6beba76b3195b26f2b15919d4f3a95b22c580 on apache:master**. > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
[ https://issues.apache.org/jira/browse/LANG-1263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15482040#comment-15482040 ] ASF GitHub Bot commented on LANG-1263: -- 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 Ritter Date: 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. > Add possibility to retrieve the current JavaVersion > --- > > Key: LANG-1263 > URL: https://issues.apache.org/jira/browse/LANG-1263 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Reporter: Benedikt Ritter >Assignee: Benedikt Ritter > Fix For: 3.5 > > > Currently one has to iterate over all JavaVersion enum values and compare > them to the value of java.specification.version in order to get the current > JavaVersion enum value. > Provide a convenient method for this. -- This message was sent by Atlassian JIRA (v6.3.4#6332)