Skip to content

Commit b4d8650

Browse files
committed
factory - fixing int underflow issue when comparing engines or names by priority.
This fixes #242
1 parent 2c0fbbd commit b4d8650

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

restx-factory/src/main/java/restx/factory/Factory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public int compare(ComponentCustomizer o1, ComponentCustomizer o2) {
6363
}
6464
};
6565
private static int compareByPriorityAndName(int p1, Name<?> n1, int p2, Name<?> n2) {
66-
int c = p1 - p2;
67-
if (c == 0) {
66+
int priorityComparison = Integer.compare(p1, p2);
67+
if (priorityComparison == 0) {
6868
return n1.asId().compareTo(n2.asId());
6969
} else {
70-
return c;
70+
return priorityComparison;
7171
}
7272
}
7373
private static final AtomicLong ID = new AtomicLong();

0 commit comments

Comments
 (0)