Sort entries of RefasterRuleCollectionTestCase#elidedTypesAndStaticImports
#321
Labels
RefasterRuleCollectionTestCase#elidedTypesAndStaticImports
#321
Problem
For every Refaster Rule collection we have a corresponding
*Test{Input,Output}.java
file where we test the Refaster rules.These test classes implement the
RefasterRuleCollectionTestCase
interface that contains theelidedTypesAndStaticImports
method. This method exists to ensure that the same import statements are (still) required in the*TestOutput
file. Without this, the import(s) could become unused due to the patching of Refaster rules (and therefore removed when running the formatter).We highly value consistency and therefore always sort the arguments that are passed to the
ImmutableSet#of
(see example below).To enforce this, I propose to make changes to the
RefasterRuleCollection
class and verify the sorting of these arguments there.If the sorting is incorrect, it should suggest the correct order as fix.
Description of the proposed new feature
I would like to rewrite the following code:
to:
Considerations
This check is rather specific to Error Prone Support itself.
The content of the
ImmutableSet
can be basically everything, that might make the sorting a bit challenging?Maybe we should go one step further and ensure that the expression of the
elidedTypesAndStaticImports
is alwaysreturn ImmutableSet.of(...);
?Participation
This request can be picked up by anyone willing to work on it.
The text was updated successfully, but these errors were encountered: