From 91dbd7474041880d2babc7124fcce20fe61493c1 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 17 Oct 2022 19:38:56 +0200 Subject: Remove Checker Framework; add NullAway, Picnic Error Prone Support. Change-Id: I6558f0b4db0f9a192c18bbe45e2eaf10595bc666 --- jgvariant-ostree/pom.xml | 14 -------------- .../main/java/eu/mulk/jgvariant/ostree/Commit.java | 10 +++++----- .../main/java/eu/mulk/jgvariant/ostree/DirTree.java | 11 ++++------- .../main/java/eu/mulk/jgvariant/ostree/Metadata.java | 6 +++--- .../java/eu/mulk/jgvariant/ostree/SignedDelta.java | 5 +++-- .../main/java/eu/mulk/jgvariant/ostree/Summary.java | 5 +++-- .../eu/mulk/jgvariant/ostree/SummarySignature.java | 6 +++--- .../java/eu/mulk/jgvariant/ostree/ByteStringTest.java | 8 ++++---- .../eu/mulk/jgvariant/ostree/OstreeDecoderTest.java | 19 ++++++++++++------- 9 files changed, 37 insertions(+), 47 deletions(-) (limited to 'jgvariant-ostree') diff --git a/jgvariant-ostree/pom.xml b/jgvariant-ostree/pom.xml index 5c01184..79f5f48 100644 --- a/jgvariant-ostree/pom.xml +++ b/jgvariant-ostree/pom.xml @@ -63,20 +63,6 @@ SPDX-License-Identifier: LGPL-3.0-or-later xz - - - org.checkerframework - checker - provided - true - - - org.checkerframework - checker-qual - provided - true - - org.junit.jupiter diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Commit.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Commit.java index 209827d..f14e758 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Commit.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Commit.java @@ -4,9 +4,10 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.UTF_8; + import eu.mulk.jgvariant.core.Decoder; import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -48,8 +49,7 @@ public record Commit( public record RelatedObject(String ref, Checksum commitChecksum) { private static final Decoder DECODER = - Decoder.ofStructure( - RelatedObject.class, Decoder.ofString(StandardCharsets.UTF_8), Checksum.decoder()); + Decoder.ofStructure(RelatedObject.class, Decoder.ofString(UTF_8), Checksum.decoder()); public static Decoder decoder() { return DECODER; @@ -62,8 +62,8 @@ public record Commit( Metadata.decoder(), Checksum.decoder(), Decoder.ofArray(RelatedObject.decoder()), - Decoder.ofString(StandardCharsets.UTF_8), - Decoder.ofString(StandardCharsets.UTF_8), + Decoder.ofString(UTF_8), + Decoder.ofString(UTF_8), Decoder.ofLong().withByteOrder(ByteOrder.BIG_ENDIAN), Checksum.decoder(), Checksum.decoder()); diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DirTree.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DirTree.java index dc38b1b..8ac9e67 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DirTree.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/DirTree.java @@ -4,8 +4,9 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.UTF_8; + import eu.mulk.jgvariant.core.Decoder; -import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -34,8 +35,7 @@ public record DirTree(List files, List directories) { public record File(String name, Checksum checksum) { private static final Decoder DECODER = - Decoder.ofStructure( - File.class, Decoder.ofString(StandardCharsets.UTF_8), Checksum.decoder()); + Decoder.ofStructure(File.class, Decoder.ofString(UTF_8), Checksum.decoder()); /** * Acquires a {@link Decoder} for the enclosing type. @@ -58,10 +58,7 @@ public record DirTree(List files, List directories) { private static final Decoder DECODER = Decoder.ofStructure( - Directory.class, - Decoder.ofString(StandardCharsets.UTF_8), - Checksum.decoder(), - Checksum.decoder()); + Directory.class, Decoder.ofString(UTF_8), Checksum.decoder(), Checksum.decoder()); /** * Acquires a {@link Decoder} for the enclosing type. diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Metadata.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Metadata.java index 6e1f820..62f0331 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Metadata.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Metadata.java @@ -4,9 +4,10 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.UTF_8; + import eu.mulk.jgvariant.core.Decoder; import eu.mulk.jgvariant.core.Variant; -import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -19,8 +20,7 @@ import java.util.Map; public record Metadata(Map fields) { private static final Decoder DECODER = - Decoder.ofDictionary(Decoder.ofString(StandardCharsets.UTF_8), Decoder.ofVariant()) - .map(Metadata::new); + Decoder.ofDictionary(Decoder.ofString(UTF_8), Decoder.ofVariant()).map(Metadata::new); /** * Acquires a {@link Decoder} for the enclosing type. diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SignedDelta.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SignedDelta.java index e1fcd53..827d5e4 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SignedDelta.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SignedDelta.java @@ -4,11 +4,12 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.US_ASCII; + import eu.mulk.jgvariant.core.Decoder; import eu.mulk.jgvariant.core.Variant; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -31,7 +32,7 @@ public record SignedDelta( SignedDelta.class, Decoder.ofLong().withByteOrder(ByteOrder.BIG_ENDIAN), ByteString.decoder().map(SignedDelta::decodeSuperblock), - Decoder.ofDictionary(Decoder.ofString(StandardCharsets.US_ASCII), Decoder.ofVariant())); + Decoder.ofDictionary(Decoder.ofString(US_ASCII), Decoder.ofVariant())); private static DeltaSuperblock decodeSuperblock(ByteString byteString) { return DeltaSuperblock.decoder().decode(ByteBuffer.wrap(byteString.bytes())); diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Summary.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Summary.java index 150ab00..2b8096d 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Summary.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Summary.java @@ -4,9 +4,10 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.UTF_8; + import eu.mulk.jgvariant.core.Decoder; import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -58,7 +59,7 @@ public record Summary(List entries, Metadata metadata) { } private static final Decoder DECODER = - Decoder.ofStructure(Entry.class, Decoder.ofString(StandardCharsets.UTF_8), Value.decoder()); + Decoder.ofStructure(Entry.class, Decoder.ofString(UTF_8), Value.decoder()); /** * Acquires a {@link Decoder} for the enclosing type. diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SummarySignature.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SummarySignature.java index c878955..3c88759 100644 --- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SummarySignature.java +++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/SummarySignature.java @@ -4,9 +4,10 @@ package eu.mulk.jgvariant.ostree; +import static java.nio.charset.StandardCharsets.UTF_8; + import eu.mulk.jgvariant.core.Decoder; import eu.mulk.jgvariant.core.Variant; -import java.nio.charset.StandardCharsets; import java.util.Map; /** @@ -21,8 +22,7 @@ import java.util.Map; public record SummarySignature(Map signatures) { private static final Decoder DECODER = - Decoder.ofDictionary(Decoder.ofString(StandardCharsets.UTF_8), Decoder.ofVariant()) - .map(SummarySignature::new); + Decoder.ofDictionary(Decoder.ofString(UTF_8), Decoder.ofVariant()).map(SummarySignature::new); /** * Acquires a {@link Decoder} for the enclosing type. diff --git a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java index 1d3d84d..cd21e3c 100644 --- a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java +++ b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java @@ -11,25 +11,25 @@ import org.junit.jupiter.api.Test; class ByteStringTest { @Test - void testToModifiedBase64() { + void toModifiedBase64() { assertEquals("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI", testByteString1.modifiedBase64()); } @Test - void testOfModifiedBase64() { + void ofModifiedBase64() { assertEquals( testByteString1, ByteString.ofModifiedBase64("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI")); } @Test - void testToHex() { + void toHex() { assertEquals( "31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52", testByteString1.hex()); } @Test - void testOfHex() { + void ofHex() { assertEquals( testByteString1, ByteString.ofHex("31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52")); diff --git a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java index d8ad271..bca8142 100644 --- a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java +++ b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java @@ -17,7 +17,12 @@ import java.util.Map; import org.junit.jupiter.api.Test; @TestWithResources -@SuppressWarnings("initialization.field.uninitialized") +@SuppressWarnings({ + "ImmutableListOf1", + "ImmutableMapOf1", + "initialization.field.uninitialized", + "NullAway" +}) class OstreeDecoderTest { @GivenBinaryResource("/ostree/summary") @@ -42,7 +47,7 @@ class OstreeDecoderTest { byte[] deltaPartPayloadBytes; @Test - void testSummaryDecoder() { + void summaryDecoder() { var decoder = Summary.decoder(); var summary = decoder.decode(ByteBuffer.wrap(summaryBytes)); assertAll( @@ -65,35 +70,35 @@ class OstreeDecoderTest { } @Test - void testCommitDecoder() { + void commitDecoder() { var decoder = Commit.decoder(); var commit = decoder.decode(ByteBuffer.wrap(commitBytes)); System.out.println(commit); } @Test - void testDirTreeDecoder() { + void dirTreeDecoder() { var decoder = DirTree.decoder(); var dirTree = decoder.decode(ByteBuffer.wrap(dirTreeBytes)); System.out.println(dirTree); } @Test - void testDirMetaDecoder() { + void dirMetaDecoder() { var decoder = DirMeta.decoder(); var dirMeta = decoder.decode(ByteBuffer.wrap(dirMetaBytes)); System.out.println(dirMeta); } @Test - void testSuperblockDecoder() { + void superblockDecoder() { var decoder = DeltaSuperblock.decoder(); var deltaSuperblock = decoder.decode(ByteBuffer.wrap(deltaSuperblockBytes)); System.out.println(deltaSuperblock); } @Test - void testPartPayloadDecoder() { + void partPayloadDecoder() { var superblockDecoder = DeltaSuperblock.decoder(); var superblock = superblockDecoder.decode(ByteBuffer.wrap(deltaSuperblockBytes)); -- cgit v1.2.3