- switch (Short.toUnsignedInt(value)) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- throw new PastVersionException(value, BORON);
- case 5:
- return BORON;
- case 6:
- return NEON_SR2;
- case 7:
- return SODIUM_SR1;
- default:
- throw new FutureVersionException(value, SODIUM_SR1);
- }
+ return switch (Short.toUnsignedInt(value)) {
+ case 0, 1, 2, 3, 4 -> throw new PastVersionException(value, BORON);
+ case 5 -> BORON;
+ case 6 -> NEON_SR2;
+ case 7 -> SODIUM_SR1;
+ case 8 -> MAGNESIUM;
+ case 9 -> CHLORINE_SR2;
+ default -> throw new FutureVersionException(value, CHLORINE_SR2);
+ };
+ }
+
+ /**
+ * Return {@code true} if this version is earier than some {@code other} version.
+ *
+ * @param other Other {@link ABIVersion}
+ * @return {@code true} if {@code other is later}
+ * @throws NullPointerException if {@code other} is null
+ */
+ public boolean lt(final @NonNull ABIVersion other) {
+ return compareTo(other) < 0;