You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2020/05/30 14:51:00 UTC

[jira] [Resolved] (GROOVY-9577) Order of ModuleNode#getImports() is expected but not guaranteed

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

Daniel Sun resolved GROOVY-9577.
--------------------------------
    Fix Version/s: 3.0.5
                   4.0.0-alpha-1
       Resolution: Fixed

> Order of ModuleNode#getImports() is expected but not guaranteed
> ---------------------------------------------------------------
>
>                 Key: GROOVY-9577
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9577
>             Project: Groovy
>          Issue Type: Bug
>          Components: ast builder
>    Affects Versions: 3.0.4
>            Reporter: Damir Murat
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.5
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> One of last statements in AstBuilder.visitImportDeclaration() are
> {code:java}
> moduleNode.addImport(alias, classNode, annotationNodeList);
> importNode = last(moduleNode.getImports());
> {code}
> Since ModuleNode.imports is a HashMap, last() method return unpredictable result.
> I guess this can be fixed by changing the implementation of ModuleNode.imports into LinkedHashMap instead of HashMap as is currently.
> I stumbled on this while trying to use CodeNarc with the latest Groovy.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)