From 3f99a20e6300c3d00beaa3e27b89cc647f1b2306 Mon Sep 17 00:00:00 2001 From: Dmitriy Tverdiakov Date: Tue, 26 Jul 2022 22:37:48 +0100 Subject: [PATCH] Enable compilation failures on warnings for driver module main sources This is primarily an extra protection from unintended warnings. --- driver/clirr-ignored-differences.xml | 6 ++++++ .../java/org/neo4j/driver/QueryRunner.java | 5 ++++- .../src/main/java/org/neo4j/driver/Values.java | 11 +++++++++++ .../exceptions/AuthenticationException.java | 5 +++++ .../AuthorizationExpiredException.java | 5 +++++ .../driver/exceptions/ClientException.java | 5 +++++ .../ConnectionReadTimeoutException.java | 5 +++++ .../driver/exceptions/DatabaseException.java | 5 +++++ .../driver/exceptions/DiscoveryException.java | 5 +++++ .../exceptions/FatalDiscoveryException.java | 5 +++++ .../driver/exceptions/Neo4jException.java | 3 +++ .../exceptions/NoSuchRecordException.java | 2 ++ .../driver/exceptions/ProtocolException.java | 5 +++++ .../exceptions/ResultConsumedException.java | 4 ++++ .../driver/exceptions/SecurityException.java | 5 +++++ .../ServiceUnavailableException.java | 5 +++++ .../exceptions/SessionExpiredException.java | 5 +++++ .../exceptions/TokenExpiredException.java | 5 +++++ .../TransactionNestingException.java | 5 +++++ .../driver/exceptions/TransientException.java | 5 +++++ .../exceptions/UntrustedServerException.java | 5 +++++ .../driver/exceptions/value/LossyCoercion.java | 3 +++ .../exceptions/value/NotMultiValued.java | 3 +++ .../driver/exceptions/value/Uncoercible.java | 3 +++ .../driver/exceptions/value/Unsizable.java | 3 +++ .../exceptions/value/ValueException.java | 2 ++ .../internal/DefaultBookmarksHolder.java | 1 + .../driver/internal/InternalBookmark.java | 5 +++++ .../neo4j/driver/internal/InternalDriver.java | 1 + .../neo4j/driver/internal/InternalEntity.java | 4 +--- .../neo4j/driver/internal/InternalNode.java | 1 + .../neo4j/driver/internal/InternalPath.java | 2 ++ .../driver/internal/InternalRelationship.java | 3 +++ .../neo4j/driver/internal/InternalSession.java | 8 +++++++- .../driver/internal/SessionFactoryImpl.java | 1 + .../internal/async/InternalAsyncSession.java | 15 ++++++++++++--- .../async/LeakLoggingNetworkSession.java | 1 + .../internal/async/NetworkConnection.java | 2 +- .../async/pool/ConnectionPoolImpl.java | 2 +- .../internal/async/pool/NettyChannelPool.java | 2 +- .../async/pool/NettyChannelTracker.java | 6 +++--- .../driver/internal/logging/NettyLogger.java | 6 +++++- .../messaging/common/CommonValueUnpacker.java | 1 + .../internal/messaging/v5/ValueUnpackerV5.java | 1 + .../internal/reactive/InternalRxResult.java | 1 + .../internal/reactive/InternalRxSession.java | 1 + .../reactive/InternalRxTransaction.java | 1 + .../driver/internal/summary/InternalPlan.java | 2 +- .../internal/svm/NettySubstitutions.java | 18 +++++++++++------- .../neo4j/driver/internal/util/ErrorUtil.java | 4 ++++ .../java/org/neo4j/driver/util/Resource.java | 3 +++ examples/pom.xml | 7 +++++++ pom.xml | 12 ++++++++++++ testkit-backend/pom.xml | 7 +++++++ 54 files changed, 215 insertions(+), 23 deletions(-) diff --git a/driver/clirr-ignored-differences.xml b/driver/clirr-ignored-differences.xml index 080ae04669..9bd4cb886c 100644 --- a/driver/clirr-ignored-differences.xml +++ b/driver/clirr-ignored-differences.xml @@ -334,4 +334,10 @@ java.lang.String neo4jErrorCode() + + org/neo4j/driver/QueryRunner + 7012 + void close() + + diff --git a/driver/src/main/java/org/neo4j/driver/QueryRunner.java b/driver/src/main/java/org/neo4j/driver/QueryRunner.java index 50b7447e10..b98babd29a 100644 --- a/driver/src/main/java/org/neo4j/driver/QueryRunner.java +++ b/driver/src/main/java/org/neo4j/driver/QueryRunner.java @@ -23,4 +23,7 @@ * * @since 1.0 */ -public interface QueryRunner extends SimpleQueryRunner, AutoCloseable {} +public interface QueryRunner extends SimpleQueryRunner, AutoCloseable { + @Override + void close() throws RuntimeException; +} diff --git a/driver/src/main/java/org/neo4j/driver/Values.java b/driver/src/main/java/org/neo4j/driver/Values.java index 9c6b9d0699..6b39c245eb 100644 --- a/driver/src/main/java/org/neo4j/driver/Values.java +++ b/driver/src/main/java/org/neo4j/driver/Values.java @@ -570,12 +570,23 @@ public static Function ofEntity() { /** * Converts values to {@link Long entity id}. * + * @deprecated superseded by {@link #ofEntityElementId()}. * @return a function that returns the id an entity {@link Value} */ + @Deprecated public static Function ofEntityId() { return val -> val.asEntity().id(); } + /** + * Converts values to {@link String element id}. + * + * @return a function that returns the element id of an entity {@link Value} + */ + public static Function ofEntityElementId() { + return val -> val.asEntity().elementId(); + } + /** * Converts values to {@link Node}. * diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java b/driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java index 6be2924da6..b2195e8707 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * Failed to authenticate the driver to the server due to bad credentials provided. * When this error happens, the error could be recovered by closing the current driver and restart a new driver with @@ -26,6 +28,9 @@ * @since 1.1 */ public class AuthenticationException extends SecurityException { + @Serial + private static final long serialVersionUID = 1324352999966240271L; + public AuthenticationException(String code, String message) { super(code, message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java b/driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java index 459eb4000d..80fbd9f393 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * The authorization info maintained on the server has expired. The client should reconnect. *

* Error code: Neo.ClientError.Security.AuthorizationExpired */ public class AuthorizationExpiredException extends SecurityException implements RetryableException { + @Serial + private static final long serialVersionUID = 5688002170978405558L; + public static final String DESCRIPTION = "Authorization information kept on the server has expired, this connection is no longer valid."; diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java b/driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java index 9fb1a21069..c84e14d036 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * A ClientException indicates that the client has carried out an operation incorrectly. * The error code provided can be used to determine further detail for the problem. * @since 1.0 */ public class ClientException extends Neo4jException { + @Serial + private static final long serialVersionUID = -6732913155228185887L; + public ClientException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java b/driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java index 3d8d3ad4b0..730411167f 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * Indicates that read timed out due to it taking longer than the server-supplied timeout value via the {@code connection.recv_timeout_seconds} configuration * hint. The server might provide this value to clients to let them know when a given connection may be considered broken if client does not get any * communication from the server within the specified timeout period. This results in the server being removed from the routing table. */ public class ConnectionReadTimeoutException extends ServiceUnavailableException { + @Serial + private static final long serialVersionUID = -9222586212813330140L; + public static final ConnectionReadTimeoutException INSTANCE = new ConnectionReadTimeoutException( "Connection read timed out due to it taking longer than the server-supplied timeout value via configuration hint."); diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java b/driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java index 6af8227a17..f0ae7c0887 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * A DatabaseException indicates that there is a problem within the underlying database. * The error code provided can be used to determine further detail for the problem. * @since 1.0 */ public class DatabaseException extends Neo4jException { + @Serial + private static final long serialVersionUID = 4591061578560201032L; + public DatabaseException(String code, String message) { super(code, message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java b/driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java index 7f72b2c07b..8b9da1293b 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * An error has happened while getting routing table with a remote server. * While this error is not fatal and we might be able to recover if we continue trying on another server. @@ -27,6 +29,9 @@ * If you see this error in your logs, it is safe to ignore if your cluster is temporarily changing structure during that time. */ public class DiscoveryException extends Neo4jException { + @Serial + private static final long serialVersionUID = 6711564351333659090L; + public DiscoveryException(String message, Throwable cause) { super(message, cause); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java b/driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java index a24d49df71..b772c1dec8 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * This error indicate a fatal problem to obtain routing tables such as the routing table for a specified database does not exist. * This exception should not be retried. * @since 4.0 */ public class FatalDiscoveryException extends ClientException { + @Serial + private static final long serialVersionUID = -2831830142554054420L; + public FatalDiscoveryException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/Neo4jException.java b/driver/src/main/java/org/neo4j/driver/exceptions/Neo4jException.java index c54900f748..57fe73933f 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/Neo4jException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/Neo4jException.java @@ -18,12 +18,15 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * This is the base class for Neo4j exceptions. * * @since 1.0 */ public class Neo4jException extends RuntimeException { + @Serial private static final long serialVersionUID = -80579062276712566L; private final String code; diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/NoSuchRecordException.java b/driver/src/main/java/org/neo4j/driver/exceptions/NoSuchRecordException.java index c466a8377d..c93368c659 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/NoSuchRecordException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/NoSuchRecordException.java @@ -18,6 +18,7 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; import java.util.NoSuchElementException; /** @@ -28,6 +29,7 @@ * @since 1.0 */ public class NoSuchRecordException extends NoSuchElementException { + @Serial private static final long serialVersionUID = 9091962868264042491L; public NoSuchRecordException(String message) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/ProtocolException.java b/driver/src/main/java/org/neo4j/driver/exceptions/ProtocolException.java index cbd6f1f5d5..a11788c73a 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/ProtocolException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/ProtocolException.java @@ -18,11 +18,16 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * A signal that the contract for client-server communication has broken down. * The user should contact support and cannot resolve this his or herself. */ public class ProtocolException extends Neo4jException { + @Serial + private static final long serialVersionUID = -6806924452045883275L; + private static final String CODE = "Protocol violation: "; public ProtocolException(String message) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/ResultConsumedException.java b/driver/src/main/java/org/neo4j/driver/exceptions/ResultConsumedException.java index 707002a9cb..e1509bf35c 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/ResultConsumedException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/ResultConsumedException.java @@ -18,6 +18,7 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; import org.neo4j.driver.QueryRunner; /** @@ -26,6 +27,9 @@ * the {@link QueryRunner} where the resources are created has already been closed. */ public class ResultConsumedException extends ClientException { + @Serial + private static final long serialVersionUID = 944999841543178703L; + public ResultConsumedException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/SecurityException.java b/driver/src/main/java/org/neo4j/driver/exceptions/SecurityException.java index cd77ff5845..151b764c14 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/SecurityException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/SecurityException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * Failed to communicate with the server due to security errors. * When this type of error happens, the security cause of the error should be fixed to ensure the safety of your data. @@ -25,6 +27,9 @@ * @since 1.1 */ public class SecurityException extends ClientException { + @Serial + private static final long serialVersionUID = -5964665406806523214L; + public SecurityException(String code, String message) { super(code, message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/ServiceUnavailableException.java b/driver/src/main/java/org/neo4j/driver/exceptions/ServiceUnavailableException.java index 1f25c89fff..bd5222d398 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/ServiceUnavailableException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/ServiceUnavailableException.java @@ -18,12 +18,17 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * An ServiceUnavailableException indicates that the driver cannot communicate with the cluster. * * @since 1.1 */ public class ServiceUnavailableException extends Neo4jException implements RetryableException { + @Serial + private static final long serialVersionUID = 8316077882191697974L; + public ServiceUnavailableException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/SessionExpiredException.java b/driver/src/main/java/org/neo4j/driver/exceptions/SessionExpiredException.java index bbf53fb27b..da4da04685 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/SessionExpiredException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/SessionExpiredException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * A SessionExpiredException indicates that the session can no longer satisfy the criteria under which it was acquired, e.g. a server no longer accepts * write requests. A new session needs to be acquired from the driver and all actions taken on the expired session must be replayed. @@ -25,6 +27,9 @@ * @since 1.1 */ public class SessionExpiredException extends Neo4jException implements RetryableException { + @Serial + private static final long serialVersionUID = 843176371236755724L; + public SessionExpiredException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/TokenExpiredException.java b/driver/src/main/java/org/neo4j/driver/exceptions/TokenExpiredException.java index 4c6c47a75a..50140b1655 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/TokenExpiredException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/TokenExpiredException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * The provided token has expired. *

@@ -26,6 +28,9 @@ * Error code: Neo.ClientError.Security.TokenExpired */ public class TokenExpiredException extends SecurityException { + @Serial + private static final long serialVersionUID = -5593851859769531234L; + public TokenExpiredException(String code, String message) { super(code, message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/TransactionNestingException.java b/driver/src/main/java/org/neo4j/driver/exceptions/TransactionNestingException.java index 88bcf43b87..fe398e555b 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/TransactionNestingException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/TransactionNestingException.java @@ -18,10 +18,15 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * This exception indicates a user is nesting new transaction with an on-going transaction (unmanaged and/or auto-commit). */ public class TransactionNestingException extends ClientException { + @Serial + private static final long serialVersionUID = -8264319542004457065L; + public TransactionNestingException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/TransientException.java b/driver/src/main/java/org/neo4j/driver/exceptions/TransientException.java index 7ea55e7a7f..a2c3029d8e 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/TransientException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/TransientException.java @@ -18,6 +18,8 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * A TransientException signals a temporary fault that may be worked around by retrying. The error code provided can be used to determine further * detail for the problem. @@ -25,6 +27,9 @@ * @since 1.0 */ public class TransientException extends Neo4jException implements RetryableException { + @Serial + private static final long serialVersionUID = -2744576986358599923L; + public TransientException(String code, String message) { super(code, message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/UntrustedServerException.java b/driver/src/main/java/org/neo4j/driver/exceptions/UntrustedServerException.java index d62d292b2e..958ee2eafb 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/UntrustedServerException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/UntrustedServerException.java @@ -18,10 +18,15 @@ */ package org.neo4j.driver.exceptions; +import java.io.Serial; + /** * Thrown if the remote server cannot be verified as Neo4j. */ public class UntrustedServerException extends RuntimeException { + @Serial + private static final long serialVersionUID = 3196604305660766197L; + public UntrustedServerException(String message) { super(message); } diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/value/LossyCoercion.java b/driver/src/main/java/org/neo4j/driver/exceptions/value/LossyCoercion.java index bb52c7a7c9..ab9a16b894 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/value/LossyCoercion.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/value/LossyCoercion.java @@ -20,11 +20,14 @@ import static java.lang.String.format; +import java.io.Serial; + /** * A LossyCoercion exception indicates that the conversion cannot be achieved without losing precision. * @since 1.0 */ public class LossyCoercion extends ValueException { + @Serial private static final long serialVersionUID = -6259981390929065201L; public LossyCoercion(String sourceTypeName, String destinationTypeName) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/value/NotMultiValued.java b/driver/src/main/java/org/neo4j/driver/exceptions/value/NotMultiValued.java index 458c282376..a6005189b1 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/value/NotMultiValued.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/value/NotMultiValued.java @@ -18,12 +18,15 @@ */ package org.neo4j.driver.exceptions.value; +import java.io.Serial; + /** * A NotMultiValued exception indicates that the value does not consist of multiple values, a.k.a. not a map * or array. * @since 1.0 */ public class NotMultiValued extends ValueException { + @Serial private static final long serialVersionUID = -7380569883011364090L; public NotMultiValued(String message) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/value/Uncoercible.java b/driver/src/main/java/org/neo4j/driver/exceptions/value/Uncoercible.java index 74c1228372..c0a20f5f42 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/value/Uncoercible.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/value/Uncoercible.java @@ -20,11 +20,14 @@ import static java.lang.String.format; +import java.io.Serial; + /** * A Uncoercible exception indicates that the conversion cannot be achieved. * @since 1.0 */ public class Uncoercible extends ValueException { + @Serial private static final long serialVersionUID = -6259981390929065201L; public Uncoercible(String sourceTypeName, String destinationTypeName) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/value/Unsizable.java b/driver/src/main/java/org/neo4j/driver/exceptions/value/Unsizable.java index 915c5c169f..cfcb14264b 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/value/Unsizable.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/value/Unsizable.java @@ -18,11 +18,14 @@ */ package org.neo4j.driver.exceptions.value; +import java.io.Serial; + /** * An Unsizable exception indicates that the value does not have a size. * @since 1.0 */ public class Unsizable extends ValueException { + @Serial private static final long serialVersionUID = 741487155344252339L; public Unsizable(String message) { diff --git a/driver/src/main/java/org/neo4j/driver/exceptions/value/ValueException.java b/driver/src/main/java/org/neo4j/driver/exceptions/value/ValueException.java index 37b029de88..54bbc93fab 100644 --- a/driver/src/main/java/org/neo4j/driver/exceptions/value/ValueException.java +++ b/driver/src/main/java/org/neo4j/driver/exceptions/value/ValueException.java @@ -18,6 +18,7 @@ */ package org.neo4j.driver.exceptions.value; +import java.io.Serial; import org.neo4j.driver.exceptions.ClientException; /** @@ -25,6 +26,7 @@ * @since 1.0 */ public class ValueException extends ClientException { + @Serial private static final long serialVersionUID = -1269336313727174998L; public ValueException(String message) { diff --git a/driver/src/main/java/org/neo4j/driver/internal/DefaultBookmarksHolder.java b/driver/src/main/java/org/neo4j/driver/internal/DefaultBookmarksHolder.java index a4a0ac93f9..9122a3f879 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/DefaultBookmarksHolder.java +++ b/driver/src/main/java/org/neo4j/driver/internal/DefaultBookmarksHolder.java @@ -42,6 +42,7 @@ public Set getBookmarks() { return bookmarks; } + @SuppressWarnings("deprecation") @Override public void setBookmark(Bookmark bookmark) { if (bookmark != null && !bookmark.isEmpty()) { diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalBookmark.java b/driver/src/main/java/org/neo4j/driver/internal/InternalBookmark.java index 8c15dcf89f..eef7abf8c8 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalBookmark.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalBookmark.java @@ -20,6 +20,7 @@ import static java.util.Objects.requireNonNull; +import java.io.Serial; import java.io.Serializable; import java.util.Collections; import java.util.HashSet; @@ -29,6 +30,7 @@ import org.neo4j.driver.internal.util.Iterables; public final class InternalBookmark implements Bookmark, Serializable { + @Serial private static final long serialVersionUID = 8196096018245038950L; private static final InternalBookmark EMPTY = new InternalBookmark(Collections.emptySet()); @@ -44,6 +46,7 @@ public static Bookmark empty() { return EMPTY; } + @SuppressWarnings("deprecation") public static Bookmark from(Iterable bookmarks) { if (bookmarks == null) { return empty(); @@ -95,6 +98,7 @@ public static Bookmark parse(Set values) { } @Override + @Deprecated public boolean isEmpty() { return values.isEmpty(); } @@ -105,6 +109,7 @@ public String value() { } @Override + @Deprecated public Set values() { return Collections.unmodifiableSet(values); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalDriver.java b/driver/src/main/java/org/neo4j/driver/internal/InternalDriver.java index 2a7d1d29c3..155bc55af7 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalDriver.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalDriver.java @@ -72,6 +72,7 @@ public Session session(SessionConfig sessionConfig) { } @Override + @Deprecated public RxSession rxSession(SessionConfig sessionConfig) { return new InternalRxSession(newSession(sessionConfig)); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalEntity.java b/driver/src/main/java/org/neo4j/driver/internal/InternalEntity.java index 5b23cafec7..15656e2ce1 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalEntity.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalEntity.java @@ -30,9 +30,6 @@ import org.neo4j.driver.types.Entity; public abstract class InternalEntity implements Entity, AsValue { - public static final String INVALID_ID_ERROR = - "Numeric id is not available with this server deployment, please use the new string based element id alternative"; - private final long id; private final String elementId; private final Map properties; @@ -44,6 +41,7 @@ public InternalEntity(long id, String elementId, Map properties) } @Override + @Deprecated public long id() { return id; } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalNode.java b/driver/src/main/java/org/neo4j/driver/internal/InternalNode.java index 71195a504f..e70059c888 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalNode.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalNode.java @@ -60,6 +60,7 @@ public Value asValue() { } @Override + @SuppressWarnings("deprecation") public String toString() { return String.format("node<%s>", id()); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalPath.java b/driver/src/main/java/org/neo4j/driver/internal/InternalPath.java index e133cdfdb1..911c8ba91c 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalPath.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalPath.java @@ -82,6 +82,7 @@ public int hashCode() { } @Override + @SuppressWarnings("deprecation") public String toString() { return String.format( relationship.startNodeId() == start.id() ? "(%s)-[%s:%s]->(%s)" : "(%s)<-[%s:%s]-(%s)", @@ -92,6 +93,7 @@ public String toString() { } } + @SuppressWarnings("deprecation") private static boolean isEndpoint(Node node, Relationship relationship) { return node.id() == relationship.startNodeId() || node.id() == relationship.endNodeId(); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalRelationship.java b/driver/src/main/java/org/neo4j/driver/internal/InternalRelationship.java index 41aec3e3a8..c7eddac379 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalRelationship.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalRelationship.java @@ -75,6 +75,7 @@ public void setStartAndEnd(long start, String startElementId, long end, String e } @Override + @Deprecated public long startNodeId() { return start; } @@ -85,6 +86,7 @@ public String startNodeElementId() { } @Override + @Deprecated public long endNodeId() { return end; } @@ -105,6 +107,7 @@ public Value asValue() { } @Override + @SuppressWarnings("deprecation") public String toString() { return String.format("relationship<%s>", id()); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/InternalSession.java b/driver/src/main/java/org/neo4j/driver/internal/InternalSession.java index e9b63cd4dd..4e82b18bcc 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/InternalSession.java +++ b/driver/src/main/java/org/neo4j/driver/internal/InternalSession.java @@ -96,11 +96,13 @@ public Transaction beginTransaction(TransactionConfig config) { } @Override + @Deprecated public T readTransaction(TransactionWork work) { return readTransaction(work, TransactionConfig.empty()); } @Override + @Deprecated public T readTransaction(TransactionWork work, TransactionConfig config) { return transaction(AccessMode.READ, work, config); } @@ -111,11 +113,13 @@ public T executeRead(TransactionCallback callback, TransactionConfig conf } @Override + @Deprecated public T writeTransaction(TransactionWork work) { return writeTransaction(work, TransactionConfig.empty()); } @Override + @Deprecated public T writeTransaction(TransactionWork work, TransactionConfig config) { return transaction(AccessMode.WRITE, work, config); } @@ -126,6 +130,7 @@ public T executeWrite(TransactionCallback callback, TransactionConfig con } @Override + @Deprecated public Bookmark lastBookmark() { return InternalBookmark.from(session.lastBookmarks()); } @@ -135,7 +140,8 @@ public Set lastBookmarks() { return session.lastBookmarks(); } - private T transaction(AccessMode mode, TransactionWork work, TransactionConfig config) { + private T transaction( + AccessMode mode, @SuppressWarnings("deprecation") TransactionWork work, TransactionConfig config) { // use different code path compared to async so that work is executed in the caller thread // caller thread will also be the one who sleeps between retries; // it is unsafe to execute retries in the event loop threads because this can cause a deadlock diff --git a/driver/src/main/java/org/neo4j/driver/internal/SessionFactoryImpl.java b/driver/src/main/java/org/neo4j/driver/internal/SessionFactoryImpl.java index 23121148b3..e24c89ecfb 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/SessionFactoryImpl.java +++ b/driver/src/main/java/org/neo4j/driver/internal/SessionFactoryImpl.java @@ -67,6 +67,7 @@ private Set toDistinctSet(Iterable bookmarks) { if (bookmarks != null) { for (Bookmark bookmark : bookmarks) { if (bookmark != null) { + @SuppressWarnings("deprecation") Set values = bookmark.values(); int size = values.size(); if (size == 1) { diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/InternalAsyncSession.java b/driver/src/main/java/org/neo4j/driver/internal/async/InternalAsyncSession.java index 57da7cecba..adad847fad 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/InternalAsyncSession.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/InternalAsyncSession.java @@ -83,11 +83,13 @@ public CompletionStage beginTransactionAsync(TransactionConfig } @Override + @Deprecated public CompletionStage readTransactionAsync(AsyncTransactionWork> work) { return readTransactionAsync(work, TransactionConfig.empty()); } @Override + @Deprecated public CompletionStage readTransactionAsync( AsyncTransactionWork> work, TransactionConfig config) { return transactionAsync(AccessMode.READ, work, config); @@ -100,11 +102,13 @@ public CompletionStage executeReadAsync( } @Override + @Deprecated public CompletionStage writeTransactionAsync(AsyncTransactionWork> work) { return writeTransactionAsync(work, TransactionConfig.empty()); } @Override + @Deprecated public CompletionStage writeTransactionAsync( AsyncTransactionWork> work, TransactionConfig config) { return transactionAsync(AccessMode.WRITE, work, config); @@ -117,6 +121,7 @@ public CompletionStage executeWriteAsync( } @Override + @Deprecated public Bookmark lastBookmark() { return InternalBookmark.from(session.lastBookmarks()); } @@ -127,7 +132,9 @@ public Set lastBookmarks() { } private CompletionStage transactionAsync( - AccessMode mode, AsyncTransactionWork> work, TransactionConfig config) { + AccessMode mode, + @SuppressWarnings("deprecation") AsyncTransactionWork> work, + TransactionConfig config) { return session.retryLogic().retryAsync(() -> { CompletableFuture resultFuture = new CompletableFuture<>(); CompletionStage txFuture = session.beginTransactionAsync(mode, config); @@ -146,7 +153,9 @@ private CompletionStage transactionAsync( } private void executeWork( - CompletableFuture resultFuture, UnmanagedTransaction tx, AsyncTransactionWork> work) { + CompletableFuture resultFuture, + UnmanagedTransaction tx, + @SuppressWarnings("deprecation") AsyncTransactionWork> work) { CompletionStage workFuture = safeExecuteWork(tx, work); workFuture.whenComplete((result, completionError) -> { Throwable error = Futures.completionExceptionCause(completionError); @@ -159,7 +168,7 @@ private void executeWork( } private CompletionStage safeExecuteWork( - UnmanagedTransaction tx, AsyncTransactionWork> work) { + UnmanagedTransaction tx, @SuppressWarnings("deprecation") AsyncTransactionWork> work) { // given work might fail in both async and sync way // async failure will result in a failed future being returned // sync failure will result in an exception being thrown diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/LeakLoggingNetworkSession.java b/driver/src/main/java/org/neo4j/driver/internal/async/LeakLoggingNetworkSession.java index e73a96c862..c7a2fc2311 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/LeakLoggingNetworkSession.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/LeakLoggingNetworkSession.java @@ -53,6 +53,7 @@ public LeakLoggingNetworkSession( } @Override + @SuppressWarnings("deprecation") protected void finalize() throws Throwable { logLeakIfNeeded(); super.finalize(); diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/NetworkConnection.java b/driver/src/main/java/org/neo4j/driver/internal/async/NetworkConnection.java index 217906e8d8..272cf64525 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/NetworkConnection.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/NetworkConnection.java @@ -64,7 +64,7 @@ public class NetworkConnection implements Connection { private final AtomicReference status = new AtomicReference<>(Status.OPEN); private final MetricsListener metricsListener; - private final ListenerEvent inUseEvent; + private final ListenerEvent inUseEvent; private final Long connectionReadTimeout; private ChannelHandler connectionReadTimeoutHandler; diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/pool/ConnectionPoolImpl.java b/driver/src/main/java/org/neo4j/driver/internal/async/pool/ConnectionPoolImpl.java index a6eb929554..1a3c360feb 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/pool/ConnectionPoolImpl.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/pool/ConnectionPoolImpl.java @@ -121,7 +121,7 @@ public CompletionStage acquire(BoltServerAddress address) { assertNotClosed(); ExtendedChannelPool pool = getOrCreatePool(address); - ListenerEvent acquireEvent = metricsListener.createListenerEvent(); + ListenerEvent acquireEvent = metricsListener.createListenerEvent(); metricsListener.beforeAcquiringOrCreating(pool.id(), acquireEvent); CompletionStage channelFuture = pool.acquire(); diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelPool.java b/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelPool.java index 31bf01c427..2b0627171a 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelPool.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelPool.java @@ -74,7 +74,7 @@ public class NettyChannelPool implements ExtendedChannelPool { RELEASE_HEALTH_CHECK) { @Override protected ChannelFuture connectChannel(Bootstrap bootstrap) { - ListenerEvent creatingEvent = handler.channelCreating(id); + ListenerEvent creatingEvent = handler.channelCreating(id); ChannelFuture connectedChannelFuture = connector.connect(address, bootstrap); Channel channel = connectedChannelFuture.channel(); // This ensures that handler.channelCreated is called before SimpleChannelPool calls diff --git a/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelTracker.java b/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelTracker.java index 4876ce3d78..e61912aeba 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelTracker.java +++ b/driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelTracker.java @@ -108,7 +108,7 @@ public void channelCreated(Channel channel) { throw new IllegalStateException("Untraceable channel created."); } - public void channelCreated(Channel channel, ListenerEvent creatingEvent) { + public void channelCreated(Channel channel, ListenerEvent creatingEvent) { // when it is created, we count it as idle as it has not been acquired out of the pool doInWriteLock(() -> incrementIdle(channel)); @@ -119,8 +119,8 @@ public void channelCreated(Channel channel, ListenerEvent creatingEvent) { channel.id(), channel.localAddress(), channel.remoteAddress()); } - public ListenerEvent channelCreating(String poolId) { - ListenerEvent creatingEvent = metricsListener.createListenerEvent(); + public ListenerEvent channelCreating(String poolId) { + ListenerEvent creatingEvent = metricsListener.createListenerEvent(); metricsListener.beforeCreating(poolId, creatingEvent); return creatingEvent; } diff --git a/driver/src/main/java/org/neo4j/driver/internal/logging/NettyLogger.java b/driver/src/main/java/org/neo4j/driver/internal/logging/NettyLogger.java index 1f072cdc28..bb4210f395 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/logging/NettyLogger.java +++ b/driver/src/main/java/org/neo4j/driver/internal/logging/NettyLogger.java @@ -21,11 +21,15 @@ import static java.lang.String.format; import io.netty.util.internal.logging.AbstractInternalLogger; +import java.io.Serial; import java.util.regex.Pattern; import org.neo4j.driver.Logger; public class NettyLogger extends AbstractInternalLogger { - private Logger log; + @Serial + private static final long serialVersionUID = -1466889786216191159L; + + private final Logger log; private static final Pattern PLACE_HOLDER_PATTERN = Pattern.compile("\\{\\}"); public NettyLogger(String name, Logger log) { diff --git a/driver/src/main/java/org/neo4j/driver/internal/messaging/common/CommonValueUnpacker.java b/driver/src/main/java/org/neo4j/driver/internal/messaging/common/CommonValueUnpacker.java index b625d497c4..ce7066e9c0 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/messaging/common/CommonValueUnpacker.java +++ b/driver/src/main/java/org/neo4j/driver/internal/messaging/common/CommonValueUnpacker.java @@ -277,6 +277,7 @@ protected InternalNode unpackNode() throws IOException { return new InternalNode(urn, String.valueOf(urn), labels, props); } + @SuppressWarnings("deprecation") protected Value unpackPath() throws IOException { // List of unique nodes Node[] uniqNodes = new Node[(int) unpacker.unpackListHeader()]; diff --git a/driver/src/main/java/org/neo4j/driver/internal/messaging/v5/ValueUnpackerV5.java b/driver/src/main/java/org/neo4j/driver/internal/messaging/v5/ValueUnpackerV5.java index 2d920c8b5a..ea2bc9265d 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/messaging/v5/ValueUnpackerV5.java +++ b/driver/src/main/java/org/neo4j/driver/internal/messaging/v5/ValueUnpackerV5.java @@ -132,6 +132,7 @@ protected Value unpackPath() throws IOException { return new PathValue(new InternalPath(Arrays.asList(segments), Arrays.asList(nodes), Arrays.asList(rels))); } + @SuppressWarnings("deprecation") private void setStartAndEnd(InternalRelationship rel, InternalNode start, InternalNode end) { rel.setStartAndEnd(start.id(), start.elementId(), end.id(), end.elementId()); } diff --git a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxResult.java b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxResult.java index 8d99aa4007..e75b5dba19 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxResult.java +++ b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxResult.java @@ -35,6 +35,7 @@ import reactor.core.publisher.FluxSink; import reactor.core.publisher.Mono; +@Deprecated public class InternalRxResult implements RxResult { private Supplier> cursorFutureSupplier; private volatile CompletionStage cursorFuture; diff --git a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxSession.java b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxSession.java index 94e15feaa4..f6aa28938e 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxSession.java +++ b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxSession.java @@ -38,6 +38,7 @@ import org.neo4j.driver.reactive.RxTransactionWork; import org.reactivestreams.Publisher; +@Deprecated public class InternalRxSession extends AbstractReactiveSession implements RxSession { public InternalRxSession(NetworkSession session) { super(session); diff --git a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxTransaction.java b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxTransaction.java index 09b08afa12..e1eee6b45f 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxTransaction.java +++ b/driver/src/main/java/org/neo4j/driver/internal/reactive/InternalRxTransaction.java @@ -26,6 +26,7 @@ import org.neo4j.driver.reactive.RxResult; import org.neo4j.driver.reactive.RxTransaction; +@Deprecated public class InternalRxTransaction extends AbstractReactiveTransaction implements RxTransaction { public InternalRxTransaction(UnmanagedTransaction tx) { super(tx); diff --git a/driver/src/main/java/org/neo4j/driver/internal/summary/InternalPlan.java b/driver/src/main/java/org/neo4j/driver/internal/summary/InternalPlan.java index d494b67750..f92e679b0f 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/summary/InternalPlan.java +++ b/driver/src/main/java/org/neo4j/driver/internal/summary/InternalPlan.java @@ -80,7 +80,7 @@ public boolean equals(Object o) { return false; } - InternalPlan that = (InternalPlan) o; + InternalPlan that = (InternalPlan) o; return operatorType.equals(that.operatorType) && arguments.equals(that.arguments) diff --git a/driver/src/main/java/org/neo4j/driver/internal/svm/NettySubstitutions.java b/driver/src/main/java/org/neo4j/driver/internal/svm/NettySubstitutions.java index 8e4e535d32..5ad8a1e93e 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/svm/NettySubstitutions.java +++ b/driver/src/main/java/org/neo4j/driver/internal/svm/NettySubstitutions.java @@ -131,7 +131,7 @@ final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_Alp public SSLEngine wrapSslEngine( SSLEngine engine, ByteBufAllocator alloc, - JdkApplicationProtocolNegotiator applicationNegotiator, + @SuppressWarnings("deprecation") JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { return (SSLEngine) (Object) new Target_io_netty_handler_ssl_JdkAlpnSslEngine(engine, applicationNegotiator, isServer); @@ -146,7 +146,7 @@ final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_Alp public SSLEngine wrapSslEngine( SSLEngine engine, ByteBufAllocator alloc, - JdkApplicationProtocolNegotiator applicationNegotiator, + @SuppressWarnings("deprecation") JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { if (Target_io_netty_handler_ssl_JettyAlpnSslEngine.isAvailable()) { return isServer @@ -170,14 +170,14 @@ static boolean isAvailable() { @Substitute @SuppressWarnings("deprecation") static Target_io_netty_handler_ssl_JettyAlpnSslEngine newClientEngine( - SSLEngine engine, JdkApplicationProtocolNegotiator applicationNegotiator) { + SSLEngine engine, @SuppressWarnings("deprecation") JdkApplicationProtocolNegotiator applicationNegotiator) { return null; } @Substitute @SuppressWarnings("deprecation") static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine( - SSLEngine engine, JdkApplicationProtocolNegotiator applicationNegotiator) { + SSLEngine engine, @SuppressWarnings("deprecation") JdkApplicationProtocolNegotiator applicationNegotiator) { return null; } } @@ -189,7 +189,7 @@ final class Target_io_netty_handler_ssl_JdkAlpnSslEngine { @SuppressWarnings("deprecation") Target_io_netty_handler_ssl_JdkAlpnSslEngine( final SSLEngine engine, - final JdkApplicationProtocolNegotiator applicationNegotiator, + final @SuppressWarnings("deprecation") JdkApplicationProtocolNegotiator applicationNegotiator, final boolean isServer) {} } @@ -197,6 +197,7 @@ final class Target_io_netty_handler_ssl_JdkAlpnSslEngine { final class Target_io_netty_handler_ssl_SslContext { @Substitute + @SafeVarargs static SslContext newServerContextInternal( SslProvider provider, Provider sslContextProvider, @@ -242,6 +243,7 @@ static SslContext newServerContextInternal( } @Substitute + @SafeVarargs static SslContext newClientContextInternal( SslProvider provider, Provider sslContextProvider, @@ -293,6 +295,7 @@ final class Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator final class Target_io_netty_handler_ssl_JdkSslContext { @Substitute + @SuppressWarnings("deprecation") static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return (JdkApplicationProtocolNegotiator) @@ -360,13 +363,14 @@ else if (behavior == SelectorFailureBehavior.NO_ADVERTISE) final class Target_io_netty_bootstrap_AbstractBootstrap { @Alias - private ChannelFactory channelFactory; + @SuppressWarnings("deprecation") + private ChannelFactory channelFactory; @Alias void init(Channel channel) throws Exception {} @Alias - public AbstractBootstrapConfig config() { + public AbstractBootstrapConfig config() { return null; } diff --git a/driver/src/main/java/org/neo4j/driver/internal/util/ErrorUtil.java b/driver/src/main/java/org/neo4j/driver/internal/util/ErrorUtil.java index e16570e332..4a2f2a18f5 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/util/ErrorUtil.java +++ b/driver/src/main/java/org/neo4j/driver/internal/util/ErrorUtil.java @@ -18,6 +18,7 @@ */ package org.neo4j.driver.internal.util; +import java.io.Serial; import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.stream.Stream; @@ -173,6 +174,9 @@ public static Throwable getRootCause(Throwable error) { * Used for blocking API calls that block on async API calls. */ private static class InternalExceptionCause extends RuntimeException { + @Serial + private static final long serialVersionUID = -1988733529334222027L; + InternalExceptionCause(StackTraceElement[] stackTrace) { setStackTrace(stackTrace); } diff --git a/driver/src/main/java/org/neo4j/driver/util/Resource.java b/driver/src/main/java/org/neo4j/driver/util/Resource.java index 8815a7cbe8..8aa1fecd41 100644 --- a/driver/src/main/java/org/neo4j/driver/util/Resource.java +++ b/driver/src/main/java/org/neo4j/driver/util/Resource.java @@ -31,4 +31,7 @@ public interface Resource extends AutoCloseable { * @return true if the resource is open */ boolean isOpen(); + + @Override + void close() throws RuntimeException; } diff --git a/examples/pom.xml b/examples/pom.xml index eddc9f5683..2902db145d 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -82,6 +82,13 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins maven-javadoc-plugin diff --git a/pom.xml b/pom.xml index 34a8ed5655..ceb78dae62 100644 --- a/pom.xml +++ b/pom.xml @@ -501,7 +501,19 @@ true true + + -Xlint:all + -Werror + + + + default-testCompile + + + + + org.apache.maven.plugins diff --git a/testkit-backend/pom.xml b/testkit-backend/pom.xml index 3f00291b8b..20d42658ed 100644 --- a/testkit-backend/pom.xml +++ b/testkit-backend/pom.xml @@ -57,6 +57,13 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins maven-shade-plugin