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>
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

0 commit comments

Comments
 (0)