Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: fix: change how modifiers are handled to use an ordered LinkedHashSet #4122

Closed
wants to merge 8 commits into from

Conversation

raghav-deepsource
Copy link

@raghav-deepsource raghav-deepsource commented Aug 24, 2021

I should probably move the linkedHashSetCollector method elsewhere (a utility class for example).

this PR addresses #4033

@slarse
Copy link
Collaborator

slarse commented Aug 24, 2021

@raghav-deepsource To avoid regressions of this behavior, could you add tests that verify that the insertion order of modifiers is preserved? Insertion order for all of setExtendedModifiers, setModifiers and addModifier must be reflected in getModifiers and getExtendedModifiers.


@Test
public void testAddModifier() {
inputModifierKinds.forEach(handler::addModifier);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually enjoying java for once thanks to this syntax!

Copy link
Collaborator

@I-Al-Istannen I-Al-Istannen Aug 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use class/instance fields and not local variables for modifiers, modifiersExt and so on?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was to reduce duplication. I had all of these tests within a single test function at one point which I refactored into its present form.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though that has sort of come undone with current changes


@Test
public void testAddModifier() {
inputModifierKinds.forEach(handler::addModifier);
Copy link
Collaborator

@I-Al-Istannen I-Al-Istannen Aug 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use class/instance fields and not local variables for modifiers, modifiersExt and so on?

@raghav-deepsource
Copy link
Author

This PR was rather misguided, seeing as spoon generates modifiers as an unordered set anyway. A better method has been brought up in #4033.

@raghav-deepsource raghav-deepsource deleted the modifier-fix branch July 19, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants