The jOOQ 3.12 Open Source Edition will continue to support Java 8. The only things we gain from the JDK 11 dependency is:

- Updated logic for reflection when mapping into proxied default methods (that stuff has changed completely in JDK 9). This is a regression, which we can live with. The workaround is to write a custom
- Explicit dependency on the JDK 9  API, for which we provide a Java 8 compatible alternative via reactive streams anyway.
- JDBC 4.3 compatibility (mostly sharding). We currently don't use that yet.

We're not even using  internally, outside of a few integration tests. So, we'll postpone the JDK 11 *requirement* (while supporting it nonetheless) to a later release, e.g. 3.13. We'll observe market share shifts. Currently Java 11's market share is a bit of a disappointment, so making it a requirement might be premature.
This commit is contained in:
Lukas Eder 2019-07-26 15:18:18 +02:00
parent df4b94d765
commit 854375dbcf
33 changed files with 355 additions and 347 deletions

View File

@ -1,12 +1,13 @@
/**
* The jOOQ checker module
*/
/*
// Modularisation not possible, yet: https://github.com/typetools/checker-framework/issues/2024
module org.jooq.checker {
requires org.jooq;
requires checker;
}
*/

View File

@ -1,16 +1,17 @@
/**
* The jOOQ code generation maven plugin module.
*/
module org.jooq.codegen.maven {
requires org.jooq;
requires org.jooq.meta;
requires org.jooq.codegen;
requires maven.plugin.annotations;
// Split packages between these
// See https://issues.apache.org/jira/browse/MPLUGIN-341
requires maven.core;
requires maven.plugin.api;
}

View File

@ -1,14 +1,15 @@
/**
* The jOOQ code generation module.
*/
module org.jooq.codegen {
requires org.jooq;
requires org.jooq.meta;
// Some marshalling and unmarshalling of JAXB-annotated XML configuration is needed
requires java.xml.bind;
exports org.jooq.codegen;
exports org.jooq.codegen.example;
}

View File

@ -85,12 +85,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -61,8 +61,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<annotationProcessors>
<annotationProcessor>org.jooq.checker.SQLDialectChecker</annotationProcessor>
@ -86,8 +86,8 @@
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.jooq</groupId>

View File

@ -127,12 +127,12 @@
<version>${version.compiler.plugin}</version>
<configuration>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

View File

@ -88,12 +88,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -39,12 +39,12 @@
<version>3.8.0</version>
<configuration>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<!-- How to properly set things up in JDK 9+
https://stackoverflow.com/a/51409471/521799 -->
@ -62,7 +62,7 @@
<annotationProcessorPath>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
<version>2.2.12</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
@ -71,7 +71,7 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
<version>2.2.12</version>
</dependency>
</dependencies>
</plugin>

View File

@ -1,12 +1,13 @@
/**
* The jOOQ example JPA entities module.
*/
module org.jooq.example.jpa.entities {
requires java.persistence;
requires org.hibernate.orm.core;
exports org.jooq.example.jpa.converters;
exports org.jooq.example.jpa.embeddables;
exports org.jooq.example.jpa.entity;
}

View File

@ -101,12 +101,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -1,14 +1,15 @@
/**
* The jOOQ example JPA entities module.
*/
module org.jooq.example.jpa {
requires org.jooq;
requires org.jooq.example.jpa.entities;
requires java.persistence;
requires org.hibernate.orm.core;
requires spring.jdbc;
requires spring.orm;
}

View File

@ -183,12 +183,12 @@
<version>3.8.0</version>
<configuration>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

View File

@ -67,12 +67,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -42,12 +42,12 @@
<version>3.8.0</version>
<configuration>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

View File

@ -93,12 +93,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -103,12 +103,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -90,12 +90,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>

View File

@ -1,18 +1,19 @@
/**
* The jOOQ code generation meta model extensions module.
*/
module org.jooq.meta.extensions {
requires org.jooq;
requires org.jooq.meta;
requires java.persistence;
requires org.hibernate.orm.core;
requires spring.beans;
requires spring.context;
requires spring.core;
requires h2;
exports org.jooq.meta.extensions.ddl;
exports org.jooq.meta.extensions.jpa;
}

View File

