Skip to content

Commit 3f99a20

Browse files
committed
Enable compilation failures on warnings for driver module main sources
This is primarily an extra protection from unintended warnings.
1 parent d2178ab commit 3f99a20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+215
-23
lines changed

driver/clirr-ignored-differences.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,10 @@
334334
<method>java.lang.String neo4jErrorCode()</method>
335335
</difference>
336336

337+
<difference>
338+
<className>org/neo4j/driver/QueryRunner</className>
339+
<differenceType>7012</differenceType>
340+
<method>void close()</method>
341+
</difference>
342+
337343
</differences>

driver/src/main/java/org/neo4j/driver/QueryRunner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@
2323
*
2424
* @since 1.0
2525
*/
26-
public interface QueryRunner extends SimpleQueryRunner, AutoCloseable {}
26+
public interface QueryRunner extends SimpleQueryRunner, AutoCloseable {
27+
@Override
28+
void close() throws RuntimeException;
29+
}

driver/src/main/java/org/neo4j/driver/Values.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,23 @@ public static Function<Value, Entity> ofEntity() {
570570
/**
571571
* Converts values to {@link Long entity id}.
572572
*
573+
* @deprecated superseded by {@link #ofEntityElementId()}.
573574
* @return a function that returns the id an entity {@link Value}
574575
*/
576+
@Deprecated
575577
public static Function<Value, Long> ofEntityId() {
576578
return val -> val.asEntity().id();
577579
}
578580

581+
/**
582+
* Converts values to {@link String element id}.
583+
*
584+
* @return a function that returns the element id of an entity {@link Value}
585+
*/
586+
public static Function<Value, String> ofEntityElementId() {
587+
return val -> val.asEntity().elementId();
588+
}
589+
579590
/**
580591
* Converts values to {@link Node}.
581592
*

driver/src/main/java/org/neo4j/driver/exceptions/AuthenticationException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* Failed to authenticate the driver to the server due to bad credentials provided.
2325
* When this error happens, the error could be recovered by closing the current driver and restart a new driver with
@@ -26,6 +28,9 @@
2628
* @since 1.1
2729
*/
2830
public class AuthenticationException extends SecurityException {
31+
@Serial
32+
private static final long serialVersionUID = 1324352999966240271L;
33+
2934
public AuthenticationException(String code, String message) {
3035
super(code, message);
3136
}

driver/src/main/java/org/neo4j/driver/exceptions/AuthorizationExpiredException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* The authorization info maintained on the server has expired. The client should reconnect.
2325
* <p>
2426
* Error code: Neo.ClientError.Security.AuthorizationExpired
2527
*/
2628
public class AuthorizationExpiredException extends SecurityException implements RetryableException {
29+
@Serial
30+
private static final long serialVersionUID = 5688002170978405558L;
31+
2732
public static final String DESCRIPTION =
2833
"Authorization information kept on the server has expired, this connection is no longer valid.";
2934

driver/src/main/java/org/neo4j/driver/exceptions/ClientException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* A <em>ClientException</em> indicates that the client has carried out an operation incorrectly.
2325
* The error code provided can be used to determine further detail for the problem.
2426
* @since 1.0
2527
*/
2628
public class ClientException extends Neo4jException {
29+
@Serial
30+
private static final long serialVersionUID = -6732913155228185887L;
31+
2732
public ClientException(String message) {
2833
super(message);
2934
}

driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* Indicates that read timed out due to it taking longer than the server-supplied timeout value via the {@code connection.recv_timeout_seconds} configuration
2325
* 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
2426
* communication from the server within the specified timeout period. This results in the server being removed from the routing table.
2527
*/
2628
public class ConnectionReadTimeoutException extends ServiceUnavailableException {
29+
@Serial
30+
private static final long serialVersionUID = -9222586212813330140L;
31+
2732
public static final ConnectionReadTimeoutException INSTANCE = new ConnectionReadTimeoutException(
2833
"Connection read timed out due to it taking longer than the server-supplied timeout value via configuration hint.");
2934

driver/src/main/java/org/neo4j/driver/exceptions/DatabaseException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* A <em>DatabaseException</em> indicates that there is a problem within the underlying database.
2325
* The error code provided can be used to determine further detail for the problem.
2426
* @since 1.0
2527
*/
2628
public class DatabaseException extends Neo4jException {
29+
@Serial
30+
private static final long serialVersionUID = 4591061578560201032L;
31+
2732
public DatabaseException(String code, String message) {
2833
super(code, message);
2934
}

driver/src/main/java/org/neo4j/driver/exceptions/DiscoveryException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* An error has happened while getting routing table with a remote server.
2325
* While this error is not fatal and we might be able to recover if we continue trying on another server.
@@ -27,6 +29,9 @@
2729
* If you see this error in your logs, it is safe to ignore if your cluster is temporarily changing structure during that time.
2830
*/
2931
public class DiscoveryException extends Neo4jException {
32+
@Serial
33+
private static final long serialVersionUID = 6711564351333659090L;
34+
3035
public DiscoveryException(String message, Throwable cause) {
3136
super(message, cause);
3237
}

driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
*/
1919
package org.neo4j.driver.exceptions;
2020

21+
import java.io.Serial;
22+
2123
/**
2224
* This error indicate a fatal problem to obtain routing tables such as the routing table for a specified database does not exist.
2325
* This exception should not be retried.
2426
* @since 4.0
2527
*/
2628
public class FatalDiscoveryException extends ClientException {
29+
@Serial
30+
private static final long serialVersionUID = -2831830142554054420L;
31+
2732
public FatalDiscoveryException(String message) {
2833
super(message);
2934
}

0 commit comments

Comments
 (0)