You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2016/05/14 11:13:12 UTC

[jira] [Reopened] (CODEC-178) Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets

     [ https://issues.apache.org/jira/browse/CODEC-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened CODEC-178:
------------------------

I wonder whether it is necessary to deprecate the fields.

It's not possible for Java 6 users to use the suggested alternative.
Also the replacements are anyway identical code-wise.

Once Codec requires a minimum of Java 7, I think a more helpful solution would be to redefine the constants in terms of the StandardCharsets fields, e.g.

public static final Charset US_ASCII = 
    Charset java.nio.charset.StandardCharsets.US_ASCII;

It should be possible to do this now in a static block.
i.e. try and reference StandardCharsets.US_ASCII; if this fails then revert to creating the Charset directly.

The Javadoc should probably still recommend people to use the Java 7 constants if available, but I don't see any reason to deprecate the fields given that the contents are identical.

> Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets
> -------------------------------------------------------------------------------------------
>
>                 Key: CODEC-178
>                 URL: https://issues.apache.org/jira/browse/CODEC-178
>             Project: Commons Codec
>          Issue Type: Task
>    Affects Versions: 1.9
>         Environment: Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
> Maven home: C:\Java\apache-maven-3.1.1\bin\..
> Java version: 1.7.0_51, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_51\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>            Priority: Minor
>             Fix For: 1.10
>
>
> Deprecate Charsets Charset constants in favor of Java 7's java.nio.charset.StandardCharsets



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)