From 75a417d7762c39f6d47d74b6080ef9c8b01d897d Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Thu, 2 Dec 2021 14:22:26 +0100 Subject: [PATCH] Specify that duplicate type discovery is non-portable This is because `ScannedClasses` may be implemented on top of Portable Extensions using `BeforeBeanDiscovery.addAnnotatedType`, which doesn't specify what happens when the same identifier is used multiple times, and doesn't provide a portable way to "override" the type that was discovered by the container. --- .../enterprise/inject/build/compatible/spi/ScannedClasses.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/ScannedClasses.java b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/ScannedClasses.java index daaca850..3a385b26 100644 --- a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/ScannedClasses.java +++ b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/ScannedClasses.java @@ -11,6 +11,9 @@ public interface ScannedClasses { /** * Adds a class with given name to the set of types discovered during type discovery. * The class will therefore be scanned during bean discovery. + *

+ * Adding the same class multiple times, or adding a class that is automatically discovered + * by the container, leads to non-portable behavior. * * @param className binary name of the class, as defined by The Java™ Language Specification; * in other words, the class name as returned by {@link Class#getName()}