This is an automated email from the ASF dual-hosted git repository. timothyjward pushed a commit to branch java8-release-compile in repository https://gitbox.apache.org/repos/asf/aries-typedevent.git
commit 2fea553baac83ba7ed6df6d3872f9c0173ee785e Author: Tim Ward <[email protected]> AuthorDate: Tue Oct 27 16:20:52 2026 +0000 Compile with release 8 + removed Java 9 calls Setting source and target alone let List.of() and List.copyOf() compile on newer JDKs and fail at run time on Java 8. Using release makes the compiler reject Java 9+ APIs. Signed-off-by: Tim Ward <[email protected]> --- .../java/org/apache/aries/typedevent/bus/impl/EventSelector.java | 7 ++++--- pom.xml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/org.apache.aries.typedevent.bus/src/main/java/org/apache/aries/typedevent/bus/impl/EventSelector.java b/org.apache.aries.typedevent.bus/src/main/java/org/apache/aries/typedevent/bus/impl/EventSelector.java index cd12b76..d31f2c9 100644 --- a/org.apache.aries.typedevent.bus/src/main/java/org/apache/aries/typedevent/bus/impl/EventSelector.java +++ b/org.apache.aries.typedevent.bus/src/main/java/org/apache/aries/typedevent/bus/impl/EventSelector.java @@ -17,6 +17,7 @@ package org.apache.aries.typedevent.bus.impl; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.function.Predicate; @@ -77,7 +78,7 @@ public class EventSelector implements Comparable<EventSelector> { if(topic == null) { // No topic matching - additionalSegments = List.of(); + additionalSegments = Collections.emptyList(); isMultiLevelWildcard = false; initial = ""; topicMatcher = s -> true; @@ -93,7 +94,7 @@ public class EventSelector implements Comparable<EventSelector> { int singleLevelIdx = topic.indexOf('+'); if(singleLevelIdx < 0) { initial = topic; - additionalSegments = List.of(); + additionalSegments = Collections.emptyList(); } else { initial = topic.substring(0, singleLevelIdx); List<String> segments = new ArrayList<>(); @@ -107,7 +108,7 @@ public class EventSelector implements Comparable<EventSelector> { singleLevelIdx = nextIdx; } } - additionalSegments = List.copyOf(segments); + additionalSegments = Collections.unmodifiableList(segments); } if(additionalSegments.isEmpty()) { diff --git a/pom.xml b/pom.xml index d3e8997..40a5f25 100644 --- a/pom.xml +++ b/pom.xml @@ -166,6 +166,8 @@ <configuration> <source>1.8</source> <target>1.8</target> + <!-- release (not just source/target) so Java 9+ APIs fail the build --> + <release>8</release> </configuration> </plugin> <plugin>
