Skip to content

Config depends on HashMap ordering causing breakage in Java 8 #253

@benmccann

Description

@benmccann

The tests fail in Java 8 and it seems to be because Java 8 has a different Map ordering

In Parser.java, if I change the following code:

    private AbstractConfigObject parseObject(boolean hadOpenCurly) {
        // invoked just after the OPEN_CURLY (or START, if !hadOpenCurly)
        Map<String, AbstractConfigValue> values = new HashMap<String, AbstractConfigValue>();

To this:

    private AbstractConfigObject parseObject(boolean hadOpenCurly) {
        // invoked just after the OPEN_CURLY (or START, if !hadOpenCurly)
        Map<String, AbstractConfigValue> values = new java.util.LinkedHashMap<String, AbstractConfigValue>();

Then the tests fail in Java 7. This shouldn't happen

You can notice when when printing resolveStack in the ResolveContext constructor that a different order used based upon the order of the above Map

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions