-
-
Notifications
You must be signed in to change notification settings - Fork 971
15048 - feature: reproducible gorm service implementations #15097
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
Conversation
392872f to
c282f70
Compare
|
|
||
| } | ||
|
|
||
| propertiesFields.sort(true) { it.name } // ensure a consistent order of processing fields |
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.
Can be removed if we use a sorted set.
| boolean isInterface = classNode.isInterface() | ||
| boolean isAbstractClass = !isInterface && Modifier.isAbstract(classNode.modifiers) | ||
|
|
||
| List<FieldNode> propertiesFields = [] |
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.
- Use a sorted set from the start? Would eliminate the need to sort after the loop.
// Use sorted set to ensure consistent ordering for build reproducibility
def propertiesFields = new TreeSet<FieldNode>({ FieldNode a, FieldNode b -> a.name <=> b.name })| List<MethodNode> abstractMethods = findAllUnimplementedAbstractMethods(classNode) | ||
| abstractMethods.sort(true) { it.name } // ensure a consistent order of processing methods | ||
|
|
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.
Sort inline? Simplify?
// Sort to ensure consistent ordering for build reproducibility
def abstractMethods = findAllUnimplementedAbstractMethods(classNode)
.sort { it.name }| def sortedMethods = classNode.methods.sort(true) { it.name } | ||
| for (MethodNode existing in (sortedMethods)) { |
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.
- Add comment why we are sorting?
- Why mutate?
- Simplify?
// Sort to ensure consistent ordering for build reproducibility
def sortedMethods = classNode.methods.sort { it.name }
for (MethodNode existing in sortedMethods) {| List<FieldNode> propertiesFields = [] | ||
| if (isAbstractClass) { | ||
| List<PropertyNode> properties = classNode.getProperties() | ||
| List<PropertyNode> properties = classNode.getProperties().sort { it.name } |
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.
- Add comment why we are sorting?
- Simplify?
// Sort to ensure consistent ordering for build reproducibility
def properties = classNode.properties.sort { it.name }|
|
||
| Iterable<ServiceImplementerAdapter> adapters = load(ServiceImplementerAdapter) | ||
| List<ServiceImplementerAdapter> finalAdapters = adapters.toList() | ||
| List<ServiceImplementerAdapter> finalAdapters = adapters.toList().sort { it.class.name } |
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.
- Add comment why we are sorting?
- Simplify?
// Sort to ensure consistent ordering for build reproducibility
def finalAdapters = adapters.sort { it.class.name }
Fixes #15048 , but I think the AclIdentityObject in spring security will still differ after this change. From local testing, the closures are generated in the same order - we can confirm this as part of the next release.