Skip to content

Commit 52ec6ea

Browse files
authored
Enable compilation failures on warnings for driver module main sources (#1275)
This is primarily an extra protection from unintended warnings.
1 parent d2178ab commit 52ec6ea

Some content is hidden

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

58 files changed

+223
-24
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/Config.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.neo4j.driver.internal.logging.DevNullLogging.DEV_NULL_LOGGING;
2323

2424
import java.io.File;
25+
import java.io.Serial;
2526
import java.io.Serializable;
2627
import java.net.InetAddress;
2728
import java.util.ArrayList;
@@ -70,6 +71,7 @@
7071
*/
7172
@Immutable
7273
public class Config implements Serializable {
74+
@Serial
7375
private static final long serialVersionUID = -4496545746399601108L;
7476

7577
private static final Config EMPTY = builder().build();

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/SessionConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static java.util.Objects.requireNonNull;
2222
import static org.neo4j.driver.internal.handlers.pulln.FetchSizeUtil.assertValidFetchSize;
2323

24+
import java.io.Serial;
2425
import java.io.Serializable;
2526
import java.util.Arrays;
2627
import java.util.Objects;
@@ -34,6 +35,7 @@
3435
* The session configurations used to configure a session.
3536
*/
3637
public class SessionConfig implements Serializable {
38+
@Serial
3739
private static final long serialVersionUID = 5773462156979050657L;
3840

3941
private static final SessionConfig EMPTY = builder().build();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static java.util.Objects.requireNonNull;
2424
import static org.neo4j.driver.internal.util.Preconditions.checkArgument;
2525

26+
import java.io.Serial;
2627
import java.io.Serializable;
2728
import java.time.Duration;
2829
import java.util.HashMap;
@@ -63,6 +64,7 @@
6364
* @see Session
6465
*/
6566
public class TransactionConfig implements Serializable {
67+
@Serial
6668
private static final long serialVersionUID = -7954949878657177280L;
6769

6870
private static final TransactionConfig EMPTY = builder().build();

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

0 commit comments

Comments
 (0)