From 38ae7e56dd4f381d04dc83771c144102fbebc5a3 Mon Sep 17 00:00:00 2001 From: panos-kakos <102670093+panos-kakos@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:22:11 +0300 Subject: [PATCH] [JAVA-19668] (#13721) * [JAVA-19668] Moved libraries-5 module to jdk9-and-above profile * [JAVA-19668] Moved libraries-4 module to jdk9-and-above profile * [JAVA-19668] Moved libraries-6 module to jdk9-and-above profile * [JAVA-19668] Moved libraries module to jdk9-and-above profile + reverted changes fro libraries-6 * [JAVA-19668] Created libraries-jdk8 module * [JAVA-19668] Clean up --- core-java-modules/core-java-9/README.md | 1 - libraries-4/pom.xml | 11 +++ libraries-5/pom.xml | 2 +- libraries-6/README.md | 2 +- libraries-6/pom.xml | 66 +++++++++++++-- .../java/com/baeldung/sbe/MarketData.java | 0 .../com/baeldung/sbe/MarketDataSource.java | 0 .../baeldung/sbe/MarketDataStreamServer.java | 0 .../java/com/baeldung/sbe/MarketDataUtil.java | 0 .../src/main/resources/schema.xml | 0 .../com/baeldung/r/FastRMeanUnitTest.java | 1 + .../test/EncodeDecodeMarketDataUnitTest.java | 0 libraries-7/pom.xml | 81 ------------------- {libraries-7 => libraries-jdk8}/README.md | 4 +- libraries-jdk8/pom.xml | 40 +++++++++ .../chronicle/queue/ChronicleQueue.java | 0 .../main/java/reflections/ReflectionsApp.java | 71 ++++++++++++++++ .../queue/ChronicleQueueIntegrationTest.java | 3 + .../java/reflections/ReflectionsUnitTest.java | 50 ++++++++++++ libraries/pom.xml | 43 +++++----- pom.xml | 19 ++--- 21 files changed, 275 insertions(+), 119 deletions(-) rename {libraries-7 => libraries-6}/src/main/java/com/baeldung/sbe/MarketData.java (100%) rename {libraries-7 => libraries-6}/src/main/java/com/baeldung/sbe/MarketDataSource.java (100%) rename {libraries-7 => libraries-6}/src/main/java/com/baeldung/sbe/MarketDataStreamServer.java (100%) rename {libraries-7 => libraries-6}/src/main/java/com/baeldung/sbe/MarketDataUtil.java (100%) rename {libraries-7 => libraries-6}/src/main/resources/schema.xml (100%) rename {libraries-7 => libraries-6}/src/test/java/com/baeldung/test/EncodeDecodeMarketDataUnitTest.java (100%) delete mode 100644 libraries-7/pom.xml rename {libraries-7 => libraries-jdk8}/README.md (75%) create mode 100644 libraries-jdk8/pom.xml rename {libraries => libraries-jdk8}/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java (100%) create mode 100644 libraries-jdk8/src/main/java/reflections/ReflectionsApp.java rename {libraries => libraries-jdk8}/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java (95%) create mode 100644 libraries-jdk8/src/test/java/reflections/ReflectionsUnitTest.java diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index 38965d88f1..bd7df0c8a6 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -5,7 +5,6 @@ This module contains articles about Java 9 core features ### Relevant Articles: - [Method Handles in Java](https://www.baeldung.com/java-method-handles) -- [Introduction to Chronicle Queue](https://www.baeldung.com/java-chronicle-queue) - [Iterate Through a Range of Dates in Java](https://www.baeldung.com/java-iterate-date-range) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Immutable ArrayList in Java](https://www.baeldung.com/java-immutable-list) diff --git a/libraries-4/pom.xml b/libraries-4/pom.xml index 7d19f6d504..87e618ee5b 100644 --- a/libraries-4/pom.xml +++ b/libraries-4/pom.xml @@ -99,6 +99,16 @@ javax.el ${glassfish.web.version} + + org.openjfx + javafx-controls + ${javafx.version} + + + org.openjfx + javafx-fxml + ${javafx.version} + @@ -118,6 +128,7 @@ 3.0.0 2.2.4 1.2.0 + 19 \ No newline at end of file diff --git a/libraries-5/pom.xml b/libraries-5/pom.xml index fa1f232d1c..c98a66c094 100644 --- a/libraries-5/pom.xml +++ b/libraries-5/pom.xml @@ -139,7 +139,7 @@ 4.3.8.RELEASE 2.12 2.5.11 - 0.6.5 + 0.8.1 3.0.14 2.5.5 3.0.2 diff --git a/libraries-6/README.md b/libraries-6/README.md index 8ef60b2e54..bbebcbc1e0 100644 --- a/libraries-6/README.md +++ b/libraries-6/README.md @@ -12,8 +12,8 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m - [Guide to Resilience4j](https://www.baeldung.com/resilience4j) - [Implementing a FTP-Client in Java](https://www.baeldung.com/java-ftp-client) - [Introduction to Functional Java](https://www.baeldung.com/java-functional-library) -- [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library) - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) +- [Guide to Simple Binary Encoding](https://www.baeldung.com/java-sbe) - [Java-R Integration](https://www.baeldung.com/java-r-integration) - [Using libphonenumber to Validate Phone Numbers](https://www.baeldung.com/java-libphonenumber) - [Apache Commons Collections vs Google Guava](https://www.baeldung.com/apache-commons-collections-vs-guava) diff --git a/libraries-6/pom.xml b/libraries-6/pom.xml index 3b932f2bd2..234fa1349e 100644 --- a/libraries-6/pom.xml +++ b/libraries-6/pom.xml @@ -53,12 +53,6 @@ ${mockftpserver.version} test - - - org.reflections - reflections - ${reflections.version} - org.apache.commons commons-lang3 @@ -106,6 +100,11 @@ modelmapper ${org.modelmapper.version} + + org.agrona + agrona + 1.17.1 + @@ -119,6 +118,60 @@ + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + generate-sources + + java + + + + + false + true + uk.co.real_logic.sbe.SbeTool + + + sbe.output.dir + ${project.build.directory}/generated-sources/java + + + + ${project.basedir}/src/main/resources/schema.xml + + ${project.build.directory}/generated-sources/java + + + + uk.co.real-logic + sbe-tool + 1.27.0 + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/java/ + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -137,7 +190,6 @@ 1.10.0 - 0.9.11 2.7.1 4.8.1 0.12.1 diff --git a/libraries-7/src/main/java/com/baeldung/sbe/MarketData.java b/libraries-6/src/main/java/com/baeldung/sbe/MarketData.java similarity index 100% rename from libraries-7/src/main/java/com/baeldung/sbe/MarketData.java rename to libraries-6/src/main/java/com/baeldung/sbe/MarketData.java diff --git a/libraries-7/src/main/java/com/baeldung/sbe/MarketDataSource.java b/libraries-6/src/main/java/com/baeldung/sbe/MarketDataSource.java similarity index 100% rename from libraries-7/src/main/java/com/baeldung/sbe/MarketDataSource.java rename to libraries-6/src/main/java/com/baeldung/sbe/MarketDataSource.java diff --git a/libraries-7/src/main/java/com/baeldung/sbe/MarketDataStreamServer.java b/libraries-6/src/main/java/com/baeldung/sbe/MarketDataStreamServer.java similarity index 100% rename from libraries-7/src/main/java/com/baeldung/sbe/MarketDataStreamServer.java rename to libraries-6/src/main/java/com/baeldung/sbe/MarketDataStreamServer.java diff --git a/libraries-7/src/main/java/com/baeldung/sbe/MarketDataUtil.java b/libraries-6/src/main/java/com/baeldung/sbe/MarketDataUtil.java similarity index 100% rename from libraries-7/src/main/java/com/baeldung/sbe/MarketDataUtil.java rename to libraries-6/src/main/java/com/baeldung/sbe/MarketDataUtil.java diff --git a/libraries-7/src/main/resources/schema.xml b/libraries-6/src/main/resources/schema.xml similarity index 100% rename from libraries-7/src/main/resources/schema.xml rename to libraries-6/src/main/resources/schema.xml diff --git a/libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java b/libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java index 4e7426b75a..2412bb751b 100644 --- a/libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java +++ b/libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java @@ -1,5 +1,6 @@ package com.baeldung.r; + import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; diff --git a/libraries-7/src/test/java/com/baeldung/test/EncodeDecodeMarketDataUnitTest.java b/libraries-6/src/test/java/com/baeldung/test/EncodeDecodeMarketDataUnitTest.java similarity index 100% rename from libraries-7/src/test/java/com/baeldung/test/EncodeDecodeMarketDataUnitTest.java rename to libraries-6/src/test/java/com/baeldung/test/EncodeDecodeMarketDataUnitTest.java diff --git a/libraries-7/pom.xml b/libraries-7/pom.xml deleted file mode 100644 index 67cc2326eb..0000000000 --- a/libraries-7/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - 4.0.0 - libraries-7 - - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - - - - - org.agrona - agrona - 1.17.1 - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - generate-sources - - java - - - - - false - true - uk.co.real_logic.sbe.SbeTool - - - sbe.output.dir - ${project.build.directory}/generated-sources/java - - - - ${project.basedir}/src/main/resources/schema.xml - - ${project.build.directory}/generated-sources/java - - - - uk.co.real-logic - sbe-tool - 1.27.0 - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/java/ - - - - - - - - - \ No newline at end of file diff --git a/libraries-7/README.md b/libraries-jdk8/README.md similarity index 75% rename from libraries-7/README.md rename to libraries-jdk8/README.md index 6f0a7d2505..1aefc54289 100644 --- a/libraries-7/README.md +++ b/libraries-jdk8/README.md @@ -8,5 +8,7 @@ The code examples related to different libraries are each in their own module. Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-modules) we already have separate modules. Please make sure to have a look at the existing modules in such cases. ### Relevant articles -- [Guide to Simple Binary Encoding](https://www.baeldung.com/java-sbe) +- [Introduction to Chronicle Queue](https://www.baeldung.com/java-chronicle-queue) +- [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library) + - More articles [[<-- prev]](/libraries-6) diff --git a/libraries-jdk8/pom.xml b/libraries-jdk8/pom.xml new file mode 100644 index 0000000000..31582e0bdd --- /dev/null +++ b/libraries-jdk8/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + libraries-jdk8 + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + + + org.reflections + reflections + ${reflections.version} + + + + net.openhft + chronicle + ${chronicle.version} + + + com.sun.java + tools + + + + + + + 0.9.11 + 3.6.4 + + + \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java b/libraries-jdk8/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java similarity index 100% rename from libraries/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java rename to libraries-jdk8/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java diff --git a/libraries-jdk8/src/main/java/reflections/ReflectionsApp.java b/libraries-jdk8/src/main/java/reflections/ReflectionsApp.java new file mode 100644 index 0000000000..39d0fafb10 --- /dev/null +++ b/libraries-jdk8/src/main/java/reflections/ReflectionsApp.java @@ -0,0 +1,71 @@ +package reflections; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.Set; +import java.util.regex.Pattern; + +import org.reflections.Reflections; +import org.reflections.scanners.MethodAnnotationsScanner; +import org.reflections.scanners.MethodParameterScanner; +import org.reflections.scanners.ResourcesScanner; +import org.reflections.scanners.Scanner; +import org.reflections.scanners.SubTypesScanner; +import org.reflections.util.ClasspathHelper; +import org.reflections.util.ConfigurationBuilder; + +public class ReflectionsApp { + + public Set> getReflectionsSubTypes() { + Reflections reflections = new Reflections("org.reflections"); + Set> scannersSet = reflections.getSubTypesOf(Scanner.class); + return scannersSet; + } + + public Set> getJDKFunctinalInterfaces() { + Reflections reflections = new Reflections("java.util.function"); + Set> typesSet = reflections.getTypesAnnotatedWith(FunctionalInterface.class); + return typesSet; + } + + public Set getDateDeprecatedMethods() { + Reflections reflections = new Reflections(Date.class, new MethodAnnotationsScanner()); + Set deprecatedMethodsSet = reflections.getMethodsAnnotatedWith(Deprecated.class); + return deprecatedMethodsSet; + } + + @SuppressWarnings("rawtypes") + public Set getDateDeprecatedConstructors() { + Reflections reflections = new Reflections(Date.class, new MethodAnnotationsScanner()); + Set constructorsSet = reflections.getConstructorsAnnotatedWith(Deprecated.class); + return constructorsSet; + } + + public Set getMethodsWithDateParam() { + Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); + Set methodsSet = reflections.getMethodsMatchParams(Date.class); + return methodsSet; + } + + public Set getMethodsWithVoidReturn() { + Reflections reflections = new Reflections(java.text.SimpleDateFormat.class, new MethodParameterScanner()); + Set methodsSet = reflections.getMethodsReturn(void.class); + return methodsSet; + } + + public Set getPomXmlPaths() { + Reflections reflections = new Reflections(new ResourcesScanner()); + Set resourcesSet = reflections.getResources(Pattern.compile(".*pom\\.xml")); + return resourcesSet; + } + + public Set> getReflectionsSubTypesUsingBuilder() { + Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.reflections")) + .setScanners(new SubTypesScanner())); + + Set> scannersSet = reflections.getSubTypesOf(Scanner.class); + return scannersSet; + } + +} diff --git a/libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java b/libraries-jdk8/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java similarity index 95% rename from libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java rename to libraries-jdk8/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java index 00e9500318..7e0bcb7d33 100644 --- a/libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java +++ b/libraries-jdk8/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueIntegrationTest.java @@ -8,6 +8,8 @@ import java.nio.file.Files; import org.junit.Test; +import com.baeldung.chronicle.queue.ChronicleQueue; + import net.openhft.chronicle.Chronicle; import net.openhft.chronicle.ChronicleQueueBuilder; import net.openhft.chronicle.ExcerptTailer; @@ -15,6 +17,7 @@ import net.openhft.chronicle.tools.ChronicleTools; public class ChronicleQueueIntegrationTest { +// @Ignore @Test public void givenSetOfValues_whenWriteToQueue_thenWriteSuccesfully() throws IOException { File queueDir = Files.createTempDirectory("chronicle-queue").toFile(); diff --git a/libraries-jdk8/src/test/java/reflections/ReflectionsUnitTest.java b/libraries-jdk8/src/test/java/reflections/ReflectionsUnitTest.java new file mode 100644 index 0000000000..5104855208 --- /dev/null +++ b/libraries-jdk8/src/test/java/reflections/ReflectionsUnitTest.java @@ -0,0 +1,50 @@ +package reflections; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +public class ReflectionsUnitTest { + + @Test + public void givenTypeThenGetAllSubTypes() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getReflectionsSubTypes() + .isEmpty()); + } + + @Test + public void givenTypeAndUsingBuilderThenGetAllSubTypes() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getReflectionsSubTypesUsingBuilder() + .isEmpty()); + } + + @Test + public void givenAnnotationThenGetAllAnnotatedMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getDateDeprecatedMethods() + .isEmpty()); + } + + @Test + public void givenAnnotationThenGetAllAnnotatedConstructors() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getDateDeprecatedConstructors() + .isEmpty()); + } + + @Test + public void givenParamTypeThenGetAllMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getMethodsWithDateParam() + .isEmpty()); + } + + @Test + public void givenReturnTypeThenGetAllMethods() { + ReflectionsApp reflectionsApp = new ReflectionsApp(); + assertFalse(reflectionsApp.getMethodsWithVoidReturn() + .isEmpty()); + } +} diff --git a/libraries/pom.xml b/libraries/pom.xml index 7bef56deb0..2ab345c469 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -64,7 +64,7 @@ org.datanucleus datanucleus-api-jdo - ${datanucleus.version} + ${datanucleus-api.version} org.datanucleus @@ -86,17 +86,7 @@ datanucleus-jdo-query ${datanucleus-jdo-query.version} - - net.openhft - chronicle - ${chronicle.version} - - - com.sun.java - tools - - - + org.springframework spring-web @@ -180,6 +170,23 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports=java.base/sun.nio.ch=ALL-UNNAMED + --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + + + org.datanucleus @@ -273,16 +280,16 @@ 1.15 1.23.0 0.9.4.0006L - 3.2.0-m7 - 5.1.1 - 5.0.2 + 3.2.1 + 6.0.3 + 6.0.1 + 6.0.0-release 5.0.0-release - 5.0.2 - 3.6.4 + 6.0.1 4.3.8.RELEASE 3.0.3 2.3.0 - 3.21.0-GA + 3.29.2-GA 0.9.12 3.0.2 3.6 diff --git a/pom.xml b/pom.xml index 12688defa6..a812472113 100644 --- a/pom.xml +++ b/pom.xml @@ -362,6 +362,7 @@ language-interop libraries-3 + libraries-jdk8 lombok-modules @@ -491,11 +492,7 @@ jhipster-5 jws - libraries - libraries-4 - libraries-5 libraries-6 - @@ -562,6 +559,7 @@ language-interop libraries-3 + libraries-jdk8 lombok-modules muleesb @@ -673,9 +671,6 @@ jhipster-5 jws - libraries - libraries-4 - libraries-5 libraries-6 @@ -896,8 +891,12 @@ jsoup ksqldb jsf + + libraries libraries-2 - libraries-7 + libraries-4 + libraries-5 + libraries-apache-commons libraries-apache-commons-collections libraries-apache-commons-io @@ -1145,7 +1144,9 @@ jsf ksqldb - libraries-7 + libraries + libraries-4 + libraries-5 libraries-apache-commons libraries-apache-commons-collections libraries-apache-commons-io