Skip to content

Commit 51ec3f3

Browse files
authored
Add Java module declaration for neo4j-java-driver (#1274)
This update introduces an explicit `org.neo4j.driver` Java module declaration for `neo4j-java-driver` artifact. The introduced module name matches the previously used `Automatic-Module-Name` value. `org.neo4j.driver.internal.RevocationStrategy` has been moved to `org.neo4j.driver.RevocationStrategy`.
1 parent 8a17984 commit 51ec3f3

File tree

133 files changed

+586
-418
lines changed

Some content is hidden

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

133 files changed

+586
-418
lines changed

bundle/pom.xml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,29 @@
5555
</dependencies>
5656

5757
<build>
58+
<pluginManagement>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-javadoc-plugin</artifactId>
63+
<executions>
64+
<execution>
65+
<id>attach-javadocs</id>
66+
<goals>
67+
<goal>jar</goal>
68+
</goals>
69+
<configuration>
70+
<additionalOptions combine.children="append">
71+
<option>--add-exports jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</option>
72+
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</option>
73+
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</option>
74+
</additionalOptions>
75+
</configuration>
76+
</execution>
77+
</executions>
78+
</plugin>
79+
</plugins>
80+
</pluginManagement>
5881
<plugins>
5982
<!-- Extract the original sources again -->
6083
<plugin>
@@ -74,7 +97,12 @@
7497
<resources>
7598
<resource>
7699
<directory>${rootDir}/driver/src/main/java</directory>
77-
<includes>**\/*.java</includes>
100+
<includes>
101+
<include>**\/*.java</include>
102+
</includes>
103+
<excludes>
104+
<exclude>module-info.java</exclude>
105+
</excludes>
78106
</resource>
79107
</resources>
80108
</configuration>

driver/clirr-ignored-differences.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,29 @@
340340
<method>void close()</method>
341341
</difference>
342342

343+
<difference>
344+
<className>org/neo4j/driver/AuthTokens</className>
345+
<differenceType>7009</differenceType>
346+
<method>AuthTokens()</method>
347+
</difference>
348+
349+
<difference>
350+
<className>org/neo4j/driver/GraphDatabase</className>
351+
<differenceType>7009</differenceType>
352+
<method>GraphDatabase()</method>
353+
</difference>
354+
355+
<difference>
356+
<className>org/neo4j/driver/Records</className>
357+
<differenceType>7009</differenceType>
358+
<method>Records()</method>
359+
</difference>
360+
361+
<difference>
362+
<className>org/neo4j/driver/Values</className>
363+
<differenceType>7006</differenceType>
364+
<method>org.neo4j.driver.internal.value.BytesValue value(byte[])</method>
365+
<to>org.neo4j.driver.Value</to>
366+
</difference>
367+
343368
</differences>

driver/pom.xml

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
<description>Access to the Neo4j graph database through Java</description>
1717

1818
<properties>
19-
<moduleName>org.neo4j.driver</moduleName>
2019
<rootDir>${project.basedir}/..</rootDir>
20+
<api.classes.directory>${basedir}/target/classes-without-jpms</api.classes.directory>
21+
<surefire.jpms.args>--add-opens org.neo4j.driver/org.neo4j.driver.internal.util.messaging=ALL-UNNAMED</surefire.jpms.args>
22+
<failsafe.parallelizable.jpms.args>--add-opens org.neo4j.driver/org.neo4j.driver.internal.util=ALL-UNNAMED --add-opens org.neo4j.driver/org.neo4j.driver.internal.async=ALL-UNNAMED</failsafe.parallelizable.jpms.args>
2123
<maven.deploy.skip>false</maven.deploy.skip>
2224
</properties>
2325

@@ -111,21 +113,80 @@
111113
</dependencies>
112114

113115
<build>
116+
<pluginManagement>
117+
<plugins>
118+
<plugin>
119+
<groupId>org.apache.maven.plugins</groupId>
120+
<artifactId>maven-compiler-plugin</artifactId>
121+
<configuration>
122+
<compilerArgs combine.children="append">
123+
<arg>--add-exports</arg>
124+
<arg>jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</arg>
125+
<arg>--add-exports</arg>
126+
<arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</arg>
127+
<arg>--add-exports</arg>
128+
<arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</arg>
129+
</compilerArgs>
130+
</configuration>
131+
</plugin>
132+
<plugin>
133+
<groupId>org.apache.maven.plugins</groupId>
134+
<artifactId>maven-javadoc-plugin</artifactId>
135+
<configuration>
136+
<additionalOptions combine.children="append">
137+
<option>--add-exports jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</option>
138+
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</option>
139+
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</option>
140+
</additionalOptions>
141+
</configuration>
142+
</plugin>
143+
<plugin>
144+
<groupId>org.apache.maven.plugins</groupId>
145+
<artifactId>maven-resources-plugin</artifactId>
146+
<version>3.3.0</version>
147+
<executions>
148+
<execution>
149+
<id>copy-classes-excluding-jpms</id>
150+
<phase>compile</phase>
151+
<goals>
152+
<goal>copy-resources</goal>
153+
</goals>
154+
<configuration>
155+
<outputDirectory>${api.classes.directory}</outputDirectory>
156+
<resources>
157+
<resource>
158+
<directory>${project.build.outputDirectory}</directory>
159+
<excludes>
160+
<exclude>module-info.class</exclude>
161+
</excludes>
162+
</resource>
163+
</resources>
164+
</configuration>
165+
</execution>
166+
</executions>
167+
</plugin>
168+
<plugin>
169+
<groupId>org.codehaus.mojo</groupId>
170+
<artifactId>clirr-maven-plugin</artifactId>
171+
<configuration>
172+
<comparisonArtifacts>
173+
<comparisonArtifact>
174+
<groupId>org.neo4j.driver</groupId>
175+
<artifactId>neo4j-java-driver</artifactId>
176+
<version>4.0.0</version>
177+
</comparisonArtifact>
178+
</comparisonArtifacts>
179+
<classesDirectory>${api.classes.directory}</classesDirectory>
180+
<excludes>org/neo4j/driver/internal/**</excludes>
181+
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
182+
</configuration>
183+
</plugin>
184+
</plugins>
185+
</pluginManagement>
114186
<plugins>
115187
<plugin>
116188
<groupId>org.codehaus.mojo</groupId>
117189
<artifactId>clirr-maven-plugin</artifactId>
118-
<configuration>
119-
<comparisonArtifacts>
120-
<comparisonArtifact>
121-
<groupId>org.neo4j.driver</groupId>
122-
<artifactId>neo4j-java-driver</artifactId>
123-
<version>4.0.0</version>
124-
</comparisonArtifact>
125-
</comparisonArtifacts>
126-
<excludes>org/neo4j/driver/internal/**</excludes>
127-
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
128-
</configuration>
129190
</plugin>
130191
<plugin>
131192
<groupId>org.apache.maven.plugins</groupId>
@@ -155,8 +216,6 @@
155216
<manifestEntries>
156217
<!-- This is used to programmatically determine the driver version -->
157218
<Implementation-Version>${project.version}-${build.revision}</Implementation-Version>
158-
<!-- Stable module name for JDK9 automatic modules -->
159-
<Automatic-Module-Name>${moduleName}</Automatic-Module-Name>
160219
</manifestEntries>
161220
</archive>
162221
</configuration>

driver/src/main/java/module-info.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
@SuppressWarnings({"requires-automatic", "requires-transitive-automatic"})
20+
module org.neo4j.driver {
21+
exports org.neo4j.driver;
22+
exports org.neo4j.driver.async;
23+
exports org.neo4j.driver.reactive;
24+
exports org.neo4j.driver.types;
25+
exports org.neo4j.driver.summary;
26+
exports org.neo4j.driver.net;
27+
exports org.neo4j.driver.util;
28+
exports org.neo4j.driver.exceptions;
29+
30+
requires reactor.core;
31+
requires io.netty.common;
32+
requires io.netty.handler;
33+
requires io.netty.transport;
34+
requires io.netty.buffer;
35+
requires io.netty.codec;
36+
requires io.netty.resolver;
37+
requires transitive java.logging;
38+
requires transitive org.reactivestreams;
39+
requires static micrometer.core;
40+
requires static org.graalvm.nativeimage.builder;
41+
requires static org.slf4j;
42+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
* @since 1.0
4040
*/
4141
public class AuthTokens {
42+
private AuthTokens() {}
43+
4244
/**
4345
* The basic authentication scheme, using a username and a password.
4446
* @param username this is the "principal", identifying who this token represents

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Objects;
3333
import java.util.concurrent.TimeUnit;
3434
import java.util.logging.Level;
35-
import org.neo4j.driver.internal.RevocationStrategy;
3635
import org.neo4j.driver.internal.SecuritySettings;
3736
import org.neo4j.driver.internal.async.pool.PoolSettings;
3837
import org.neo4j.driver.internal.cluster.RoutingSettings;
@@ -677,6 +676,7 @@ public Config build() {
677676
* Control how the driver determines if it can trust the encryption certificates provided by the Neo4j instance it is connected to.
678677
*/
679678
public static class TrustStrategy implements Serializable {
679+
@Serial
680680
private static final long serialVersionUID = -1631888096243987740L;
681681

682682
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* @since 1.0
3535
*/
3636
public class GraphDatabase {
37+
private GraphDatabase() {}
38+
3739
/**
3840
* Return a driver for a Neo4j instance with the default configuration settings
3941
*

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* @since 1.0
2828
*/
2929
public abstract class Records {
30+
private Records() {}
31+
3032
public static Function<Record, Value> column(int index) {
3133
return column(index, Values.ofValue());
3234
}

driver/src/main/java/org/neo4j/driver/internal/RevocationStrategy.java renamed to driver/src/main/java/org/neo4j/driver/RevocationStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
package org.neo4j.driver.internal;
19+
package org.neo4j.driver;
2020

2121
public enum RevocationStrategy {
2222
/** Don't do any OCSP revocation checks, regardless whether there are stapled revocation statuses or not. */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public static Value value(Value... input) {
221221
return new ListValue(values);
222222
}
223223

224-
public static BytesValue value(byte... input) {
224+
public static Value value(byte... input) {
225225
return new BytesValue(input);
226226
}
227227

driver/src/main/java/org/neo4j/driver/internal/SecuritySettings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.Serializable;
2727
import java.security.GeneralSecurityException;
2828
import org.neo4j.driver.Config;
29+
import org.neo4j.driver.RevocationStrategy;
2930
import org.neo4j.driver.exceptions.ClientException;
3031
import org.neo4j.driver.internal.security.SecurityPlan;
3132
import org.neo4j.driver.internal.security.SecurityPlanImpl;

driver/src/main/java/org/neo4j/driver/internal/packstream/PackStream.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
* Extra markers should <em>not</em> be added casually and such additions must be follow a strict process involving both client and server software.
3737
*
3838
* The table below shows all allocated marker byte values.
39-
*
39+
* <p>
4040
* <table>
41+
* <caption>Allocated marker byte values.</caption>
4142
* <tr><th>Marker</th><th>Binary</th><th>Type</th><th>Description</th></tr>
4243
* <tr><td><code>00..7F</code></td><td><code>0xxxxxxx</code></td><td>+TINY_INT</td><td>Integer 0 to 127</td></tr>
4344
* <tr><td><code>80..8F</code></td><td><code>1000xxxx</code></td><td>TINY_STRING</td><td></td></tr>

driver/src/main/java/org/neo4j/driver/internal/security/SecurityPlan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
package org.neo4j.driver.internal.security;
2020

2121
import javax.net.ssl.SSLContext;
22-
import org.neo4j.driver.internal.RevocationStrategy;
22+
import org.neo4j.driver.RevocationStrategy;
2323

2424
/**
2525
* A SecurityPlan consists of encryption and trust details.

driver/src/main/java/org/neo4j/driver/internal/security/SecurityPlanImpl.java

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

21-
import static org.neo4j.driver.internal.RevocationStrategy.VERIFY_IF_PRESENT;
22-
import static org.neo4j.driver.internal.RevocationStrategy.requiresRevocationChecking;
21+
import static org.neo4j.driver.RevocationStrategy.VERIFY_IF_PRESENT;
22+
import static org.neo4j.driver.RevocationStrategy.requiresRevocationChecking;
2323
import static org.neo4j.driver.internal.util.CertificateTool.loadX509Cert;
2424

2525
import java.io.File;
@@ -41,7 +41,7 @@
4141
import javax.net.ssl.TrustManager;
4242
import javax.net.ssl.TrustManagerFactory;
4343
import javax.net.ssl.X509TrustManager;
44-
import org.neo4j.driver.internal.RevocationStrategy;
44+
import org.neo4j.driver.RevocationStrategy;
4545

4646
/**
4747
* A SecurityPlan consists of encryption and trust details.

driver/src/main/java/org/neo4j/driver/internal/svm/MicrometerSubstitutions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
final class Target_org_neo4j_driver_internal_DriverFactory {
3434

3535
/**
36-
* Substitutes metrics adatper in such a way that it falls back to off when Micrometer is not available.
36+
* Substitutes metrics adapter in such a way that it falls back to off when Micrometer is not available.
3737
*
3838
* @param config Drivers config
3939
* @param clock Clock to use

driver/src/main/java/org/neo4j/driver/internal/svm/NettySubstitutions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ final class Target_io_netty_handler_ssl_SslHandler$SslEngineType {
123123
}
124124
}
125125

126+
@SuppressWarnings("removal")
126127
@TargetClass(
127128
className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper",
128129
onlyWith = JDK11OrLater.class)
@@ -138,6 +139,7 @@ public SSLEngine wrapSslEngine(
138139
}
139140
}
140141

142+
@SuppressWarnings("removal")
141143
@TargetClass(
142144
className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper",
143145
onlyWith = JDK8OrEarlier.class)
@@ -160,6 +162,7 @@ public SSLEngine wrapSslEngine(
160162
}
161163
}
162164

165+
@SuppressWarnings("removal")
163166
@TargetClass(className = "io.netty.handler.ssl.JettyAlpnSslEngine", onlyWith = JDK8OrEarlier.class)
164167
final class Target_io_netty_handler_ssl_JettyAlpnSslEngine {
165168
@Substitute
@@ -182,6 +185,7 @@ static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine(
182185
}
183186
}
184187

188+
@SuppressWarnings("removal")
185189
@TargetClass(className = "io.netty.handler.ssl.JdkAlpnSslEngine", onlyWith = JDK11OrLater.class)
186190
final class Target_io_netty_handler_ssl_JdkAlpnSslEngine {
187191

0 commit comments

Comments
 (0)