INRIA / INRIA/spoon

CtExtendedModifiers are stored in a HashSet - leads to non-deterministic pretty-printing

Open
#4,033 17 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

The `ElementPrinterHelper` prints out modifiers by fetching the extended modifiers. These are in turn stored inside a `HashSet`, which is not ordered. The printer-helper sections them in `[visibility] [abstract/static] [everything else]`, but there is no internal ordering in the `abstract/static` and `everything else` parts.

So, for example, a class with the modifiers `abstract static` could be written either `abstract static` or `static abstract` depending on the machine state. That's not desirable.

Either we store the modifiers in an ordered collection, or the printer helper must order them when printing. Non-deterministic printing is a hassle.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.