commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Maurin (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-653) ConfigurationUtils.dump and other methods should use ImmutableConfiguration
Date Mon, 06 Mar 2017 15:55:33 GMT


Vincent Maurin commented on CONFIGURATION-653:

It could work, but the old ones will probably need to explicit cast the parameter to avoid
self calling themselves, example :

    public static String toString(ImmutableConfiguration configuration)
        StringWriter writer = new StringWriter();
        dump(configuration, new PrintWriter(writer));
        return writer.toString();

    public static String toString(Configuration configuration)
        return toString((ImmutableConfiguration) configuration);

Maybe an open question then is the Javadoc. Should we mark old ones as deprecated with a link
to the new ones ? Or just having the same javadoc on both methods ?

> ConfigurationUtils.dump and other methods should use ImmutableConfiguration
> ---------------------------------------------------------------------------
>                 Key: CONFIGURATION-653
>                 URL:
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 2.1, 2.1.1
>            Reporter: Vincent Maurin
>            Priority: Minor
>         Attachments: use_immutable.diff
> Since the read-only ImmutableConfiguration/ImmutableHierarchicalConfiguration has been
introduced, several methods that uses Configuration in a read-only fashion should be adapted
to use these ones instead of the read/write alternative.
> For example :
> ConfigurationUtils.dump
> ConfigurationUtils.toString
> ConfigurationUtils.copy (for the source)
> ConfigurationUtils.append (for the source)
> ConfigurationUtils.convertToHierarchical
> ConfigurationConverter.getProperties
> ... and maybe others
> It should not break any existing code as Configuration implements ImmutableConfiguration
and it could enable code that manipulates read only configurations to use these utilities

This message was sent by Atlassian JIRA

View raw message