You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by britter <gi...@git.apache.org> on 2016/09/11 16:57:42 UTC

[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 Ritter <br...@apache.org>
Date:   2016-09-11T15:25:24Z

    Remove method which merely delegates to JavaVersion.get(String)

commit 71f1b05f085dde9867551c67bfbb03f584bf55aa
Author: Benedikt Ritter <br...@apache.org>
Date:   2016-09-11T15:26:24Z

    Don't use wildcard imports

commit ef2e99772096885bf3302a617912d3519543d2b0
Author: Benedikt Ritter <br...@apache.org>
Date:   2016-09-11T15:47:53Z

    Add missing @since tags to JavaVersion

commit 565bd90e5be3a93c07292ee35dccb76d960dbac6
Author: Benedikt Ritter <br...@apache.org>
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #187: LANG-1263 Add possibility to retrieve the current J...

Posted by britter <gi...@git.apache.org>.
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.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #187: LANG-1263 Add possibility to retrieve the current J...

Posted by britter <gi...@git.apache.org>.
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`


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #187: LANG-1263 Add possibility to retrieve the current J...

Posted by coveralls <gi...@git.apache.org>.
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**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request #187: LANG-1263 Add possibility to retrieve the cu...

Posted by PascalSchumacher <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #187: LANG-1263 Add possibility to retrieve the current J...

Posted by coveralls <gi...@git.apache.org>.
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**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #187: LANG-1263 Add possibility to retrieve the current J...

Posted by coveralls <gi...@git.apache.org>.
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**.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request #187: LANG-1263 Add possibility to retrieve the cu...

Posted by britter <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---