-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix LexicographicalAnnotationAttributeListing
string sorting
#281
Conversation
*/ | ||
return ImmutableList.copyOf(SourceCode.treeToString(node, state).split("=", -1)); | ||
return ImmutableList.copyOf( | ||
SourceCode.treeToString(node, state).replaceAll("^\"|\"$", "").split("=", -1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the right fix tbh.
But after loads of testing, I finally got that the escaped quotes were considered in the sorting, which we actually don't want, and we want to sort what's inside the string.
Thus filtering out the leading and trailing quotes (if exists) from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking down the source of the odd sorting! It looks like we should use ASTHelpers#constValue
here; I'll push a proposal :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, didn't know about this one :D
Thanks @Stephan202 for pushing those extras!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Alternative suggested commit message:
Fix `LexicographicalAnnotationAttributeListing` string sorting (#281)
In particular, the empty string is now ordered first.
*/ | ||
return ImmutableList.copyOf(SourceCode.treeToString(node, state).split("=", -1)); | ||
return ImmutableList.copyOf( | ||
SourceCode.treeToString(node, state).replaceAll("^\"|\"$", "").split("=", -1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking down the source of the odd sorting! It looks like we should use ASTHelpers#constValue
here; I'll push a proposal :)
Had a shower thought; added one more commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up @Ptijohn ! It's nice to have this fixed after quite a while 😄.
LexicographicalAnnotationAttributeListing
string sorting
Suggested commit message: