Skip to content

Commit

Permalink
Add Java module declaration for neo4j-java-driver (#1274)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
injectives authored Aug 3, 2022
1 parent 8a17984 commit 51ec3f3
Show file tree
Hide file tree
Showing 133 changed files with 586 additions and 418 deletions.
30 changes: 29 additions & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalOptions combine.children="append">
<option>--add-exports jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</option>
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</option>
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</option>
</additionalOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Extract the original sources again -->
<plugin>
Expand All @@ -74,7 +97,12 @@
<resources>
<resource>
<directory>${rootDir}/driver/src/main/java</directory>
<includes>**\/*.java</includes>
<includes>
<include>**\/*.java</include>
</includes>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
Expand Down
25 changes: 25 additions & 0 deletions driver/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,29 @@
<method>void close()</method>
</difference>

<difference>
<className>org/neo4j/driver/AuthTokens</className>
<differenceType>7009</differenceType>
<method>AuthTokens()</method>
</difference>

<difference>
<className>org/neo4j/driver/GraphDatabase</className>
<differenceType>7009</differenceType>
<method>GraphDatabase()</method>
</difference>

<difference>
<className>org/neo4j/driver/Records</className>
<differenceType>7009</differenceType>
<method>Records()</method>
</difference>

<difference>
<className>org/neo4j/driver/Values</className>
<differenceType>7006</differenceType>
<method>org.neo4j.driver.internal.value.BytesValue value(byte[])</method>
<to>org.neo4j.driver.Value</to>
</difference>

</differences>
87 changes: 73 additions & 14 deletions driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<description>Access to the Neo4j graph database through Java</description>

<properties>
<moduleName>org.neo4j.driver</moduleName>
<rootDir>${project.basedir}/..</rootDir>
<api.classes.directory>${basedir}/target/classes-without-jpms</api.classes.directory>
<surefire.jpms.args>--add-opens org.neo4j.driver/org.neo4j.driver.internal.util.messaging=ALL-UNNAMED</surefire.jpms.args>
<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>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

Expand Down Expand Up @@ -111,21 +113,80 @@
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs combine.children="append">
<arg>--add-exports</arg>
<arg>jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</arg>
<arg>--add-exports</arg>
<arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</arg>
<arg>--add-exports</arg>
<arg>org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalOptions combine.children="append">
<option>--add-exports jdk.internal.vm.ci/jdk.vm.ci.code=org.graalvm.nativeimage.builder</option>
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=org.neo4j.driver</option>
<option>--add-exports org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=org.neo4j.driver</option>
</additionalOptions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>copy-classes-excluding-jpms</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${api.classes.directory}</outputDirectory>
<resources>
<resource>
<directory>${project.build.outputDirectory}</directory>
<excludes>
<exclude>module-info.class</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<configuration>
<comparisonArtifacts>
<comparisonArtifact>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.0.0</version>
</comparisonArtifact>
</comparisonArtifacts>
<classesDirectory>${api.classes.directory}</classesDirectory>
<excludes>org/neo4j/driver/internal/**</excludes>
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<configuration>
<comparisonArtifacts>
<comparisonArtifact>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.0.0</version>
</comparisonArtifact>
</comparisonArtifacts>
<excludes>org/neo4j/driver/internal/**</excludes>
<ignoredDifferencesFile>clirr-ignored-differences.xml</ignoredDifferencesFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -155,8 +216,6 @@
<manifestEntries>
<!-- This is used to programmatically determine the driver version -->
<Implementation-Version>${project.version}-${build.revision}</Implementation-Version>
<!-- Stable module name for JDK9 automatic modules -->
<Automatic-Module-Name>${moduleName}</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
Expand Down
42 changes: 42 additions & 0 deletions driver/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@SuppressWarnings({"requires-automatic", "requires-transitive-automatic"})
module org.neo4j.driver {
exports org.neo4j.driver;
exports org.neo4j.driver.async;
exports org.neo4j.driver.reactive;
exports org.neo4j.driver.types;
exports org.neo4j.driver.summary;
exports org.neo4j.driver.net;
exports org.neo4j.driver.util;
exports org.neo4j.driver.exceptions;

requires reactor.core;
requires io.netty.common;
requires io.netty.handler;
requires io.netty.transport;
requires io.netty.buffer;
requires io.netty.codec;
requires io.netty.resolver;
requires transitive java.logging;
requires transitive org.reactivestreams;
requires static micrometer.core;
requires static org.graalvm.nativeimage.builder;
requires static org.slf4j;
}
2 changes: 2 additions & 0 deletions driver/src/main/java/org/neo4j/driver/AuthTokens.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* @since 1.0
*/
public class AuthTokens {
private AuthTokens() {}

/**
* The basic authentication scheme, using a username and a password.
* @param username this is the "principal", identifying who this token represents
Expand Down
2 changes: 1 addition & 1 deletion driver/src/main/java/org/neo4j/driver/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import org.neo4j.driver.internal.RevocationStrategy;
import org.neo4j.driver.internal.SecuritySettings;
import org.neo4j.driver.internal.async.pool.PoolSettings;
import org.neo4j.driver.internal.cluster.RoutingSettings;
Expand Down Expand Up @@ -677,6 +676,7 @@ public Config build() {
* Control how the driver determines if it can trust the encryption certificates provided by the Neo4j instance it is connected to.
*/
public static class TrustStrategy implements Serializable {
@Serial
private static final long serialVersionUID = -1631888096243987740L;

/**
Expand Down
2 changes: 2 additions & 0 deletions driver/src/main/java/org/neo4j/driver/GraphDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* @since 1.0
*/
public class GraphDatabase {
private GraphDatabase() {}

/**
* Return a driver for a Neo4j instance with the default configuration settings
*
Expand Down
2 changes: 2 additions & 0 deletions driver/src/main/java/org/neo4j/driver/Records.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* @since 1.0
*/
public abstract class Records {
private Records() {}

public static Function<Record, Value> column(int index) {
return column(index, Values.ofValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.driver.internal;
package org.neo4j.driver;

public enum RevocationStrategy {
/** Don't do any OCSP revocation checks, regardless whether there are stapled revocation statuses or not. */
Expand Down
2 changes: 1 addition & 1 deletion driver/src/main/java/org/neo4j/driver/Values.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static Value value(Value... input) {
return new ListValue(values);
}

public static BytesValue value(byte... input) {
public static Value value(byte... input) {
return new BytesValue(input);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.Serializable;
import java.security.GeneralSecurityException;
import org.neo4j.driver.Config;
import org.neo4j.driver.RevocationStrategy;
import org.neo4j.driver.exceptions.ClientException;
import org.neo4j.driver.internal.security.SecurityPlan;
import org.neo4j.driver.internal.security.SecurityPlanImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
* Extra markers should <em>not</em> be added casually and such additions must be follow a strict process involving both client and server software.
*
* The table below shows all allocated marker byte values.
*
* <p>
* <table>
* <caption>Allocated marker byte values.</caption>
* <tr><th>Marker</th><th>Binary</th><th>Type</th><th>Description</th></tr>
* <tr><td><code>00..7F</code></td><td><code>0xxxxxxx</code></td><td>+TINY_INT</td><td>Integer 0 to 127</td></tr>
* <tr><td><code>80..8F</code></td><td><code>1000xxxx</code></td><td>TINY_STRING</td><td></td></tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.neo4j.driver.internal.security;

import javax.net.ssl.SSLContext;
import org.neo4j.driver.internal.RevocationStrategy;
import org.neo4j.driver.RevocationStrategy;

/**
* A SecurityPlan consists of encryption and trust details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package org.neo4j.driver.internal.security;

import static org.neo4j.driver.internal.RevocationStrategy.VERIFY_IF_PRESENT;
import static org.neo4j.driver.internal.RevocationStrategy.requiresRevocationChecking;
import static org.neo4j.driver.RevocationStrategy.VERIFY_IF_PRESENT;
import static org.neo4j.driver.RevocationStrategy.requiresRevocationChecking;
import static org.neo4j.driver.internal.util.CertificateTool.loadX509Cert;

import java.io.File;
Expand All @@ -41,7 +41,7 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import org.neo4j.driver.internal.RevocationStrategy;
import org.neo4j.driver.RevocationStrategy;

/**
* A SecurityPlan consists of encryption and trust details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
final class Target_org_neo4j_driver_internal_DriverFactory {

/**
* Substitutes metrics adatper in such a way that it falls back to off when Micrometer is not available.
* Substitutes metrics adapter in such a way that it falls back to off when Micrometer is not available.
*
* @param config Drivers config
* @param clock Clock to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ final class Target_io_netty_handler_ssl_SslHandler$SslEngineType {
}
}

@SuppressWarnings("removal")
@TargetClass(
className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper",
onlyWith = JDK11OrLater.class)
Expand All @@ -138,6 +139,7 @@ public SSLEngine wrapSslEngine(
}
}

@SuppressWarnings("removal")
@TargetClass(
className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper",
onlyWith = JDK8OrEarlier.class)
Expand All @@ -160,6 +162,7 @@ public SSLEngine wrapSslEngine(
}
}

@SuppressWarnings("removal")
@TargetClass(className = "io.netty.handler.ssl.JettyAlpnSslEngine", onlyWith = JDK8OrEarlier.class)
final class Target_io_netty_handler_ssl_JettyAlpnSslEngine {
@Substitute
Expand All @@ -182,6 +185,7 @@ static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine(
}
}

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

Expand Down
Loading

0 comments on commit 51ec3f3

Please sign in to comment.