commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1263) Add possibility to retrieve the current JavaVersion
Date Sun, 11 Sep 2016 18:10:20 GMT

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

Mime
View raw message