Skip to content

Commit 60efe28

Browse files
committed
Test and benchmark fixes
1 parent 1a674e0 commit 60efe28

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ dependencies {
2323
testImplementation(libs.junit.jupiter)
2424
testImplementation(libs.jmh.core)
2525
testAnnotationProcessor(libs.jmh.generator.annprocess)
26+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
2627
}
2728

2829
checkerFramework {
2930
version = libs.versions.checkerframework
31+
32+
checkers = listOf(
33+
"org.checkerframework.checker.compilermsgs.CompilerMessagesChecker"
34+
)
3035
}
3136

3237
java {

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[versions]
22
checkerframework = "3.26.0"
3-
jmh = "1.27"
3+
jmh = "1.37"
44

55
[libraries]
66
checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerframework" }
77
checker = { group = "org.checkerframework", name = "checker", version.ref = "checkerframework" }
88
jmh-core = { group = "org.openjdk.jmh", name = "jmh-core", version.ref = "jmh" }
99
jmh-generator-annprocess = { group = "org.openjdk.jmh", name = "jmh-generator-annprocess", version.ref = "jmh" }
10-
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.7.0" }
10+
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version = "5.14.3" }
1111

1212
[bundles]
1313

src/main/java/org/cloudburstmc/nbt/NBTInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private Object deserialize(NbtType<?> type, int maxDepth) throws IOException {
126126
case LIST:
127127
int typeId = input.readUnsignedByte();
128128
NbtType<?> listType = NbtType.byId(typeId);
129-
List<? super Object> list = new ArrayList<>();
129+
List<Object> list = new ArrayList<>();
130130
int listLength = input.readInt();
131131
for (int i = 0; i < listLength; i++) {
132132
list.add(deserialize(listType, maxDepth - 1));

src/test/java/org/cloudburstmc/nbt/NbtBenchmarkTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.openjdk.jmh.runner.options.Options;
99
import org.openjdk.jmh.runner.options.OptionsBuilder;
1010
import org.openjdk.jmh.runner.options.TimeValue;
11+
import org.openjdk.jmh.runner.options.VerboseMode;
1112

1213
import java.io.ByteArrayInputStream;
1314
import java.io.ByteArrayOutputStream;
@@ -25,7 +26,7 @@ public void launchBenchmark() throws Exception {
2526
Options opt = new OptionsBuilder()
2627
// Specify which benchmarks to run.
2728
// You can be more specific if you'd like to run only one benchmark per test.
28-
.include(this.getClass().getName() + ".*")
29+
.include(NbtBenchmarkTests.class.getName() + ".*")
2930
// Set the following options as needed
3031
.mode(Mode.AverageTime)
3132
.timeUnit(TimeUnit.MICROSECONDS)
@@ -35,6 +36,7 @@ public void launchBenchmark() throws Exception {
3536
.measurementIterations(10)
3637
.threads(2)
3738
.forks(1)
39+
.verbosity(VerboseMode.NORMAL)
3840
.shouldFailOnError(true)
3941
.shouldDoGC(true)
4042
//.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining")
@@ -51,6 +53,7 @@ public static class BenchmarkState {
5153
@Setup(Level.Trial)
5254
public void initialize() {
5355
InputStream stream = NbtBenchmarkTests.class.getClassLoader().getResourceAsStream("benchmark.nbt");
56+
assert stream != null;
5457
try (GZIPInputStream is = new GZIPInputStream(stream)) {
5558
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
5659

@@ -73,4 +76,4 @@ public void cloudBenchmark(BenchmarkState state, Blackhole bh) throws IOExceptio
7376
NBTInputStream stream = NbtUtils.createReader(new ByteArrayInputStream(state.nbtBytes));
7477
stream.readTag();
7578
}
76-
}
79+
}

0 commit comments

Comments
 (0)