Skip to content

Undefined behaviour in EulerPathFinder #1108

@Fabizocker456

Description

@Fabizocker456

Modloader

None / Common

Minecraft version

1.20.1

Hex Casting version

master

Modloader version

/

Modpack info

/

The latest.log file

/

Issue description

https://github.com/FallingColors/HexMod/tree/main/Common/src/main/java/at/petrak/hexcasting/api/casting/math/EulerPathFinder.kt#L41 chooses one of the graph's nodes randomly. This function relies in the ordering of the elements in the set, which is not defined, and thus may be not be stable between Java versions or between OpenJDK and 'Oracle Java'.

This is slightly ironic since oddNodes is a LinkedHashMap, which provides a predictable order of iteration (insertion order). However, since that is filled by iterating over the graph hashmap too, its order is also not defined.

Steps to reproduce

/

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions