-
Notifications
You must be signed in to change notification settings - Fork 353
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
Signature of methods in SchemaElementDefinition #1804
Comments
We cannot update the signature as the methods are public, so new |
The Sets have been updated to Lists and made immutable. |
Need to investigate if this is still a problem, then decide what alpha it needs to go into (if any). If it is a breaking change add the label and ensure it's in an appropriate milestone. |
The historic comments by @m55624 above (new ordered methods) relate to the branch In Gaffer there are many instances of fields declared with the class as an interface from Java Collections and not an implementation. There are also many (200+) public methods returning these classes. Where order is not guaranteed for the Collection's implementation (Set or Map), but calling code relies on order, this problem could occur. However, for this to happen the actual order would need to be lost because of a code change. In the case of As the problem of method signatures using interface classes which do not guarantee order is not specific to |
I have added a PR (#2889) which should satisfy this ticket, rather than explicitly changing the types to be ordered, I have added tests that dictate ordered results |
Closed by #2889 |
In
SchemaElementDefinition
the signature of the methodgetGroupBy
is to returnSet<String>
. The actual object that is returned is of typeLinkedHashSet
. Many callers of this method assume that the results are in a consistent order, e.g. when properties are serialised they need to always be serialised in the same order. As the result is aLinkedHashSet
, the results are in a consistent order. But as the signature doesn't guarantee that, in theory the implementation ofSchemaElementDefinition
could change (to return aHashSet
for example) and client code would break as the order would not be consistent.There are similar issues with
getIdentifierMap
andgetProperties
.EDIT
This branch has attempted a workaround. @d21211122 says:
For Gaffer 2.0, undo the workaround, deprecate these methods and replace them with ones that guarantee a consistent order and update all the callers of the methods in Gaffer to use the new ones.
The text was updated successfully, but these errors were encountered: