mirror of
https://github.com/actiontech/dble.git
synced 2026-05-03 21:10:31 -05:00
support jdk 11 in maven
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
<description>The project of dble-server</description>
|
||||
|
||||
<properties>
|
||||
<!-- only for error prone -->
|
||||
<javac.version>9+181-r4173-1</javac.version>
|
||||
<java.version>1.8</java.version>
|
||||
<app.encoding>UTF-8</app.encoding>
|
||||
<version.template.file>version.txt.template</version.template.file>
|
||||
@@ -371,28 +373,26 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.2</version>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerId>javac-with-errorprone</compilerId>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<debug>true</debug>
|
||||
<optimize>true</optimize>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${app.encoding}</encoding>
|
||||
<compilerArgs>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
<arg>-Xplugin:ErrorProne -Xep:ReturnValueIgnored:OFF -Xep:MissingSummary:OFF</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||
<version>2.8</version>
|
||||
</dependency>
|
||||
<!-- override plexus-compiler-javac-errorprone's dependency on Error Prone
|
||||
with the latest version -->
|
||||
<dependency>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
@@ -638,11 +638,29 @@
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<id>java8</id>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<jdk>8</jdk>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>
|
||||
-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar
|
||||
</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
@@ -650,5 +668,57 @@
|
||||
</resources>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>java11</id>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
<activation>
|
||||
<jdk>11</jdk>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</arg>
|
||||
<arg>--add-exports=java.base/sun.net.util=ALL-UNNAMED</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!--xml bind -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>javax.activation-api</artifactId>
|
||||
<version>1.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,6 @@ package com.actiontech.dble.backend.mysql.store.fs;
|
||||
import com.actiontech.dble.config.model.SystemConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
@@ -174,7 +173,7 @@ class FileNioMapped extends FileBase {
|
||||
return -1;
|
||||
}
|
||||
mapped.position(pos);
|
||||
if (dst instanceof DirectBuffer) {
|
||||
if (dst.isDirect()) {
|
||||
byte[] temp = new byte[len];
|
||||
mapped.get(temp, 0, len);
|
||||
dst.put(temp);
|
||||
@@ -199,7 +198,7 @@ class FileNioMapped extends FileBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public synchronized void setFileLength(long newLength) throws IOException {
|
||||
private synchronized void setFileLength(long newLength) throws IOException {
|
||||
checkFileSizeLimit(newLength);
|
||||
final int oldPos = pos;
|
||||
unMap();
|
||||
@@ -228,12 +227,12 @@ class FileNioMapped extends FileBase {
|
||||
* don't expand
|
||||
*/
|
||||
@Override
|
||||
public synchronized int write(ByteBuffer src) throws IOException {
|
||||
public synchronized int write(ByteBuffer src) {
|
||||
int len = src.remaining();
|
||||
if (mapped.capacity() < pos + len) {
|
||||
int offset = src.position();
|
||||
int length = mapped.capacity() - pos;
|
||||
if (src instanceof DirectBuffer) {
|
||||
if (src.isDirect()) {
|
||||
byte[] temp = new byte[length];
|
||||
src.get(temp, 0, length);
|
||||
mapped.put(temp, 0, length);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DirectByteBufferPool implements BufferPool {
|
||||
}
|
||||
|
||||
public void recycle(ByteBuffer theBuf) {
|
||||
if (!(theBuf instanceof DirectBuffer)) {
|
||||
if (!(theBuf.isDirect())) {
|
||||
theBuf.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package com.actiontech.dble.util;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import sun.util.calendar.CalendarUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -53,7 +52,6 @@ public final class DateUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* parseStr
|
||||
*
|
||||
* @param time
|
||||
@@ -169,8 +167,8 @@ public final class DateUtil {
|
||||
int timeDistance = 0;
|
||||
for (int i = year1; i < year2; i++) {
|
||||
if (i == year1) {
|
||||
timeDistance += (CalendarUtils.isGregorianLeapYear(year1) ? 366 : 365) - day1;
|
||||
} else if (CalendarUtils.isGregorianLeapYear(i)) {
|
||||
timeDistance += (isGregorianLeapYear(year1) ? 366 : 365) - day1;
|
||||
} else if (isGregorianLeapYear(i)) {
|
||||
timeDistance += 366;
|
||||
} else {
|
||||
timeDistance += 365;
|
||||
@@ -183,4 +181,8 @@ public final class DateUtil {
|
||||
return negativeFlag ? diffDays : -diffDays;
|
||||
}
|
||||
|
||||
private static boolean isGregorianLeapYear(int gregorianYear) {
|
||||
return (((gregorianYear % 4) == 0) && (((gregorianYear % 100) != 0) || ((gregorianYear % 400) == 0)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user