From 1eae89b5ec26e992f08085d814f1e15535e05078 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 15 Dec 2023 12:31:11 +0200 Subject: [PATCH 1/2] Remove String interfaces from BANNED_INTERFACE_TYPES This is done because we now use JDK 17 as a baseline --- .../src/main/java/io/quarkus/arc/processor/Types.java | 9 ++------- .../quarkus/arc/test/bean/types/EnumBeanTypesTest.java | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java index 27340b943a063..08e7688dc0f8b 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java @@ -4,7 +4,6 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -78,13 +77,9 @@ public final class Types { DotNames.DOUBLE, DotNames.CHARACTER); - // we ban these interfaces because they are new to Java 12 and are used by java.lang.String which - // means that they cannot be included in bytecode if we want to have application built with Java 12+ but targeting Java 8 - 11 - // actually run on those older versions + // we ban these interfaces because of mismatch between building JDK version and target JDK version // TODO: add a extensible banning mechanism based on predicates if we find that this set needs to grow... - private static final Set BANNED_INTERFACE_TYPES = new HashSet<>( - Arrays.asList(DotName.createSimple("java.lang.constant.ConstantDesc"), - DotName.createSimple("java.lang.constant.Constable"))); + private static final Set BANNED_INTERFACE_TYPES = Collections.emptySet(); private Types() { } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/bean/types/EnumBeanTypesTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/bean/types/EnumBeanTypesTest.java index 0e004b19e854a..c489c10f0a0de 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/bean/types/EnumBeanTypesTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/bean/types/EnumBeanTypesTest.java @@ -27,7 +27,7 @@ public void test() { InjectableBean bean = Arc.container().instance(ExtendedBoolean.class).getBean(); Set types = bean.getTypes(); - assertEquals(5, types.size()); + assertEquals(6, types.size()); assertTrue(types.contains(Object.class)); assertTrue(types.contains(Serializable.class)); assertTrue(types.contains(ExtendedBoolean.class)); From 674eac22b98f33ce589e66ecfe1f3053e31372c0 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 15 Dec 2023 12:33:54 +0200 Subject: [PATCH 2/2] Add SequencedCollection to BANNED_INTERFACE_TYPES This is done because this type exists in Java 21 but not Java 17. Fixes: #37768 --- .../processor/src/main/java/io/quarkus/arc/processor/Types.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java index 08e7688dc0f8b..1673865997502 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java @@ -79,7 +79,7 @@ public final class Types { // we ban these interfaces because of mismatch between building JDK version and target JDK version // TODO: add a extensible banning mechanism based on predicates if we find that this set needs to grow... - private static final Set BANNED_INTERFACE_TYPES = Collections.emptySet(); + private static final Set BANNED_INTERFACE_TYPES = Set.of(DotName.createSimple("java.util.SequencedCollection")); private Types() { }