@ -1,20 +1,4 @@
/**
* The jOOQ code generation meta model module.
*/
module org.jooq.meta {
requires org.jooq;
// There are a few JAXB dependencies:
// - The XMLDatabase works with JAXB-annotated InformationSchema types
// - The code generation configuration is also JAXB enabled
requires java.xml.bind;
exports org.jooq.meta;
exports org.jooq.meta.jaxb;
exports org.jooq.meta.jdbc;
exports org.jooq.meta.xml;
@ -31,13 +15,30 @@ module org.jooq.meta {
exports org.jooq.meta.cubrid;
exports org.jooq.meta.derby;
exports org.jooq.meta.firebird;
exports org.jooq.meta.h2;
exports org.jooq.meta.hsqldb;
exports org.jooq.meta.mariadb;
exports org.jooq.meta.mysql;
exports org.jooq.meta.postgres;
exports org.jooq.meta.sqlite;
}

View File

@ -139,7 +139,7 @@
</target>
<!-- [java-9] -->
<target name="release-oss" description="Release a new version">
<property name="version" value="${version-prefix}"/>

View File

@ -1,49 +1,4 @@
/**
* The jOOQ runtime module.
*/
module org.jooq {
// jOOQ heavily depends on JDBC and cannot work without it
requires transitive java.sql;
// JAXB is used optionally for loading a variety of XML content, including
// - Settings (org.jooq.conf)
// - InformationSchema (org.jooq.util.xml.jaxb)
requires static java.xml.bind;
// The DefaultRecordMapper makes use of JavaBeans utilities, including:
// - Support for ConstructorProperties
requires static java.desktop;
// Various utilities can make use of JPA annotations, when present, including:
// - The DefaultRecordMapper
// - The JPADatabase in the code generator
// - The EntityManagerConnectionProvider
requires static java.persistence;
// The runtime Java compiler is used to generate enum types on the fly.
// This dependency may be removed in the future.
requires static java.compiler;
// Optional logging APIs - slf4j will be preferred if found
requires static org.slf4j;
requires static java.logging;
exports org.jooq;
exports org.jooq.api.annotation;
exports org.jooq.conf;
exports org.jooq.exception;
exports org.jooq.impl;
exports org.jooq.tools;
exports org.jooq.tools.csv;
exports org.jooq.tools.jdbc;
exports org.jooq.tools.json;
exports org.jooq.tools.reflect;
exports org.jooq.types;
exports org.jooq.util.jaxb.tools;
exports org.jooq.util.xml.jaxb;
@ -61,13 +16,59 @@ module org.jooq {
exports org.jooq.util.cubrid;
exports org.jooq.util.derby;
exports org.jooq.util.firebird;
exports org.jooq.util.h2;
exports org.jooq.util.hsqldb;
exports org.jooq.util.mariadb;
exports org.jooq.util.mysql;
exports org.jooq.util.postgres;
exports org.jooq.util.sqlite;
}

View File

@ -52,7 +52,7 @@ import java.util.Spliterator;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Flow;
// ...
import java.util.function.Consumer;
import java.util.stream.Collector;
import java.util.stream.Stream;
@ -103,7 +103,7 @@ extends
Query
, Iterable<R>
, org.reactivestreams.Publisher<R>
, Flow.Publisher<R>
{
/**

View File

@ -37,7 +37,7 @@
*/
package org.jooq;
import java.util.concurrent.Flow;
// ...
/**
* Any query that is not a {@link ResultQuery}, and thus possibly produces a row
@ -49,7 +49,7 @@ public interface RowCountQuery
extends
Query
, org.reactivestreams.Publisher<Integer>
, Flow.Publisher<Integer>
{
}

View File

@ -37,7 +37,7 @@
*/
package org.jooq.impl;
import java.util.concurrent.Flow;
// ...
import org.jooq.RowCountQuery;
@ -57,10 +57,10 @@ abstract class AbstractDelegatingRowCountQuery<Q extends RowCountQuery> extends
@Override
public final void subscribe(Flow.Subscriber<? super Integer> subscriber) {
getDelegate().subscribe(subscriber);
}

View File

@ -71,7 +71,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Flow;
// ...
import java.util.concurrent.Future;
import java.util.stream.Collector;
import java.util.stream.Stream;
@ -366,10 +366,10 @@ abstract class AbstractResultQuery<R extends Record> extends AbstractQuery imple
@Override
public final void subscribe(Flow.Subscriber<? super R> subscriber) {
subscribe(new FlowToReactiveStreamsSubscriberBridge<>(subscriber));
}

View File

@ -84,10 +84,10 @@ abstract class AbstractRowCountQuery extends AbstractQuery implements RowCountQu
@Override
public final void subscribe(java.util.concurrent.Flow.Subscriber<? super Integer> subscriber) {
subscribe(new FlowToReactiveStreamsSubscriberBridge<>(subscriber));
}
}

View File

@ -39,50 +39,50 @@ package org.jooq.impl;
import java.util.concurrent.Flow;
/**
* A bridge mapping a JDK 9 {@link Flow.Subscriber} to a reactive streams
* {@link org.reactivestreams.Subscriber}
*
* @author Lukas Eder
*/
final class FlowToReactiveStreamsSubscriberBridge<T> implements org.reactivestreams.Subscriber<T> {
final Flow.Subscriber<? super T> delegate;
FlowToReactiveStreamsSubscriberBridge(Flow.Subscriber<? super T> delegate) {
this.delegate = delegate;
}
@Override
public void onSubscribe(org.reactivestreams.Subscription s) {
delegate.onSubscribe(new Flow.Subscription() {
@Override
public void request(long n) {
s.request(n);
}
@Override
public void cancel() {
s.cancel();
}
});
}
@Override
public void onNext(T t) {
delegate.onNext(t);
}
@Override
public void onError(Throwable t) {
delegate.onError(t);
}
@Override
public void onComplete() {
delegate.onComplete();
}
}

View File

@ -54,7 +54,7 @@ import java.util.Set;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Flow;
// ...
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collector;
@ -2705,10 +2705,10 @@ final class SelectImpl<R extends Record, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
@Override
public final void subscribe(Flow.Subscriber<? super R> subscriber) {
getDelegate().subscribe(subscriber);
}

View File

@ -50,7 +50,7 @@ import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.ShardingKey;
// ...;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
@ -359,39 +359,39 @@ public class DefaultConnection extends JDBC41Connection implements Connection {
// ------------------------------------------------------------------------
// JDBC 4.3
// ------------------------------------------------------------------------
@Override
public void beginRequest() throws SQLException {
getDelegate().beginRequest();
}
@Override
public void endRequest() throws SQLException {
getDelegate().endRequest();
}
@Override
public boolean setShardingKeyIfValid(ShardingKey shardingKey, ShardingKey superShardingKey, int timeout) throws SQLException {
return getDelegate().setShardingKeyIfValid(shardingKey, superShardingKey, timeout);
}
@Override
public boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) throws SQLException {
return getDelegate().setShardingKeyIfValid(shardingKey, timeout);
}
@Override
public void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) throws SQLException {
getDelegate().setShardingKey(shardingKey, superShardingKey);
}
@Override
public void setShardingKey(ShardingKey shardingKey) throws SQLException {
getDelegate().setShardingKey(shardingKey);
}
}

