From 9a81fc5b064e4ae4f6217d55690bd97868260e16 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 7 Mar 2020 19:38:06 +0100 Subject: [PATCH] Changed compiler compliance to 11, modularized all packages (#114) * added module- and package-info.java, changed JRE from 8 to 11 * updated maven from Java 1.8 to 11 Co-authored-by: CyB3RC0nN0R --- .classpath | 2 +- .github/workflows/maven.yml | 4 +- .settings/org.eclipse.jdt.core.prefs | 8 +- pom.xml | 145 ++++++++++-------- .../java/envoy/client/data/package-info.java | 9 ++ .../java/envoy/client/event/package-info.java | 9 ++ src/main/java/envoy/client/net/Client.java | 2 +- src/main/java/envoy/client/net/Receiver.java | 7 +- .../java/envoy/client/net/package-info.java | 9 ++ .../client/ui/list/ComponentListModel.java | 2 +- .../envoy/client/ui/list/package-info.java | 10 ++ .../java/envoy/client/ui/package-info.java | 9 ++ .../client/ui/settings/package-info.java | 9 ++ src/main/java/module-info.java | 17 ++ 14 files changed, 163 insertions(+), 79 deletions(-) create mode 100644 src/main/java/envoy/client/data/package-info.java create mode 100644 src/main/java/envoy/client/event/package-info.java create mode 100644 src/main/java/envoy/client/net/package-info.java create mode 100644 src/main/java/envoy/client/ui/list/package-info.java create mode 100644 src/main/java/envoy/client/ui/package-info.java create mode 100644 src/main/java/envoy/client/ui/settings/package-info.java create mode 100644 src/main/java/module-info.java diff --git a/.classpath b/.classpath index a5d9509..234db15 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 91106d3..da5f736 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,9 +9,9 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 - name: Build with Maven run: mvn -B package --file pom.xml diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index cbcb911..7d167b0 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -10,9 +10,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled @@ -127,4 +127,4 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=11 diff --git a/pom.xml b/pom.xml index ec25577..572b5ed 100644 --- a/pom.xml +++ b/pom.xml @@ -1,68 +1,77 @@ - - 4.0.0 - - informatik-ag-ngl - envoy-client - 0.3-alpha - - Envoy Client - https://github.com/informatik-ag-ngl/envoy-client - - - UTF-8 - UTF-8 - 1.8 - 1.8 - - - - - jitpack.io - https://jitpack.io - - - - - - com.github.informatik-ag-ngl - envoy-common - develop-SNAPSHOT - - - - - envoy-client - - - src/main/resources - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.4.1 - - - package - - single - - - - - envoy.client.ui.Startup - - - - jar-with-dependencies - - - - - - - - \ No newline at end of file + + 4.0.0 + + informatik-ag-ngl + envoy-client + 0.1-beta + + Envoy Client + https://github.com/informatik-ag-ngl/envoy-client + + + UTF-8 + UTF-8 + 11 + 11 + + + + + jitpack.io + https://jitpack.io + + + + + + com.github.informatik-ag-ngl + envoy-common + develop-SNAPSHOT + + + + + envoy-client + + + src/main/resources + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.2.0 + + + package + + single + + + + + envoy.client.ui.Startup + + + + jar-with-dependencies + + + + + + + + diff --git a/src/main/java/envoy/client/data/package-info.java b/src/main/java/envoy/client/data/package-info.java new file mode 100644 index 0000000..3129027 --- /dev/null +++ b/src/main/java/envoy/client/data/package-info.java @@ -0,0 +1,9 @@ +/** + * This package contains all data classes and classes related to persistence. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.1-beta + */ +package envoy.client.data; diff --git a/src/main/java/envoy/client/event/package-info.java b/src/main/java/envoy/client/event/package-info.java new file mode 100644 index 0000000..58383e0 --- /dev/null +++ b/src/main/java/envoy/client/event/package-info.java @@ -0,0 +1,9 @@ +/** + * This package contains all client-sided events. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.1-beta + */ +package envoy.client.event; diff --git a/src/main/java/envoy/client/net/Client.java b/src/main/java/envoy/client/net/Client.java index 42bfe0b..acd16e5 100644 --- a/src/main/java/envoy/client/net/Client.java +++ b/src/main/java/envoy/client/net/Client.java @@ -85,7 +85,7 @@ public class Client implements Closeable { rejected = false; // Start receiver - new Thread(receiver).start(); + receiver.start(); // Write login credentials SerializationUtils.writeBytesWithLength(credentials, socket.getOutputStream()); diff --git a/src/main/java/envoy/client/net/Receiver.java b/src/main/java/envoy/client/net/Receiver.java index 3b53b48..08ea28d 100644 --- a/src/main/java/envoy/client/net/Receiver.java +++ b/src/main/java/envoy/client/net/Receiver.java @@ -21,7 +21,7 @@ import envoy.util.SerializationUtils; * @author Kai S. K. Engelbart * @since Envoy v0.3-alpha */ -public class Receiver implements Runnable { +public class Receiver extends Thread { private final InputStream in; private final Map, Consumer> processors = new HashMap<>(); @@ -33,7 +33,10 @@ public class Receiver implements Runnable { * * @param in the {@link InputStream} to parse objects from */ - public Receiver(InputStream in) { this.in = in; } + public Receiver(InputStream in) { + super("Receiver"); + this.in = in; + } @Override public void run() { diff --git a/src/main/java/envoy/client/net/package-info.java b/src/main/java/envoy/client/net/package-info.java new file mode 100644 index 0000000..5ee0e4e --- /dev/null +++ b/src/main/java/envoy/client/net/package-info.java @@ -0,0 +1,9 @@ +/** + * This package contains all classes related to client-server communication. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.1-beta + */ +package envoy.client.net; diff --git a/src/main/java/envoy/client/ui/list/ComponentListModel.java b/src/main/java/envoy/client/ui/list/ComponentListModel.java index fff3e6c..a604149 100644 --- a/src/main/java/envoy/client/ui/list/ComponentListModel.java +++ b/src/main/java/envoy/client/ui/list/ComponentListModel.java @@ -91,7 +91,7 @@ public final class ComponentListModel implements Iterable, Serializable { */ @Override public Iterator iterator() { - return new Iterator() { + return new Iterator<>() { Iterator iter = elements.iterator(); diff --git a/src/main/java/envoy/client/ui/list/package-info.java b/src/main/java/envoy/client/ui/list/package-info.java new file mode 100644 index 0000000..5f12ffd --- /dev/null +++ b/src/main/java/envoy/client/ui/list/package-info.java @@ -0,0 +1,10 @@ +/** + * This package defines a Swing component that can be used to display lists of + * other components to the user. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.3-alpha + */ +package envoy.client.ui.list; diff --git a/src/main/java/envoy/client/ui/package-info.java b/src/main/java/envoy/client/ui/package-info.java new file mode 100644 index 0000000..22238af --- /dev/null +++ b/src/main/java/envoy/client/ui/package-info.java @@ -0,0 +1,9 @@ +/** + * This package contains classes defining the user interface. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.1-beta + */ +package envoy.client.ui; diff --git a/src/main/java/envoy/client/ui/settings/package-info.java b/src/main/java/envoy/client/ui/settings/package-info.java new file mode 100644 index 0000000..bde6540 --- /dev/null +++ b/src/main/java/envoy/client/ui/settings/package-info.java @@ -0,0 +1,9 @@ +/** + * This package contains user interface classes related to the settings screen. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.2-alpha + */ +package envoy.client.ui.settings; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..4227885 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,17 @@ +/** + * This module contains all classes defining the client application of the Envoy + * project. + * + * @author Kai S. K. Engelbart + * @author Leon Hofmeister + * @author Maximilian Käfer + * @since Envoy v0.1-beta + */ +module envoy { + + requires transitive envoy.common; + requires transitive java.desktop; + requires transitive java.logging; + requires transitive java.naming; + requires transitive java.prefs; +}