Skip to content

Commit 213c3ab

Browse files
committed
GROOVY-11674: Grails reproducible build (order trait methods - minor refactor)
1 parent 0d22fbd commit 213c3ab

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/codehaus/groovy/transform/trait/TraitComposer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static void applyTrait(final ClassNode trait, final ClassNode cNode, fin
126126
Map<String, ClassNode> genericsSpec = GenericsUtils.createGenericsSpec(trait, GenericsUtils.createGenericsSpec(cNode));
127127

128128
List<MethodNode> hMethods = new ArrayList<>(helperClassNode.getMethods());
129-
if (!hMethods.isEmpty()) {
129+
if (hMethods.size() > 1) {
130130
hMethods.sort(Comparator.comparing(MethodNodeUtils::methodDescriptorWithoutReturnType));
131131
}
132132
for (MethodNode methodNode : hMethods) {
@@ -179,7 +179,7 @@ private static void applyTrait(final ClassNode trait, final ClassNode cNode, fin
179179
List<MethodNode> declaredMethods = new LinkedList<>();
180180
int pos = 0; // keep direct getters at start but in declaration order
181181
List<MethodNode> fhMethods = new ArrayList<>(fieldHelperClassNode.getMethods());
182-
if (!fhMethods.isEmpty()) {
182+
if (fhMethods.size() > 1) {
183183
fhMethods.sort(Comparator.comparing(MethodNodeUtils::methodDescriptorWithoutReturnType));
184184
}
185185
for (MethodNode declaredMethod : fhMethods) {
@@ -192,7 +192,7 @@ private static void applyTrait(final ClassNode trait, final ClassNode cNode, fin
192192

193193
if (staticFieldHelperClassNode != null) {
194194
List<MethodNode> sfhMethods = new ArrayList<>(staticFieldHelperClassNode.getMethods());
195-
if (!sfhMethods.isEmpty()) {
195+
if (sfhMethods.size() > 1) {
196196
sfhMethods.sort(Comparator.comparing(MethodNodeUtils::methodDescriptorWithoutReturnType));
197197
}
198198
for (MethodNode declaredMethod : sfhMethods) {

0 commit comments

Comments
 (0)