View File

@ -353,29 +353,29 @@ public class DefaultStatement extends JDBC41Statement implements Statement {
// ------------------------------------------------------------------------
// JDBC 4.3
// ------------------------------------------------------------------------
@Override
public String enquoteLiteral(String val) throws SQLException {
return getDelegate().enquoteLiteral(val);
}
@Override
public String enquoteIdentifier(String identifier, boolean alwaysQuote) throws SQLException {
return getDelegate().enquoteIdentifier(identifier, alwaysQuote);
}
@Override
public boolean isSimpleIdentifier(String identifier) throws SQLException {
return getDelegate().isSimpleIdentifier(identifier);
}
@Override
public String enquoteNCharLiteral(String val) throws SQLException {
return getDelegate().enquoteNCharLiteral(val);
}

View File

@ -15,7 +15,7 @@ package org.jooq.tools.reflect;
import static java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE;
// ...
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -102,41 +102,41 @@ class Compile {
}
// Lookup.defineClass() has only been introduced in Java 9. It is
// required to get private-access to interfaces in the class hierarchy
else {
// This method is called by client code from two levels up the current stack frame
// We need a private-access lookup from the class in that stack frame in order to get
// private-access to any local interfaces at that location.
Class<?> caller = StackWalker
.getInstance(RETAIN_CLASS_REFERENCE)
.walk(s -> s
.skip(2)
.findFirst()
.get()
.getDeclaringClass());
// If the compiled class is in the same package as the caller class, then
// we can use the private-access Lookup of the caller class
if (className.startsWith(caller.getPackageName() + ".")) {
result = MethodHandles
.privateLookupIn(caller, lookup)
.defineClass(fileManager.o.getBytes());
}
// Otherwise, use an arbitrary class loader. This approach doesn't allow for
// loading private-access interfaces in the compiled class's type hierarchy
else {
result = new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
byte[] b = fileManager.o.getBytes();
return defineClass(className, b, 0, b.length);
}
}.loadClass(className);
}
}
return result;

View File

@ -290,9 +290,9 @@ public class Reflect {
Constructor<MethodHandles.Lookup> result;
if (true)
result = null;
else
try {
result = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class);
@ -767,15 +767,15 @@ public class Reflect {
if (method.isDefault()) {
// Java 9 version
if (CACHED_LOOKUP_CONSTRUCTOR == null) {
return MethodHandles
.privateLookupIn(proxyType, MethodHandles.lookup())
.in(proxyType)
.unreflectSpecial(method, proxyType)
.bindTo(proxy)
.invokeWithArguments(args);
}
// Java 8 version

View File

@ -267,12 +267,12 @@
<meminitial>256m</meminitial>
<encoding>UTF-8</encoding>
<release>11</release>
<!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>