Subtle behavior change in metamodel with Sort.equals due to the addition of expressions#1496
Open
njr-11 wants to merge 1 commit into
Open
Subtle behavior change in metamodel with Sort.equals due to the addition of expressions#1496njr-11 wants to merge 1 commit into
njr-11 wants to merge 1 commit into
Conversation
Member
|
I guess this is OK. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TCK caught a behavior change where it compares a Sort that has a String entity attribute name to a Sort obtained from the metamodel attribute,
Previously, both of these were backed by String values and were equal. However, the latter now also has an
expression(in this case,_AsciiChar.hexadecimal) causing.equalsto report false. Similarly,.hashCodewill now compute different values for the two Sort instances as well.I would argue the new behavior is better because it means
_Product.name.asc()will not equal_Employee.name.asc(). However, in Data 1.0, the two were.equalsbecause there was noexpressioncomponent and the other components (property="name", isAscending=true, ignoreCase=false) all match.With respect to
Sortitself, there is no breaking change.Sort.asc(_Product.NAME)andSort.asc(_Employee.NAME)are still.equals. The new behavior only applies when an expression is added, which is new in 1.1. The behavior change is really isolated to Sort obtained fromTextAttribute. I think we can address this by continuing to obtain Sort without an expression fromTextAttributewhen the deprecated TextAttributeRecord is used, and defaulting to Sort backed by the TextAttribute as the expression when the TextAttribute.of method that we introduced in Data 1.1 as the recommended approach is used.