Skip to content

Migrate to 2023.2.3 inspection engine #1494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion driver/src/main/java/org/neo4j/driver/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* Results are valid until the next query is run or until the end of the current transaction,
* whichever comes first. To keep a result around while further queries are run, or to use a result outside the scope
* of the current transaction, see {@link #list()}.
*
* <h2>Important note on semantics</h2>
*
* In order to handle very large results, and to minimize memory overhead and maximize
Expand Down
1 change: 0 additions & 1 deletion driver/src/main/java/org/neo4j/driver/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ default void executeWriteWithoutResult(Consumer<TransactionContext> contextConsu
* This version of run takes a {@link Map} of parameters. The values in the map
* must be values that can be converted to Neo4j types. See {@link Values#parameters(Object...)} for
* a list of allowed types.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down
3 changes: 0 additions & 3 deletions driver/src/main/java/org/neo4j/driver/SimpleQueryRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

/**
* Common interface for components that can execute Neo4j queries.
*
* <h2>Important notes on semantics</h2>
* <p>
* queries run in the same {@link QueryRunner} are guaranteed to execute in order, meaning changes made by one query will be seen by all subsequent queries in
Expand Down Expand Up @@ -64,7 +63,6 @@ public interface SimpleQueryRunner {
* send it back as parameters.
* <p>
* If you are creating parameters programmatically, {@link #run(String, Map)} might be more helpful, it converts your map to a {@link Value} for you.
*
* <h4>Example</h4>
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
* {@code
Expand All @@ -88,7 +86,6 @@ public interface SimpleQueryRunner {
* <p>
* This version of run takes a {@link Map} of parameters. The values in the map must be values that can be converted to Neo4j types. See {@link
* Values#parameters(Object...)} for a list of allowed types.
*
* <h4>Example</h4>
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
* {@code
Expand Down
1 change: 0 additions & 1 deletion driver/src/main/java/org/neo4j/driver/Value.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
* The second set of methods perform coercions to Java types (wherever possible).
* For example, a common String value should be tested for using <code>isString</code>
* and extracted using <code>stringValue</code>.
*
* <h2>Navigating a tree structure</h2>
*
* Because Neo4j often handles dynamic structures, this interface is designed to help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

/**
* Asynchronous interface for components that can execute Neo4j queries.
*
* <h2>Important notes on semantics</h2>
* <p>
* Queries run in the same {@link AsyncQueryRunner} are guaranteed
Expand Down Expand Up @@ -62,7 +61,6 @@
* While these semantics introduce some complexity, it gives the driver the ability
* to handle infinite result streams (like subscribing to events), significantly lowers
* the memory overhead for your application and improves performance.
*
* <h2>Asynchronous API</h2>
* <p>
* All overloads of {@link #runAsync(Query)} execute queries in async fashion and return {@link CompletionStage} of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ private static class DriverThreadFactory extends DefaultThreadFactory {
super(THREAD_NAME_PREFIX, THREAD_IS_DAEMON, THREAD_PRIORITY);
}

@SuppressWarnings("InstantiatingAThreadWithDefaultRunMethod")
@Override
protected Thread newThread(Runnable r, String name) {
return new DriverThread(threadGroup, r, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
import org.neo4j.driver.internal.DatabaseName;

public class ClusterRoutingTable implements RoutingTable {
private static final int MIN_ROUTERS = 1;

private final ReadWriteLock tableLock = new ReentrantReadWriteLock();
private final DatabaseName databaseName;
private final Clock clock;
Expand Down Expand Up @@ -66,9 +64,9 @@ public boolean isStaleFor(AccessMode mode) {
return executeWithLock(
tableLock.readLock(),
() -> expirationTimestamp < clock.millis()
|| routers.size() < MIN_ROUTERS
|| mode == AccessMode.READ && readers.size() == 0
|| mode == AccessMode.WRITE && writers.size() == 0);
|| routers.isEmpty()
|| mode == AccessMode.READ && readers.isEmpty()
|| mode == AccessMode.WRITE && writers.isEmpty());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ protected void state(State state) {
this.state = state;
}

enum State {
protected enum State {
READY_STATE {
@Override
void onSuccess(BasicPullResponseHandler context, Map<String, Value> metadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public final void pack(Value value) throws IOException {

@Override
public final void pack(Map<String, Value> map) throws IOException {
if (map == null || map.size() == 0) {
if (map == null || map.isEmpty()) {
packer.packMapHeader(0);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,7 @@ private static Map<String, Value> buildMetadata(
result.put(USER_AGENT_METADATA_KEY, value(userAgent));
}
if (boltAgent != null) {
var boltAgentMap = new HashMap<String, String>();
boltAgentMap.put(BOLT_AGENT_PRODUCT_KEY, boltAgent.product());
if (boltAgent.platform() != null) {
boltAgentMap.put(BOLT_AGENT_PLATFORM_KEY, boltAgent.platform());
}
if (boltAgent.language() != null) {
boltAgentMap.put(BOLT_AGENT_LANGUAGE_KEY, boltAgent.language());
}
if (boltAgent.languageDetails() != null) {
boltAgentMap.put(BOLT_AGENT_LANGUAGE_DETAIL_KEY, boltAgent.languageDetails());
}
var boltAgentMap = toMap(boltAgent);
result.put(BOLT_AGENT_METADATA_KEY, value(boltAgentMap));
}
if (routingContext != null) {
Expand All @@ -116,4 +106,19 @@ private static Map<String, Value> buildMetadata(
MessageWithMetadata.appendNotificationConfig(result, notificationConfig);
return result;
}

private static HashMap<String, String> toMap(BoltAgent boltAgent) {
var boltAgentMap = new HashMap<String, String>();
boltAgentMap.put(BOLT_AGENT_PRODUCT_KEY, boltAgent.product());
if (boltAgent.platform() != null) {
boltAgentMap.put(BOLT_AGENT_PLATFORM_KEY, boltAgent.platform());
}
if (boltAgent.language() != null) {
boltAgentMap.put(BOLT_AGENT_LANGUAGE_KEY, boltAgent.language());
}
if (boltAgent.languageDetails() != null) {
boltAgentMap.put(BOLT_AGENT_LANGUAGE_DETAIL_KEY, boltAgent.languageDetails());
}
return boltAgentMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public int hashCode() {
return result;
}

public static final PlanCreator<Plan> EXPLAIN_PLAN =
private static final PlanCreator<Plan> EXPLAIN_PLAN =
(operatorType, arguments, identifiers, children, originalPlanValue) ->
new InternalPlan<>(operatorType, arguments, identifiers, children);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public long time() {
return time;
}

public static final PlanCreator<ProfiledPlan> PROFILED_PLAN =
private static final PlanCreator<ProfiledPlan> PROFILED_PLAN =
(operatorType, arguments, identifiers, children, originalPlanValue) -> new InternalProfiledPlan(
operatorType,
arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ default Publisher<ReactiveResult> run(String query, TransactionConfig config) {
* <p>
* This version of run takes a {@link Map} of parameters. The values in the map must be values that can be converted to Neo4j types. See {@link
* Values#parameters(Object...)} for a list of allowed types.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down Expand Up @@ -232,7 +231,6 @@ default Publisher<ReactiveResult> run(String query, Map<String, Object> paramete
* <p>
* Invoking this method will result in a Bolt RUN message exchange with server and the returned publisher will either emit an instance of {@link
* ReactiveResult} on success or an error otherwise.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ default Publisher<RxTransaction> beginTransaction() {
* This version of run takes a {@link Map} of parameters.
* The values in the map must be values that can be converted to Neo4j types.
* See {@link Values#parameters(Object...)} for a list of allowed types.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ default Publisher<ReactiveResult> run(String query, TransactionConfig config) {
* <p>
* This version of run takes a {@link Map} of parameters. The values in the map must be values that can be converted to Neo4j types. See {@link
* Values#parameters(Object...)} for a list of allowed types.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down Expand Up @@ -232,7 +231,6 @@ default Publisher<ReactiveResult> run(String query, Map<String, Object> paramete
* <p>
* Invoking this method will result in a Bolt RUN message exchange with server and the returned publisher will either emit an instance of {@link
* ReactiveResult} on success or an error otherwise.
*
* <h4>Example</h4>
* <pre>
* {@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void run() {
}
}

@SuppressWarnings("BusyWait")
@SuppressWarnings({"BusyWait", "CallToPrintStackTrace"})
void assertSessionsAvailableWithin() throws InterruptedException {
var deadline = System.currentTimeMillis() + 1000 * 120;
while (System.currentTimeMillis() < deadline) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void shouldRunWithParameters() {
// Then nothing should've failed
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldRunWithNullValuesAsParameters() {
// Given
Expand All @@ -83,7 +83,7 @@ void shouldRunWithNullValuesAsParameters() {
// Then nothing should've failed
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldRunWithNullRecordAsParameters() {
// Given
Expand All @@ -95,7 +95,7 @@ void shouldRunWithNullRecordAsParameters() {
// Then nothing should've failed
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldRunWithNullMapAsParameters() {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void shouldHandleFailureAfterClosingTransaction() {
ClientException.class, () -> session.run("CREAT (n) RETURN n").consume());
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldHandleNullRecordParameters() {
// When
Expand All @@ -226,7 +226,7 @@ void shouldHandleNullRecordParameters() {
// Then it wasn't the end of the world as we know it
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldHandleNullValueParameters() {
// When
Expand All @@ -239,7 +239,7 @@ void shouldHandleNullValueParameters() {
// Then it wasn't the end of the world as we know it
}

@SuppressWarnings("ConstantConditions")
@SuppressWarnings("ConstantValue")
@Test
void shouldHandleNullMapParameters() {
// When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static List<RoutingControl> routingControls() {

@ParameterizedTest
@MethodSource("routingControls")
@SuppressWarnings({"unchecked", "resource", "ResultOfMethodCallIgnored"})
@SuppressWarnings({"unchecked", "resource"})
void shouldExecuteAndReturnResult(RoutingControl routingControl) {
// GIVEN
var driver = mock(Driver.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public CompletionStage<ClusterCompositionLookupResult> lookupClusterComposition(
.mapToObj(SERVERS::get)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (servers.size() == 0) {
if (servers.isEmpty()) {
var address = SERVERS.stream()
.filter(Objects::nonNull)
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ private static List<Long> delaysWithoutJitter(long initialDelay, double multipli
var delay = initialDelay;
do {
values.add(delay);
delay *= multiplier;
delay *= (long) multiplier;
} while (--count > 0);
return values;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void assertBookmarkContainsSingleValue(Bookmark bookmark, Matcher<
assertNotNull(bookmark);
assertThat(bookmark, instanceOf(InternalBookmark.class));

var values = asList(((InternalBookmark) bookmark).values());
var values = asList((bookmark).values());
assertThat(values.size(), equalTo(1));
assertThat(values.get(0), matcher);
}
Expand All @@ -84,7 +84,7 @@ public static void assertBookmarksContainsSingleUniqueValues(Bookmark... bookmar

for (var bookmark : bookmarks) {
assertBookmarkContainsSingleValue(bookmark);
var values = asList(((InternalBookmark) bookmark).values());
var values = asList((bookmark).values());
bookmarkStrings.addAll(values);
}
assertEquals(count, bookmarkStrings.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class AsyncWriteQuery<C extends AbstractContext> extends AbstractAsyncQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public AsyncWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
AsyncWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class AsyncWriteQueryInTx<C extends AbstractContext> extends AbstractAsyncQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public AsyncWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
AsyncWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class AsyncWriteQueryWithRetries<C extends AbstractContext> extends AbstractAsyncQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public AsyncWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
AsyncWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class BlockingWriteQuery<C extends AbstractContext> extends AbstractBlockingQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public BlockingWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
BlockingWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class BlockingWriteQueryInTx<C extends AbstractContext> extends AbstractBlockingQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public BlockingWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
BlockingWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class BlockingWriteQueryWithRetries<C extends AbstractContext> extends AbstractBlockingQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public BlockingWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
BlockingWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class RxWriteQuery<C extends AbstractContext> extends AbstractRxQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public RxWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
RxWriteQuery(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class RxWriteQueryInTx<C extends AbstractContext> extends AbstractRxQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public RxWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
RxWriteQueryInTx(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class RxWriteQueryWithRetries<C extends AbstractContext> extends AbstractRxQuery<C> {
private final AbstractStressTestBase<C> stressTest;

public RxWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
RxWriteQueryWithRetries(AbstractStressTestBase<C> stressTest, Driver driver, boolean useBookmark) {
super(driver, useBookmark);
this.stressTest = stressTest;
}
Expand Down
Loading