From e82fbac888e8057a8ed0ba6117f8ea0010a4f8b2 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Mon, 17 Jul 2023 15:12:54 +0200 Subject: jdk21: set methods final in vespajlib + fix import issues --- vespajlib/abi-spec.json | 5 +++-- vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java | 12 ++++++++++-- vespajlib/src/main/java/com/yahoo/io/NativeIO.java | 2 +- vespajlib/src/main/java/com/yahoo/net/URI.java | 2 +- vespajlib/src/main/java/com/yahoo/tensor/TensorType.java | 3 +-- 5 files changed, 16 insertions(+), 8 deletions(-) (limited to 'vespajlib') diff --git a/vespajlib/abi-spec.json b/vespajlib/abi-spec.json index 76d007dd633..6234ff02a6c 100644 --- a/vespajlib/abi-spec.json +++ b/vespajlib/abi-spec.json @@ -419,7 +419,7 @@ "public void (java.lang.String, java.lang.String, int, java.lang.String)", "public boolean isValid()", "public java.lang.String getScheme()", - "public boolean isOpaque()", + "public final boolean isOpaque()", "public java.lang.String getHost()", "public int getPort()", "public java.lang.String getRest()", @@ -1319,7 +1319,8 @@ "superClass" : "java.lang.Object", "interfaces" : [ ], "attributes" : [ - "public" + "public", + "final" ], "methods" : [ "public void ()", diff --git a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java index 479375d6b74..24071f03966 100644 --- a/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java +++ b/vespajlib/src/main/java/com/yahoo/io/GrowableByteBuffer.java @@ -3,7 +3,15 @@ package com.yahoo.io; import com.yahoo.text.Utf8; -import java.nio.*; +import java.nio.BufferOverflowException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.CharBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; +import java.nio.ShortBuffer; /** * GrowableByteBuffer encapsulates a ByteBuffer and grows it as needed. @@ -70,7 +78,7 @@ public class GrowableByteBuffer implements Comparable { return growFactor; } - public void setGrowFactor(float growFactor) { + public final void setGrowFactor(float growFactor) { if (growFactor <= 1.00f) { throw new IllegalArgumentException("Growth factor must be greater than 1.00f, otherwise buffer will never grow!"); } diff --git a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java index 96224cc220c..2c0fa235b6a 100644 --- a/vespajlib/src/main/java/com/yahoo/io/NativeIO.java +++ b/vespajlib/src/main/java/com/yahoo/io/NativeIO.java @@ -74,7 +74,7 @@ public class NativeIO { } public boolean valid() { return fdField.isInitialized(); } - public Throwable getError() { return fdField.getError(); } + public final Throwable getError() { return fdField.getError(); } /** * Will hint the OS that data read so far will not be accessed again and should hence be dropped from the buffer cache. diff --git a/vespajlib/src/main/java/com/yahoo/net/URI.java b/vespajlib/src/main/java/com/yahoo/net/URI.java index 36d9d453165..6e3d48c0b6f 100644 --- a/vespajlib/src/main/java/com/yahoo/net/URI.java +++ b/vespajlib/src/main/java/com/yahoo/net/URI.java @@ -399,7 +399,7 @@ public class URI implements Cloneable, Comparable { * * @return true if the url is opaque, false if it is hierarchical */ - public boolean isOpaque() { + public final boolean isOpaque() { return opaque; } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java index 57d276f278e..6b010529046 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java @@ -486,7 +486,7 @@ public class TensorType { } - public static class Builder { + public static final class Builder { private final Map dimensions = new LinkedHashMap<>(); @@ -614,4 +614,3 @@ public class TensorType { } } - -- cgit v1.2.3