diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml index 872792f..59f4a60 100644 --- a/.github/workflows/maven-deploy.yml +++ b/.github/workflows/maven-deploy.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index 8a2bd52..59f09dc 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d66cb41..dc197ee 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -10,10 +10,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: maven diff --git a/byteops-netty/src/main/java/com/digitalpetri/util/ByteBufByteOps.java b/byteops-netty/src/main/java/com/digitalpetri/util/ByteBufByteOps.java index cf98094..f8e1625 100644 --- a/byteops-netty/src/main/java/com/digitalpetri/util/ByteBufByteOps.java +++ b/byteops-netty/src/main/java/com/digitalpetri/util/ByteBufByteOps.java @@ -4,31 +4,21 @@ public final class ByteBufByteOps extends AbstractByteOps { - /** - * {@link ByteBufByteOps} that assumes big-endian byte order. - */ - public static final ByteBufByteOps BIG_ENDIAN = - new ByteBufByteOps(new OrderedOps.BigEndianOps()); - - /** - * {@link ByteBufByteOps} that assumes little-endian byte order. - */ + /** {@link ByteBufByteOps} that assumes big-endian byte order. */ + public static final ByteBufByteOps BIG_ENDIAN = new ByteBufByteOps(new OrderedOps.BigEndianOps()); + + /** {@link ByteBufByteOps} that assumes little-endian byte order. */ public static final ByteBufByteOps LITTLE_ENDIAN = new ByteBufByteOps(new OrderedOps.LittleEndianOps()); - /** - * {@link ByteBufByteOps} that assumes big-endian byte order and low-high word order. - */ + /** {@link ByteBufByteOps} that assumes big-endian byte order and low-high word order. */ public static final ByteBufByteOps BIG_ENDIAN_LOW_HIGH = new ByteBufByteOps(new OrderedOps.BigEndianLowHighOps()); - /** - * {@link ByteBufByteOps} that assumes little-endian byte order and low-high word order. - */ + /** {@link ByteBufByteOps} that assumes little-endian byte order and low-high word order. */ public static final ByteBufByteOps LITTLE_ENDIAN_LOW_HIGH = new ByteBufByteOps(new OrderedOps.LittleEndianLowHighOps()); - public ByteBufByteOps(OrderedOps orderedOps) { super(orderedOps); } @@ -42,5 +32,4 @@ protected byte get(ByteBuf bytes, int index) { protected void set(ByteBuf bytes, int index, byte value) { bytes.setByte(index, value); } - } diff --git a/byteops-netty/src/test/java/com/digitalpetri/util/ByteBufByteOpsTest.java b/byteops-netty/src/test/java/com/digitalpetri/util/ByteBufByteOpsTest.java index 1284400..38be008 100644 --- a/byteops-netty/src/test/java/com/digitalpetri/util/ByteBufByteOpsTest.java +++ b/byteops-netty/src/test/java/com/digitalpetri/util/ByteBufByteOpsTest.java @@ -32,5 +32,4 @@ protected ByteOps getSwappedByteOps(ByteOrder byteOrder) { throw new IllegalArgumentException("unsupported byte order: " + byteOrder); } } - } diff --git a/byteops/src/main/java/com/digitalpetri/util/ByteArrayByteOps.java b/byteops/src/main/java/com/digitalpetri/util/ByteArrayByteOps.java index 9a9497c..29bdd31 100644 --- a/byteops/src/main/java/com/digitalpetri/util/ByteArrayByteOps.java +++ b/byteops/src/main/java/com/digitalpetri/util/ByteArrayByteOps.java @@ -1,35 +1,24 @@ package com.digitalpetri.util; -/** - * {@link ByteOps} implementation that operates on byte arrays. - */ +/** {@link ByteOps} implementation that operates on byte arrays. */ public final class ByteArrayByteOps extends AbstractByteOps { - /** - * {@link ByteArrayByteOps} that assumes big-endian byte order. - */ + /** {@link ByteArrayByteOps} that assumes big-endian byte order. */ public static final ByteArrayByteOps BIG_ENDIAN = new ByteArrayByteOps(new OrderedOps.BigEndianOps()); - /** - * {@link ByteArrayByteOps} that assumes little-endian byte order. - */ + /** {@link ByteArrayByteOps} that assumes little-endian byte order. */ public static final ByteArrayByteOps LITTLE_ENDIAN = new ByteArrayByteOps(new OrderedOps.LittleEndianOps()); - /** - * {@link ByteArrayByteOps} that assumes big-endian byte order and low-high word order. - */ + /** {@link ByteArrayByteOps} that assumes big-endian byte order and low-high word order. */ public static final ByteArrayByteOps BIG_ENDIAN_LOW_HIGH = new ByteArrayByteOps(new OrderedOps.BigEndianLowHighOps()); - /** - * {@link ByteArrayByteOps} that assumes little-endian byte order and low-high word order. - */ + /** {@link ByteArrayByteOps} that assumes little-endian byte order and low-high word order. */ public static final ByteArrayByteOps LITTLE_ENDIAN_LOW_HIGH = new ByteArrayByteOps(new OrderedOps.LittleEndianLowHighOps()); - public ByteArrayByteOps(OrderedOps orderedOps) { super(orderedOps); } @@ -43,5 +32,4 @@ protected byte get(byte[] bytes, int index) { protected void set(byte[] bytes, int index, byte value) { bytes[index] = value; } - } diff --git a/byteops/src/main/java/com/digitalpetri/util/ByteBufferByteOps.java b/byteops/src/main/java/com/digitalpetri/util/ByteBufferByteOps.java index cadbf4a..945aeec 100644 --- a/byteops/src/main/java/com/digitalpetri/util/ByteBufferByteOps.java +++ b/byteops/src/main/java/com/digitalpetri/util/ByteBufferByteOps.java @@ -2,36 +2,25 @@ import java.nio.ByteBuffer; -/** - * {@link ByteOps} implementation that operates on {@link ByteBuffer}s. - */ +/** {@link ByteOps} implementation that operates on {@link ByteBuffer}s. */ public final class ByteBufferByteOps extends AbstractByteOps { - /** - * {@link ByteBufferByteOps} that assumes big-endian byte order. - */ + /** {@link ByteBufferByteOps} that assumes big-endian byte order. */ public static final ByteBufferByteOps BIG_ENDIAN = new ByteBufferByteOps(new OrderedOps.BigEndianOps()); - /** - * {@link ByteBufferByteOps} that assumes little-endian byte order. - */ + /** {@link ByteBufferByteOps} that assumes little-endian byte order. */ public static final ByteBufferByteOps LITTLE_ENDIAN = new ByteBufferByteOps(new OrderedOps.LittleEndianOps()); - /** - * {@link ByteBufferByteOps} that assumes big-endian byte order and low-high word order. - */ + /** {@link ByteBufferByteOps} that assumes big-endian byte order and low-high word order. */ public static final ByteBufferByteOps BIG_ENDIAN_LOW_HIGH = new ByteBufferByteOps(new OrderedOps.BigEndianLowHighOps()); - /** - * {@link ByteBufferByteOps} that assumes little-endian byte order and low-high word order. - */ + /** {@link ByteBufferByteOps} that assumes little-endian byte order and low-high word order. */ public static final ByteBufferByteOps LITTLE_ENDIAN_LOW_HIGH = new ByteBufferByteOps(new OrderedOps.LittleEndianLowHighOps()); - public ByteBufferByteOps(OrderedOps orderedOps) { super(orderedOps); } @@ -45,5 +34,4 @@ protected byte get(ByteBuffer bytes, int index) { protected void set(ByteBuffer bytes, int index, byte value) { bytes.put(index, value); } - } diff --git a/byteops/src/main/java/com/digitalpetri/util/OrderedOps.java b/byteops/src/main/java/com/digitalpetri/util/OrderedOps.java index a44709c..f44bf9d 100644 --- a/byteops/src/main/java/com/digitalpetri/util/OrderedOps.java +++ b/byteops/src/main/java/com/digitalpetri/util/OrderedOps.java @@ -37,8 +37,8 @@ public interface OrderedOps { long getLong(Function getByte, int index); /** - * Set the bytes of a short value using the given {@code setByte} function, starting - * {@code index}. + * Set the bytes of a short value using the given {@code setByte} function, starting {@code + * index}. * * @param setByte a function that takes an index and a byte value to set. * @param index the index to start at. @@ -47,8 +47,8 @@ public interface OrderedOps { void setShort(BiConsumer setByte, int index, short value); /** - * Set the bytes of an int value using the given {@code setByte} function, starting at - * {@code index}. + * Set the bytes of an int value using the given {@code setByte} function, starting at {@code + * index}. * * @param setByte a function that takes an index and a byte value to set. * @param index the index to start at. @@ -57,8 +57,8 @@ public interface OrderedOps { void setInt(BiConsumer setByte, int index, int value); /** - * Set the bytes of a long value using the given {@code setByte} function, starting at - * {@code index}. + * Set the bytes of a long value using the given {@code setByte} function, starting at {@code + * index}. * * @param setByte a function that takes an index and a byte value to set. * @param index the index to start at. @@ -103,8 +103,14 @@ public long getLong(Function getByte, int index) { long b5 = getByte.apply(index + 5) & 0xFF; long b6 = getByte.apply(index + 6) & 0xFF; long b7 = getByte.apply(index + 7) & 0xFF; - return (b0 << 56) | (b1 << 48) | (b2 << 40) | (b3 << 32) - | (b4 << 24) | (b5 << 16) | (b6 << 8) | b7; + return (b0 << 56) + | (b1 << 48) + | (b2 << 40) + | (b3 << 32) + | (b4 << 24) + | (b5 << 16) + | (b6 << 8) + | b7; } @Override @@ -132,7 +138,6 @@ public void setLong(BiConsumer setByte, int index, long value) { setByte.accept(index + 6, (byte) (value >> 8 & 0xFF)); setByte.accept(index + 7, (byte) (value & 0xFF)); } - } /** @@ -172,8 +177,14 @@ public long getLong(Function getByte, int index) { long b5 = getByte.apply(index + 5) & 0xFF; long b6 = getByte.apply(index + 6) & 0xFF; long b7 = getByte.apply(index + 7) & 0xFF; - return (b7 << 56) | (b6 << 48) | (b5 << 40) | (b4 << 32) - | (b3 << 24) | (b2 << 16) | (b1 << 8) | b0; + return (b7 << 56) + | (b6 << 48) + | (b5 << 40) + | (b4 << 32) + | (b3 << 24) + | (b2 << 16) + | (b1 << 8) + | b0; } @Override @@ -201,7 +212,6 @@ public void setLong(BiConsumer setByte, int index, long value) { setByte.accept(index + 6, (byte) (value >> 48 & 0xFF)); setByte.accept(index + 7, (byte) (value >> 56 & 0xFF)); } - } /** @@ -241,8 +251,14 @@ public long getLong(Function getByte, int index) { long b5 = getByte.apply(index + 5) & 0xFF; long b6 = getByte.apply(index + 6) & 0xFF; long b7 = getByte.apply(index + 7) & 0xFF; - return (b6 << 56) | (b7 << 48) | (b4 << 40) | (b5 << 32) - | (b2 << 24) | (b3 << 16) | (b0 << 8) | b1; + return (b6 << 56) + | (b7 << 48) + | (b4 << 40) + | (b5 << 32) + | (b2 << 24) + | (b3 << 16) + | (b0 << 8) + | b1; } @Override @@ -270,7 +286,6 @@ public void setLong(BiConsumer setByte, int index, long value) { setByte.accept(index + 6, (byte) (value >> 56 & 0xFF)); setByte.accept(index + 7, (byte) (value >> 48 & 0xFF)); } - } /** @@ -310,8 +325,14 @@ public long getLong(Function getByte, int index) { long b5 = getByte.apply(index + 5) & 0xFF; long b6 = getByte.apply(index + 6) & 0xFF; long b7 = getByte.apply(index + 7) & 0xFF; - return (b1 << 56) | (b0 << 48) | (b3 << 40) | (b2 << 32) - | (b5 << 24) | (b4 << 16) | (b7 << 8) | b6; + return (b1 << 56) + | (b0 << 48) + | (b3 << 40) + | (b2 << 32) + | (b5 << 24) + | (b4 << 16) + | (b7 << 8) + | b6; } @Override @@ -339,7 +360,5 @@ public void setLong(BiConsumer setByte, int index, long value) { setByte.accept(index + 6, (byte) (value & 0xFF)); setByte.accept(index + 7, (byte) (value >> 8 & 0xFF)); } - } - } diff --git a/byteops/src/test/java/com/digitalpetri/util/ByteArrayByteOpsTest.java b/byteops/src/test/java/com/digitalpetri/util/ByteArrayByteOpsTest.java index 239a5bc..598aacb 100644 --- a/byteops/src/test/java/com/digitalpetri/util/ByteArrayByteOpsTest.java +++ b/byteops/src/test/java/com/digitalpetri/util/ByteArrayByteOpsTest.java @@ -33,5 +33,4 @@ protected ByteOps getSwappedByteOps(ByteOrder byteOrder) { throw new IllegalArgumentException("unsupported byte order: " + byteOrder); } } - -} \ No newline at end of file +} diff --git a/byteops/src/test/java/com/digitalpetri/util/ByteBufferByteOpsTest.java b/byteops/src/test/java/com/digitalpetri/util/ByteBufferByteOpsTest.java index 269da9c..ac82b58 100644 --- a/byteops/src/test/java/com/digitalpetri/util/ByteBufferByteOpsTest.java +++ b/byteops/src/test/java/com/digitalpetri/util/ByteBufferByteOpsTest.java @@ -31,5 +31,4 @@ protected ByteOps getSwappedByteOps(ByteOrder byteOrder) { throw new IllegalArgumentException("unsupported byte order: " + byteOrder); } } - } diff --git a/pom.xml b/pom.xml index 74d849b..b6e5688 100644 --- a/pom.xml +++ b/pom.xml @@ -41,8 +41,12 @@ 11 11 + 11 UTF-8 + + 17 + 0.9.4 4.1.112.Final @@ -50,6 +54,9 @@ 5.10.2 2.0.16 + + + 3.0.0 @@ -156,6 +163,58 @@ + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.2.0 + + + + toolchain + + + + + + + ${jdk.toolchain.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + ${maven.compiler.source} + ${maven.compiler.target} + ${maven.compiler.release} + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless-maven-plugin.version} + + + + + + + + + + check + + + + + + + ossrh