From a31fe047d6f7e1fb0f284475f16ac0ab9c30b837 Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Tue, 18 Nov 2025 19:48:16 +0100 Subject: [PATCH 1/4] Update Weld API to bring in new CDI version, add TODO impls of newly added methods --- bom/pom.xml | 2 +- .../java/org/jboss/weld/bean/builtin/BeanManagerProxy.java | 5 +++++ .../jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java | 6 ++++++ .../events/configurator/BeanAttributesConfiguratorImpl.java | 6 ++++++ .../bootstrap/events/configurator/BeanConfiguratorImpl.java | 6 ++++++ .../main/java/org/jboss/weld/manager/BeanManagerImpl.java | 5 +++++ jboss-as/pom.xml | 2 +- jboss-tck-runner/pom.xml | 2 +- pom.xml | 4 ++-- .../jboss/weld/lite/extension/translator/BeanInfoImpl.java | 5 +++++ .../weld/lite/extension/translator/StereotypeInfoImpl.java | 5 +++++ .../lite/extension/translator/SyntheticBeanBuilderImpl.java | 5 +++++ 12 files changed, 48 insertions(+), 5 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index 6004d003196..cb1b96d5e13 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -30,7 +30,7 @@ - 7.0.Alpha2 + 7.0.Alpha3 3.2.8 1.7.0 https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/ diff --git a/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerProxy.java b/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerProxy.java index 30a44e88f5a..5f0ecbcd092 100644 --- a/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerProxy.java +++ b/impl/src/main/java/org/jboss/weld/bean/builtin/BeanManagerProxy.java @@ -204,6 +204,11 @@ public boolean isMatchingEvent(Type eventType, Set eventQualifiers, return delegate().isMatchingEvent(eventType, eventQualifiers, observedEventType, observedEventQualifiers); } + @Override + public T unwrapClientProxy(T reference) { + return delegate().unwrapClientProxy(reference); + } + @Override public Bean getPassivationCapableBean(BeanIdentifier identifier) { return delegate().getPassivationCapableBean(identifier); diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java index 5992d860c01..7734a92329e 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java @@ -68,6 +68,12 @@ public List> getAlternatives() { return builder.getAlternativeList(getReceiver()); } + @Override + public List> getReserves() { + throw new UnsupportedOperationException("Not yet implemented"); + + } + @Override public List> getInterceptors() { checkWithinObserverNotification(); diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java index ea890057f7c..a8a74b3ad05 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java @@ -219,6 +219,12 @@ public BeanAttributesConfigurator alternative(boolean alternative) { return this; } + // TODO + @Override + public BeanAttributesConfigurator reserve(boolean value) { + throw new UnsupportedOperationException("Not yet implemented"); + } + @Override public BeanAttributes complete() { return new ImmutableBeanAttributes(ImmutableSet.copyOf(stereotypes), isAlternative, name, diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java index b8b6c6894f2..bf02a3e9497 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java @@ -38,6 +38,7 @@ import jakarta.enterprise.inject.spi.InjectionPoint; import jakarta.enterprise.inject.spi.InjectionTarget; import jakarta.enterprise.inject.spi.PassivationCapable; +import jakarta.enterprise.inject.spi.configurator.BeanConfigurator; import jakarta.enterprise.util.TypeLiteral; import org.jboss.weld.bean.BeanIdentifiers; @@ -333,6 +334,11 @@ public WeldBeanConfigurator alternative(boolean alternative) { return this; } + @Override + public BeanConfigurator reserve(boolean value) { + throw new UnsupportedOperationException("Not yet implemented"); + } + public Bean complete() { if (createCallback == null) { // not callback specified, Weld does not know how to instantiate this new custom bean diff --git a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java index 27a520a6156..442894b9eda 100644 --- a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java +++ b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java @@ -1627,6 +1627,11 @@ public boolean isMatchingEvent(Type eventType, Set eventQualifiers, return false; } + @Override + public T unwrapClientProxy(T reference) { + throw new UnsupportedOperationException("Not yet implemented"); + } + private void validateQualifiers(Set qualifiers, String methodName) { for (Annotation qualifierCandidate : qualifiers) { if (!isQualifier(qualifierCandidate.annotationType())) { diff --git a/jboss-as/pom.xml b/jboss-as/pom.xml index f75c1e4ff03..269d4389bad 100644 --- a/jboss-as/pom.xml +++ b/jboss-as/pom.xml @@ -32,7 +32,7 @@ as the release plugin won't deal with double evaluation --> 7.0.0-SNAPSHOT - 5.0.0.Alpha1 + 5.0.0-M1 diff --git a/jboss-tck-runner/pom.xml b/jboss-tck-runner/pom.xml index d1bd559ab5e..dc811a68b46 100644 --- a/jboss-tck-runner/pom.xml +++ b/jboss-tck-runner/pom.xml @@ -8,7 +8,7 @@ 4.0.0 weld-jboss-runner-tck - CDI TCK runner (4.1) for Weld (WildFly) + CDI TCK runner for Weld (WildFly) Aggregates dependencies and runs the CDI TCK (both standalone and on WildFly) diff --git a/pom.xml b/pom.xml index 86c61b8e7dc..d8a2cb0b82c 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 1.2.3.Final 2.0.1 - 5.0.0.Alpha1 + 5.0.0-M1 11.0.1 @@ -91,7 +91,7 @@ 4.9.6.0 4.9.6 7.9.0 - 7.0.Alpha2 + 7.0.Alpha3 5.1.0.Final diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java index bd40912c73f..8460e68eb9c 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java @@ -104,6 +104,11 @@ public boolean isAlternative() { return cdiBean.isAlternative(); } + @Override + public boolean isReserve() { + throw new UnsupportedOperationException("Not yet implemented"); + } + @Override public Integer priority() { if (cdiDeclaration instanceof jakarta.enterprise.inject.spi.AnnotatedType diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java index 2a0fc8798d0..2831fb41af0 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java @@ -61,6 +61,11 @@ public boolean isAlternative() { return cdiDeclaration.isAnnotationPresent(Alternative.class); } + @Override + public boolean isReserve() { + throw new UnsupportedOperationException("Not yet implemented"); + } + @Override public Integer priority() { return cdiDeclaration.isAnnotationPresent(Priority.class) diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java index 11422a87e96..08088a9f7f9 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java @@ -80,6 +80,11 @@ public SyntheticBeanBuilder alternative(boolean isAlternative) { return this; } + @Override + public SyntheticBeanBuilder reserve(boolean isReserve) { + throw new UnsupportedOperationException("Not yet implemented"); + } + @Override public SyntheticBeanBuilder priority(int priority) { this.priority = priority; From ee9316c0eacd69375027d313f8574505a08e15ea Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Wed, 19 Nov 2025 12:46:51 +0100 Subject: [PATCH 2/4] WELD-2823 Implement BeanContainer#unwrapClientProxy --- .../java/org/jboss/weld/manager/BeanManagerImpl.java | 8 +++++++- .../main/java/org/jboss/weld/tck/ContextsImpl.java | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java index 442894b9eda..2d0ccbe477d 100644 --- a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java +++ b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java @@ -155,6 +155,7 @@ import org.jboss.weld.module.EjbSupport; import org.jboss.weld.module.ExpressionLanguageSupport; import org.jboss.weld.module.ObserverNotifierFactory; +import org.jboss.weld.proxy.WeldClientProxy; import org.jboss.weld.resolution.BeanTypeAssignabilityRules; import org.jboss.weld.resolution.DecoratorResolvableBuilder; import org.jboss.weld.resolution.EventTypeAssignabilityRules; @@ -1628,8 +1629,13 @@ public boolean isMatchingEvent(Type eventType, Set eventQualifiers, } @Override + @SuppressWarnings("unchecked") public T unwrapClientProxy(T reference) { - throw new UnsupportedOperationException("Not yet implemented"); + if (reference instanceof WeldClientProxy) { + return (T) ((WeldClientProxy) reference).getMetadata().getContextualInstance(); + } else { + return reference; + } } private void validateQualifiers(Set qualifiers, String methodName) { diff --git a/porting-package/src/main/java/org/jboss/weld/tck/ContextsImpl.java b/porting-package/src/main/java/org/jboss/weld/tck/ContextsImpl.java index 64b3bded837..aba218ee1ce 100644 --- a/porting-package/src/main/java/org/jboss/weld/tck/ContextsImpl.java +++ b/porting-package/src/main/java/org/jboss/weld/tck/ContextsImpl.java @@ -17,6 +17,7 @@ package org.jboss.weld.tck; import jakarta.enterprise.context.spi.Context; +import jakarta.enterprise.inject.Instance; import org.jboss.cdi.tck.spi.Contexts; import org.jboss.weld.Container; @@ -24,13 +25,22 @@ import org.jboss.weld.context.DependentContext; import org.jboss.weld.context.ManagedContext; import org.jboss.weld.context.RequestContext; +import org.jboss.weld.context.bound.BoundRequestContext; import org.jboss.weld.context.http.HttpRequestContext; +import org.jboss.weld.manager.BeanManagerImpl; import org.jboss.weld.util.ForwardingContext; public class ContextsImpl implements Contexts { public RequestContext getRequestContext() { - return Container.instance().deploymentManager().instance().select(HttpRequestContext.class).get(); + BeanManagerImpl beanManager = Container.instance().deploymentManager(); + // Active req. context impl will differ between running -Dincontainer (WFLY) and embedded tests + Instance httpReqContext = beanManager.instance().select(HttpRequestContext.class); + if (httpReqContext.isResolvable()) { + return httpReqContext.get(); + } else { + return beanManager.instance().select(BoundRequestContext.class).get(); + } } public void setActive(Context context) { From 1e00d4693b66efadb9e920ebbd12b30f5489cc93 Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Wed, 19 Nov 2025 19:45:16 +0100 Subject: [PATCH 3/4] WELD-2824 Implement the concept of reserves --- .../jboss/weld/bean/AbstractProducerBean.java | 20 ++- .../org/jboss/weld/bean/ProducerField.java | 2 +- .../org/jboss/weld/bean/ProducerMethod.java | 2 +- .../attributes/BeanAttributesFactory.java | 10 +- .../ExternalBeanAttributesFactory.java | 2 +- .../attributes/ImmutableBeanAttributes.java | 15 +- .../bean/builtin/AbstractBuiltInBean.java | 2 +- .../jboss/weld/bootstrap/BeanDeployer.java | 72 +++------- .../org/jboss/weld/bootstrap/Validator.java | 15 +- .../enablement/EnablementListView.java | 1 + .../enablement/GlobalEnablementBuilder.java | 46 ++++++- .../enablement/ModuleEnablement.java | 18 ++- .../events/AfterBeanDiscoveryImpl.java | 10 +- .../events/AfterTypeDiscoveryImpl.java | 3 +- .../BeanAttributesConfiguratorImpl.java | 8 +- .../configurator/BeanConfiguratorImpl.java | 5 +- .../jboss/weld/logging/MetadataLogger.java | 3 + .../jboss/weld/logging/ValidatorLogger.java | 9 ++ .../jboss/weld/manager/BeanManagerImpl.java | 2 +- .../metadata/cache/MergedStereotypes.java | 12 +- .../weld/metadata/cache/StereotypeModel.java | 18 +++ .../AbstractTypeSafeBeanResolver.java | 76 +++++++++-- .../main/java/org/jboss/weld/util/Beans.java | 128 ++++++++++++++++++ .../util/bean/ForwardingBeanAttributes.java | 5 + .../src/test/weld-embedded/arquillian.xml | 1 + .../priority/broken/BrokenBeanProducer.java | 20 +++ .../priority/broken/ClassBean.java | 11 ++ ...leStereotypeWithPriorityClassBeanTest.java | 31 +++++ ...tereotypeWithPriorityProducerBeanTest.java | 31 +++++ .../priority/broken/MyOtherStereotype.java | 13 ++ .../priority/broken/MyStereotype.java | 13 ++ .../extension/translator/BeanInfoImpl.java | 2 +- .../translator/LiteExtensionTranslator.java | 1 + .../translator/StereotypeInfoImpl.java | 3 +- .../translator/SyntheticBeanBuilderImpl.java | 4 +- 35 files changed, 518 insertions(+), 96 deletions(-) create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/BrokenBeanProducer.java create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/ClassBean.java create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityClassBeanTest.java create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityProducerBeanTest.java create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyOtherStereotype.java create mode 100644 tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyStereotype.java diff --git a/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java b/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java index 6abd7ed4268..f50ae330f00 100644 --- a/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java +++ b/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java @@ -36,6 +36,7 @@ import org.jboss.weld.bootstrap.api.ServiceRegistry; import org.jboss.weld.injection.CurrentInjectionPoint; import org.jboss.weld.logging.BeanLogger; +import org.jboss.weld.logging.BootstrapLogger; import org.jboss.weld.manager.BeanManagerImpl; import org.jboss.weld.serialization.spi.BeanIdentifier; import org.jboss.weld.util.Beans; @@ -225,9 +226,24 @@ public Integer getPriority() { return explicitPriority; } - // requires initialized getAnnotated() hence subclasses need to invoke this manually - protected void processExplicitPriority() { + /** + * Searches for {@code @Priority} annotation declared either directly on the producer or via its stereotypes. + *

+ * Requires initialized {@code getAnnotated()} hence subclasses need to invoke this manually. + */ + protected void processPriority() { Priority annotation = getAnnotated() == null ? null : getAnnotated().getAnnotation(Priority.class); this.explicitPriority = annotation == null ? null : annotation.value(); + + // no explicit priority, try searching through stereotypes + if (explicitPriority == null) { + Beans.AnnotationSearchResult annotationSearchResult = Beans.annotationSearch(getAnnotated()); + // multiple priorities within stereotypes are an error + if (annotationSearchResult.getPriorities().size() > 1) { + throw BootstrapLogger.LOG.multiplePriorityValuesDeclared(getAnnotated()); + } else if (annotationSearchResult.getPriorities().size() == 1) { + this.explicitPriority = annotationSearchResult.getPriorities().iterator().next(); + } + } } } diff --git a/impl/src/main/java/org/jboss/weld/bean/ProducerField.java b/impl/src/main/java/org/jboss/weld/bean/ProducerField.java index a3d51db5a74..dfdfe3b6fb5 100644 --- a/impl/src/main/java/org/jboss/weld/bean/ProducerField.java +++ b/impl/src/main/java/org/jboss/weld/bean/ProducerField.java @@ -96,7 +96,7 @@ public Bean getBean() { return ProducerField.this; } }); - processExplicitPriority(); + processPriority(); } @Override diff --git a/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java b/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java index 47c1366ab0b..2d7bd195e8a 100644 --- a/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java +++ b/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java @@ -97,7 +97,7 @@ public Bean getBean() { return ProducerMethod.this; } }); - processExplicitPriority(); + processPriority(); } @Override diff --git a/impl/src/main/java/org/jboss/weld/bean/attributes/BeanAttributesFactory.java b/impl/src/main/java/org/jboss/weld/bean/attributes/BeanAttributesFactory.java index df9a27986b4..78f11181fac 100644 --- a/impl/src/main/java/org/jboss/weld/bean/attributes/BeanAttributesFactory.java +++ b/impl/src/main/java/org/jboss/weld/bean/attributes/BeanAttributesFactory.java @@ -67,6 +67,7 @@ public static class BeanAttributesBuilder { private MergedStereotypes mergedStereotypes; private boolean alternative; + private boolean reserve; private String name; private Set qualifiers; private Set types; @@ -79,6 +80,7 @@ public BeanAttributesBuilder(EnhancedAnnotated annotated, Set types, this.annotated = annotated; initStereotypes(annotated, manager); initAlternative(annotated); + initReserve(annotated); initName(annotated); initQualifiers(annotated); initScope(annotated); @@ -97,6 +99,10 @@ protected void initAlternative(EnhancedAnnotated annotated) { this.alternative = Beans.isAlternative(annotated, mergedStereotypes); } + protected void initReserve(EnhancedAnnotated annotated) { + this.reserve = Beans.isReserve(annotated, mergedStereotypes); + } + /** * Initializes the name */ @@ -234,8 +240,8 @@ protected boolean initScopeFromStereotype() { } public BeanAttributes build() { - return new ImmutableBeanAttributes(mergedStereotypes.getStereotypes(), alternative, name, qualifiers, types, - scope); + return new ImmutableBeanAttributes(mergedStereotypes.getStereotypes(), alternative, reserve, name, + qualifiers, types, scope); } } } diff --git a/impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java b/impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java index b79894a42f9..cd049a3c2ce 100644 --- a/impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java +++ b/impl/src/main/java/org/jboss/weld/bean/attributes/ExternalBeanAttributesFactory.java @@ -52,7 +52,7 @@ private ExternalBeanAttributesFactory() { public static BeanAttributes of(BeanAttributes source, BeanManager manager) { validateBeanAttributes(source, manager); BeanAttributes attributes = new ImmutableBeanAttributes(defensiveCopy(source.getStereotypes()), - source.isAlternative(), source.getName(), + source.isAlternative(), source.isReserve(), source.getName(), defensiveCopy(source.getQualifiers()), defensiveCopy(source.getTypes()), source.getScope()); return attributes; } diff --git a/impl/src/main/java/org/jboss/weld/bean/attributes/ImmutableBeanAttributes.java b/impl/src/main/java/org/jboss/weld/bean/attributes/ImmutableBeanAttributes.java index 7a49c9030ca..651e93206cf 100644 --- a/impl/src/main/java/org/jboss/weld/bean/attributes/ImmutableBeanAttributes.java +++ b/impl/src/main/java/org/jboss/weld/bean/attributes/ImmutableBeanAttributes.java @@ -35,16 +35,17 @@ public class ImmutableBeanAttributes implements BeanAttributes { private final Set> stereotypes; private final boolean alternative; + private final boolean reserve; private final String name; private final Set qualifiers; private final Set types; private final Class scope; - public ImmutableBeanAttributes(Set> stereotypes, boolean alternative, String name, - Set qualifiers, Set types, - Class scope) { + public ImmutableBeanAttributes(Set> stereotypes, boolean alternative, boolean reserve, + String name, Set qualifiers, Set types, Class scope) { this.stereotypes = stereotypes; this.alternative = alternative; + this.reserve = reserve; this.name = name; this.qualifiers = qualifiers; this.types = types; @@ -55,7 +56,8 @@ public ImmutableBeanAttributes(Set> stereotypes, boo * Utility constructor used for overriding Bean qualifiers and name for specialization purposes. */ public ImmutableBeanAttributes(Set qualifiers, String name, BeanAttributes attributes) { - this(attributes.getStereotypes(), attributes.isAlternative(), name, qualifiers, attributes.getTypes(), + this(attributes.getStereotypes(), attributes.isAlternative(), attributes.isReserve(), name, qualifiers, + attributes.getTypes(), attributes.getScope()); } @@ -69,6 +71,11 @@ public boolean isAlternative() { return alternative; } + @Override + public boolean isReserve() { + return reserve; + } + @Override public String getName() { return name; diff --git a/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java b/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java index af0e9a97dcb..b53a7a8ee23 100644 --- a/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java +++ b/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractBuiltInBean.java @@ -98,7 +98,7 @@ public boolean isDependentContextOptimizationAllowed() { protected static class BuiltInBeanAttributes extends ImmutableBeanAttributes { public BuiltInBeanAttributes(Class type) { - super(Collections.> emptySet(), false, null, Bindings.DEFAULT_QUALIFIERS, + super(Collections.> emptySet(), false, false, null, Bindings.DEFAULT_QUALIFIERS, ImmutableSet.of(Object.class, type), Dependent.class); } } diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java b/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java index 767ec6227d2..7216fd6eb3d 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java @@ -22,9 +22,8 @@ import java.util.List; import java.util.Set; -import jakarta.annotation.Priority; import jakarta.decorator.Decorator; -import jakarta.enterprise.inject.Stereotype; +import jakarta.enterprise.inject.Reserve; import jakarta.enterprise.inject.spi.AnnotatedType; import jakarta.enterprise.inject.spi.Bean; import jakarta.enterprise.inject.spi.Extension; @@ -100,64 +99,21 @@ private SlimAnnotatedTypeContext addIfNotNull(SlimAnnotatedTypeContext return ctx; } - /** - * Attempts to find a {@code @Priority} annotation declared on a stereotype(s) of given {@code AnnotatedType}. - * Returns the value in this annotation, or {@code null} if none was found. - * - * If the {@code AnnotatedType} declares more than one stereotype and at least two of them declare different - * {@code @Priority} values, a definition exception is thrown. - * - * If there are multiple {@code @Priority} values in a hierarchy of single stereotype, first annotation value is - * used. - * - * @param type AnnotatedType to be searched - * @return an Integer representing the priority value, null if none was found - */ - private Integer findPriorityInStereotypes(AnnotatedType type) { - // search all annotations - Set foundPriorities = new HashSet<>(); - for (Annotation annotation : type.getAnnotations()) { - // identify stereotypes - Class annotationClass = annotation.annotationType(); - if (annotationClass.getAnnotation(Stereotype.class) != null) { - recursiveStereotypeSearch(annotationClass, foundPriorities); - } - } - // more than one value found, throw exception - if (foundPriorities.size() > 1) { - throw BootstrapLogger.LOG.multiplePriorityValuesDeclared(type); - } - // no priority found - if (foundPriorities.isEmpty()) { - return null; - } - // exactly one value found - return foundPriorities.iterator().next(); - } - - private void recursiveStereotypeSearch(Class stereotype, Set foundPriorities) { - // search each stereotype for priority annotation, store all values found - Priority priorityAnnotation = stereotype.getAnnotation(Priority.class); - if (priorityAnnotation != null) { - // if found, store the value - foundPriorities.add(priorityAnnotation.value()); - } - // perform a recursive search for more stereotypes - for (Annotation annotation : stereotype.getAnnotations()) { - Class annotationClass = annotation.annotationType(); - if (annotationClass.getAnnotation(Stereotype.class) != null) { - recursiveStereotypeSearch(annotationClass, foundPriorities); - } - } - } - private void processPriority(AnnotatedType type) { // check if @Priority is declared directly on the AnnotatedType Object priority = type.getAnnotation(annotationApi.PRIORITY_ANNOTATION_CLASS); - Integer value; + Integer value = null; + // search stereotypes for priority/alternative/reserve annotations + Beans.AnnotationSearchResult annSearchResult = Beans.annotationSearch(type); if (priority == null) { - // if not declared, search in any stereotypes of given AnnotatedType - value = findPriorityInStereotypes(type); + Set priorities = annSearchResult.getPriorities(); + // more than one value found and no priority on the class itself, throw an exception + if (priorities.size() > 1) { + throw BootstrapLogger.LOG.multiplePriorityValuesDeclared(type); + } else if (priorities.size() == 1) { + // exactly one value, we can use that + value = priorities.iterator().next(); + } } else { value = annotationApi.getPriority(priority); } @@ -168,6 +124,10 @@ private void processPriority(AnnotatedType type) { } else if (type.isAnnotationPresent(Decorator.class)) { globalEnablementBuilder.addDecorator(type.getJavaClass(), value); } else { + // Validation of a bean being both reserve and alternative happens in Validator for now, possibly register both + if (type.isAnnotationPresent(Reserve.class) || annSearchResult.getReserve() != null) { + globalEnablementBuilder.addReserve(type.getJavaClass(), value); + } /* * An alternative may be given a priority for the application by placing the @Priority annotation on the bean * class that declares the producer method, field or resource. diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java b/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java index 2fb3c3194f9..7ec25360f49 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java @@ -167,6 +167,11 @@ protected void validateGeneralBean(Bean bean, BeanManagerImpl beanManager) { if (beanManager.isPassivatingScope(bean.getScope()) && !Beans.isPassivationCapableBean(bean)) { throw ValidatorLogger.LOG.beanWithPassivatingScopeNotPassivationCapable(bean); } + + // a bean cannot be an alternative and a reserve at the same time + if (bean.isAlternative() && bean.isReserve()) { + throw ValidatorLogger.LOG.beanReserveAndAlternative(bean); + } } /** @@ -189,12 +194,12 @@ protected void validateRIBean(CommonBean bean, BeanManagerImpl beanManager, C validateInterceptors(beanManager, classBean); } } - // for each producer bean validate its disposer method if (bean instanceof AbstractProducerBean) { AbstractProducerBean producerBean = Reflections.> cast(bean); if (producerBean.getProducer() instanceof AbstractMemberProducer) { AbstractMemberProducer producer = Reflections.> cast(producerBean .getProducer()); + // for each producer bean validate its disposer method if (producer.getDisposalMethod() != null) { for (InjectionPoint ip : producer.getDisposalMethod().getInjectionPoints()) { // pass the producer bean instead of the disposal method bean @@ -204,6 +209,14 @@ protected void validateRIBean(CommonBean bean, BeanManagerImpl beanManager, C validateInjectionPointForDeploymentProblems(ip, null, beanManager); } } + // if it's an alternative, declaring bean cannot be a reserve + if (producerBean.isAlternative() && producerBean.getDeclaringBean().isReserve()) { + throw ValidatorLogger.LOG.producedAlternativeOnReserveDeclaringBean(producerBean); + } + // if it's a reserve, declaring bean cannot be alternative + if (producerBean.isReserve() && producerBean.getDeclaringBean().isAlternative()) { + throw ValidatorLogger.LOG.producedReserveOnAlternativeDeclaringBean(producerBean); + } } } } diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/EnablementListView.java b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/EnablementListView.java index 51c2d03cda1..66dc7723866 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/EnablementListView.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/EnablementListView.java @@ -269,6 +269,7 @@ public void remove() { enum ViewType { ALTERNATIVES("getAlternatives()"), + RESERVES("getReserves()"), INTERCEPTORS("getInterceptors()"), DECORATORS("getDecorators()"); diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java index 7a139621d72..fb9712abf52 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java @@ -56,10 +56,12 @@ public class GlobalEnablementBuilder extends AbstractBootstrapService { private final List alternatives = Collections.synchronizedList(new ArrayList()); + private final List reserves = Collections.synchronizedList(new ArrayList()); private final List interceptors = Collections.synchronizedList(new ArrayList()); private final List decorators = Collections.synchronizedList(new ArrayList()); private volatile Map, Integer> cachedAlternativeMap; + private volatile Map, Integer> cachedReserveMap; private volatile boolean sorted; private volatile boolean dirty; @@ -83,6 +85,10 @@ public void addAlternative(Class javaClass, int priority) { addItem(alternatives, javaClass, priority); } + public void addReserve(Class javaClass, int priority) { + addItem(reserves, javaClass, priority); + } + public void addInterceptor(Class javaClass, int priority) { addItem(interceptors, javaClass, priority); } @@ -112,6 +118,27 @@ protected List getDelegate() { }; } + public List> getReserveList(final Extension extension) { + initialize(); + return new EnablementListView() { + + @Override + protected Extension getExtension() { + return extension; + } + + @Override + protected ViewType getViewType() { + return ViewType.RESERVES; + } + + @Override + protected List getDelegate() { + return reserves; + } + }; + } + public List> getInterceptorList(final Extension extension) { initialize(); return new EnablementListView() { @@ -180,9 +207,21 @@ private Map, Integer> getGlobalAlternativeMap() { return cachedAlternativeMap; } + private Map, Integer> getGlobalReserveMap() { + if (cachedReserveMap == null || dirty) { + Map, Integer> map = new HashMap, Integer>(); + for (Item item : reserves) { + map.put(item.getJavaClass(), item.getPriority()); + } + cachedReserveMap = ImmutableMap.copyOf(map); + } + return cachedReserveMap; + } + private void initialize() { if (!sorted) { Collections.sort(alternatives); + Collections.sort(reserves); Collections.sort(interceptors); Collections.sort(decorators); sorted = true; @@ -236,11 +275,13 @@ public ModuleEnablement createModuleEnablement(BeanDeployment deployment) { } Map, Integer> globalAlternatives = getGlobalAlternativeMap(); + Map, Integer> globalReserves = getGlobalReserveMap(); // We suppose that enablements are always created all at once dirty = false; return new ModuleEnablement(moduleInterceptorsBuilder.build(), moduleDecoratorsBuilder.build(), globalAlternatives, + globalReserves, alternativeClasses, alternativeStereotypes); } @@ -248,14 +289,15 @@ public ModuleEnablement createModuleEnablement(BeanDeployment deployment) { @Override public void cleanupAfterBoot() { alternatives.clear(); + reserves.clear(); interceptors.clear(); decorators.clear(); } @Override public String toString() { - return "GlobalEnablementBuilder [alternatives=" + alternatives + ", interceptors=" + interceptors + ", decorators=" - + decorators + "]"; + return "GlobalEnablementBuilder [alternatives=" + alternatives + ", reserves=" + reserves + ", interceptors=" + + interceptors + ", decorators=" + decorators + "]"; } private void checkForDuplicates(List> list, MessageCallback messageCallback) { diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/ModuleEnablement.java b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/ModuleEnablement.java index 0149f3107cb..e5cc18272e2 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/enablement/ModuleEnablement.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/enablement/ModuleEnablement.java @@ -42,7 +42,8 @@ public class ModuleEnablement { public static final ModuleEnablement EMPTY_ENABLEMENT = new ModuleEnablement(Collections.> emptyList(), - Collections.> emptyList(), Collections., Integer> emptyMap(), Collections.> emptySet(), + Collections.> emptyList(), Collections., Integer> emptyMap(), + Collections., Integer> emptyMap(), Collections.> emptySet(), Collections.> emptySet()); private final List> interceptors; @@ -51,6 +52,7 @@ Collections.> emptyList(), Collections., Integer> emptyMap(), private final Map, Integer> interceptorMap; private final Map, Integer> decoratorMap; private final Map, Integer> globalAlternatives; + private final Map, Integer> globalReserves; private final Set> localAlternativeClasses; private final Set> localAlternativeStereotypes; @@ -59,7 +61,8 @@ Collections.> emptyList(), Collections., Integer> emptyMap(), private final Comparator> interceptorComparator; public ModuleEnablement(List> interceptors, List> decorators, Map, Integer> globalAlternatives, - Set> localAlternativeClasses, Set> localAlternativeStereotypes) { + Map, Integer> globalReserves, Set> localAlternativeClasses, + Set> localAlternativeStereotypes) { this.interceptors = interceptors; this.decorators = decorators; @@ -70,6 +73,7 @@ public ModuleEnablement(List> interceptors, List> decorators, this.interceptorComparator = new EnablementComparator>(interceptorMap); this.globalAlternatives = globalAlternatives; + this.globalReserves = globalReserves; this.localAlternativeClasses = localAlternativeClasses; this.localAlternativeStereotypes = localAlternativeStereotypes; @@ -114,10 +118,18 @@ public Integer getAlternativePriority(Class javaClass) { return globalAlternatives.get(javaClass); } + public Integer getReservePriority(Class javaClass) { + return globalReserves.get(javaClass); + } + public boolean isEnabledAlternativeClass(Class alternativeClass) { return globalAlternatives.containsKey(alternativeClass) || localAlternativeClasses.contains(alternativeClass); } + public boolean isEnabledReserveClass(Class reserveClass) { + return globalReserves.containsKey(reserveClass); + } + public boolean isEnabledAlternativeStereotype(Class alternativeClass) { return globalAlternatives.containsKey(alternativeClass) || localAlternativeStereotypes.contains(alternativeClass); } @@ -158,6 +170,6 @@ public int compare(T o1, T o2) { @Override public String toString() { return "ModuleEnablement [interceptors=" + interceptors + ", decorators=" + decorators + ", alternatives=" - + getAllAlternatives() + "]"; + + getAllAlternatives() + ", reserves=" + globalReserves.keySet() + "]"; } } diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java index 61a74657af9..71747c62bea 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java @@ -232,8 +232,14 @@ private void processBeanRegistration(BeanRegistration registration, GlobalEn } } else { beanManager.addBean(bean); - if (priority != null && bean.isAlternative()) { - globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority); + if (priority != null) { + // validation of bean being both, alternative and reserve happens during validation + if (bean.isAlternative()) { + globalEnablementBuilder.addAlternative(bean.getBeanClass(), priority); + } + if (bean.isReserve()) { + globalEnablementBuilder.addReserve(bean.getBeanClass(), priority); + } } } containerLifecycleEvents.fireProcessBean(beanManager, bean, registration.extension); diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java index 7734a92329e..7ecbb530e77 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterTypeDiscoveryImpl.java @@ -70,7 +70,8 @@ public List> getAlternatives() { @Override public List> getReserves() { - throw new UnsupportedOperationException("Not yet implemented"); + checkWithinObserverNotification(); + return builder.getReserveList(getReceiver()); } diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java index a8a74b3ad05..7b891d40596 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanAttributesConfiguratorImpl.java @@ -65,6 +65,8 @@ public class BeanAttributesConfiguratorImpl implements BeanAttributesConfigur private boolean isAlternative; + private boolean isReserve; + public BeanAttributesConfiguratorImpl(BeanManagerImpl beanManager) { this.beanManager = beanManager; this.qualifiers = new HashSet(); @@ -219,15 +221,15 @@ public BeanAttributesConfigurator alternative(boolean alternative) { return this; } - // TODO @Override public BeanAttributesConfigurator reserve(boolean value) { - throw new UnsupportedOperationException("Not yet implemented"); + this.isReserve = value; + return this; } @Override public BeanAttributes complete() { - return new ImmutableBeanAttributes(ImmutableSet.copyOf(stereotypes), isAlternative, name, + return new ImmutableBeanAttributes(ImmutableSet.copyOf(stereotypes), isAlternative, isReserve, name, Bindings.normalizeBeanQualifiers(qualifiers), ImmutableSet.copyOf(types), initScope()); diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java index bf02a3e9497..1c5a4bac1f6 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/configurator/BeanConfiguratorImpl.java @@ -336,12 +336,13 @@ public WeldBeanConfigurator alternative(boolean alternative) { @Override public BeanConfigurator reserve(boolean value) { - throw new UnsupportedOperationException("Not yet implemented"); + this.attributes.reserve(value); + return this; } public Bean complete() { if (createCallback == null) { - // not callback specified, Weld does not know how to instantiate this new custom bean + // no callback specified, Weld does not know how to instantiate this new custom bean throw BeanLogger.LOG.noCallbackSpecifiedForCustomBean("bean [" + beanClass.toString() + ", with types: " + Formats.formatTypes(attributes.types) + ", and qualifiers: " + Formats.formatAnnotations(attributes.qualifiers) + "]"); diff --git a/impl/src/main/java/org/jboss/weld/logging/MetadataLogger.java b/impl/src/main/java/org/jboss/weld/logging/MetadataLogger.java index bc6f52b6d00..550ef9596a5 100644 --- a/impl/src/main/java/org/jboss/weld/logging/MetadataLogger.java +++ b/impl/src/main/java/org/jboss/weld/logging/MetadataLogger.java @@ -126,4 +126,7 @@ void notInHierarchy(Object memberName, Object member, Object annotatedTypeJavaCl @Message(id = 1126, value = "BeanAttributesConfigurator is not able to read {0} - missing BeanManager", format = Format.MESSAGE_FORMAT) IllegalStateException beanAttributesConfiguratorCannotReadAnnotatedType(Object type); + @Message(id = 1127, value = "Stereotype {0} cannot declare @Alternative and @Reserve at the same time", format = Format.MESSAGE_FORMAT) + DefinitionException alternativeAndReserveSimultaneously(Object param1); + } \ No newline at end of file diff --git a/impl/src/main/java/org/jboss/weld/logging/ValidatorLogger.java b/impl/src/main/java/org/jboss/weld/logging/ValidatorLogger.java index debc56672c0..9846d63b527 100644 --- a/impl/src/main/java/org/jboss/weld/logging/ValidatorLogger.java +++ b/impl/src/main/java/org/jboss/weld/logging/ValidatorLogger.java @@ -324,4 +324,13 @@ DefinitionException interceptorMethodDeclaresMultipleParameters(Object param1, O @Message(id = 1491, value = "An interceptor {0} cannot have more than one method per interception type. Following methods were found for interception type {1}: {2}.", format = Format.MESSAGE_FORMAT) DefinitionException interceptorsCannotHaveMoreThanOneMethodPerType(Class interceptorClass, String interceptionType, Collection interceptionMethods); + + @Message(id = 1492, value = "A {0} cannot be @Reserve and @Alternative at the same time. Note that apart from explicit annotations, beans may inherit these properties from their stereotypes too.", format = Format.MESSAGE_FORMAT) + DefinitionException beanReserveAndAlternative(Object bean); + + @Message(id = 1493, value = "A @Reserve {0} cannot be produced by an @Alternative bean.", format = Format.MESSAGE_FORMAT) + DefinitionException producedReserveOnAlternativeDeclaringBean(Object bean); + + @Message(id = 1494, value = "An @Alternative {0} cannot be produced by a @Reserve bean.", format = Format.MESSAGE_FORMAT) + DefinitionException producedAlternativeOnReserveDeclaringBean(Object bean); } diff --git a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java index 2d0ccbe477d..34998196089 100644 --- a/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java +++ b/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java @@ -1188,7 +1188,7 @@ public Bean resolve(Set> beans) { Set> resolvedBeans = beanResolver.resolve(beans); if (resolvedBeans.size() == 1) { return resolvedBeans.iterator().next(); - } else if (resolvedBeans.size() == 0) { + } else if (resolvedBeans.isEmpty()) { return null; } else { throw BeanManagerLogger.LOG.ambiguousBeansForDependency(WeldCollections.toMultiRowString(beans)); diff --git a/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java b/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java index 859f11f25d1..720b5d95657 100644 --- a/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java +++ b/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java @@ -39,6 +39,8 @@ public class MergedStereotypes { private boolean beanNameDefaulted; // Are any of the stereotypes alternatives private boolean alternative; + // Are any of the stereotypes reserves + private boolean reserve; private Set> stereotypes; @@ -81,6 +83,9 @@ protected void merge(Set stereotypeAnnotations) { if (stereotype.isAlternative()) { alternative = true; } + if (stereotype.isReserve()) { + reserve = true; + } if (stereotype.getDefaultScopeType() != null) { possibleScopeTypes.add(stereotype.getDefaultScopeType()); } @@ -97,6 +102,10 @@ public boolean isAlternative() { return alternative; } + public boolean isReserve() { + return reserve; + } + /** * Returns the possible scope types * @@ -130,7 +139,8 @@ public Set> getStereotypes() { @Override public String toString() { return "Merged stereotype model; Any of the stereotypes is an alternative: " + - alternative + "; possible scopes " + possibleScopeTypes; + alternative + "; Any of the stereotypes is a reserve: " + + reserve + "; possible scopes " + possibleScopeTypes; } } diff --git a/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java b/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java index d2f4947c406..a377b98c838 100644 --- a/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java +++ b/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java @@ -29,6 +29,7 @@ import jakarta.enterprise.context.NormalScope; import jakarta.enterprise.inject.Alternative; +import jakarta.enterprise.inject.Reserve; import jakarta.enterprise.inject.Stereotype; import jakarta.inject.Named; import jakarta.inject.Qualifier; @@ -52,6 +53,8 @@ public class StereotypeModel extends AnnotationModel { // Is the stereotype an alternative private boolean alternative; + // Is the stereotype a reserve + private boolean reserve; // The default scope type private Annotation defaultScopeType; // Is the bean name defaulted @@ -75,6 +78,11 @@ protected void init(EnhancedAnnotation annotatedAnnotation) { super.init(annotatedAnnotation); if (valid) { initAlternative(annotatedAnnotation); + initReserve(annotatedAnnotation); + if (isAlternative() && isReserve()) { + // stereotype cannot declare @Alternative and @Reserve at the same time + throw MetadataLogger.LOG.alternativeAndReserveSimultaneously(annotatedAnnotation); + } initDefaultScopeType(annotatedAnnotation); initBeanNameDefaulted(annotatedAnnotation); initInterceptorBindings(annotatedAnnotation); @@ -144,6 +152,12 @@ private void initAlternative(EnhancedAnnotation annotatedAnnotation) { } } + private void initReserve(EnhancedAnnotation annotatedAnnotation) { + if (annotatedAnnotation.isAnnotationPresent(Reserve.class)) { + this.reserve = true; + } + } + @Override protected void check(EnhancedAnnotation annotatedAnnotation) { super.check(annotatedAnnotation); @@ -209,6 +223,10 @@ public boolean isAlternative() { return alternative; } + public boolean isReserve() { + return reserve; + } + public Set getInheritedStereotypes() { return inheritedStereotypes; } diff --git a/impl/src/main/java/org/jboss/weld/resolution/AbstractTypeSafeBeanResolver.java b/impl/src/main/java/org/jboss/weld/resolution/AbstractTypeSafeBeanResolver.java index 02cd62d9b40..2dfd8fdc281 100644 --- a/impl/src/main/java/org/jboss/weld/resolution/AbstractTypeSafeBeanResolver.java +++ b/impl/src/main/java/org/jboss/weld/resolution/AbstractTypeSafeBeanResolver.java @@ -73,23 +73,40 @@ private BeanDisambiguation() { @Override public Set> apply(Set> from) { if (from.size() > 1) { - ImmutableSet.Builder> allBeans = ImmutableSet.builder(); + ImmutableSet.Builder> allBeansBuilder = ImmutableSet.builder(); // beans that are themselves alternatives or their defining bean is an alternative Set> priorityBeans = new HashSet>(); + // beans that are enabled reserves + Set> reserveBeans = new HashSet>(); + // beans that are neither reserves nor alternatives + Set> standardBeans = new HashSet>(); for (Bean bean : from) { - if (bean.isAlternative()) { + if (isBeanAlternative(bean)) { + // alternatives requires special check to account for declaring bean of producer being + // an alternative priorityBeans.add(bean); - } else if (bean instanceof AbstractProducerBean) { - AbstractProducerBean producer = (AbstractProducerBean) bean; - if (producer.getDeclaringBean().isAlternative()) { - priorityBeans.add(bean); - } + } else if (bean.isReserve()) { + reserveBeans.add(bean); + } else { + standardBeans.add(bean); } - allBeans.add(bean); + allBeansBuilder.add(bean); } if (priorityBeans.isEmpty()) { - return allBeans.build(); + Set> allBeans = allBeansBuilder.build(); + if (reserveBeans.size() == allBeans.size()) { + // all beans are reserves, we need to disambiguate them + return resolveReserves(reserveBeans); + } else { + // remaining beans are standard beans plus reserves + // if there is exactly one non-reserve bean, return it, otherwise return all + if (standardBeans.size() == 1) { + return Collections.> singleton(standardBeans.iterator().next()); + } else { + return allBeans; + } + } } else { if (priorityBeans.size() == 1) { return Collections.> singleton(priorityBeans.iterator().next()); @@ -102,6 +119,16 @@ public Set> apply(Set> from) { } } + private boolean isBeanAlternative(Bean bean) { + if (bean.isAlternative()) { + return true; + } + if (bean instanceof AbstractProducerBean producer) { + return producer.getDeclaringBean().isAlternative(); + } + return false; + } + /** * If all the beans left are alternatives with a priority, then the container will select the * alternative with the highest priority, and the ambiguous dependency is called resolvable. @@ -139,6 +166,37 @@ public Set> resolveAlternatives(Set> alternatives) { } + /** + * Otherwise, if there is no bean remaining and all candidate beans are reserves, then: + * - The container determines the highest priority value and eliminates all candidate beans except for reserves with the + * highest priority value. + * - If there is exactly one bean remaining, the container selects this bean, and the ambiguous dependency is called + * resolvable. + * - Otherwise, the ambiguous dependency is unresolvable. + */ + public Set> resolveReserves(Set> reserves) { + int highestPriority = Integer.MIN_VALUE; + Set> selectedReservesWithHighestPriority = new HashSet>(); + for (Bean bean : reserves) { + Integer priority; + if (bean instanceof AbstractProducerBean) { + // first check for explicit priority declaration on producers + priority = ((AbstractProducerBean) bean).getPriority(); + } else { + priority = beanManager.getEnabled().getReservePriority(bean.getBeanClass()); + } + if (priority > highestPriority) { + highestPriority = priority; + selectedReservesWithHighestPriority.clear(); + } + if (priority == highestPriority) { + selectedReservesWithHighestPriority.add(bean); + } + } + return ImmutableSet.copyOf(selectedReservesWithHighestPriority); + + } + public AbstractTypeSafeBeanResolver(BeanManagerImpl beanManager, final Iterable beans) { super(beans, beanManager.getServices().get(WeldConfiguration.class)); this.beanManager = beanManager; diff --git a/impl/src/main/java/org/jboss/weld/util/Beans.java b/impl/src/main/java/org/jboss/weld/util/Beans.java index ca97cc0a126..b2537adf169 100644 --- a/impl/src/main/java/org/jboss/weld/util/Beans.java +++ b/impl/src/main/java/org/jboss/weld/util/Beans.java @@ -36,6 +36,7 @@ import java.util.Map; import java.util.Set; +import jakarta.annotation.Priority; import jakarta.decorator.Decorator; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ConversationScoped; @@ -50,8 +51,11 @@ import jakarta.enterprise.inject.Alternative; import jakarta.enterprise.inject.CreationException; import jakarta.enterprise.inject.Disposes; +import jakarta.enterprise.inject.Reserve; +import jakarta.enterprise.inject.Stereotype; import jakarta.enterprise.inject.Typed; import jakarta.enterprise.inject.Vetoed; +import jakarta.enterprise.inject.spi.Annotated; import jakarta.enterprise.inject.spi.AnnotatedConstructor; import jakarta.enterprise.inject.spi.AnnotatedMethod; import jakarta.enterprise.inject.spi.AnnotatedType; @@ -67,6 +71,7 @@ import org.jboss.weld.annotated.enhanced.EnhancedAnnotatedMethod; import org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType; import org.jboss.weld.bean.AbstractBean; +import org.jboss.weld.bean.AbstractClassBean; import org.jboss.weld.bean.AbstractProducerBean; import org.jboss.weld.bean.DecoratorImpl; import org.jboss.weld.bean.ForwardingBean; @@ -254,6 +259,23 @@ public static boolean isBeanEnabled(Bean bean, ModuleEnablement enabled) { isEnabled = true; } return isEnabled; + } else if (bean.isReserve()) { + boolean isEnabled = false; + if (bean instanceof AbstractClassBean) { + // for class beans, look at the global enablement + isEnabled = enabled.isEnabledReserveClass(bean.getBeanClass()); + } else if (bean instanceof AbstractProducerBean + && ((AbstractProducerBean) bean).getPriority() != null) { + // for producers, look at their priority + isEnabled = true; + } + // For synthetic enabled reserves, the ModuleEnablement may not yet be aware of them + if (!isEnabled + && ((bean instanceof WeldBean && ((WeldBean) bean).getPriority() != null) + || bean instanceof Prioritized)) { + isEnabled = true; + } + return isEnabled; } else if (bean instanceof AbstractProducerBean) { AbstractProducerBean receiverBean = (AbstractProducerBean) bean; return isBeanEnabled(receiverBean.getDeclaringBean(), enabled); @@ -277,6 +299,17 @@ public static boolean isAlternative(EnhancedAnnotated annotated, MergedSte return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative(); } + /** + * Is reserve. + * + * @param annotated the annotated + * @param mergedStereotypes merged stereotypes + * @return true if reserve, false otherwise + */ + public static boolean isReserve(EnhancedAnnotated annotated, MergedStereotypes mergedStereotypes) { + return annotated.isAnnotationPresent(Reserve.class) || mergedStereotypes.isReserve(); + } + public static EnhancedAnnotatedConstructor getBeanConstructorStrict(EnhancedAnnotatedType type) { EnhancedAnnotatedConstructor constructor = getBeanConstructor(type); if (constructor == null) { @@ -719,4 +752,99 @@ private static BeanIdentifier getIdentifier(Contextual contextual, Contextual return contextualStore.putIfAbsent(contextual); } + /** + * Attempts to find {@link Priority}, {@link Alternative} and {@link Reserve} annotations declared on a stereotype(s) of + * given {@code Annotated}. + * Returns a helper object ({@link AnnotationSearchResult}) holding all of that information, note that parts of this object + * may be null. + *

+ * Method does not throw if multiple priorities are found, just returns a collection of all found. + *

+ * If there are more stereotypes that declare {@link Alternative} or {@link Reserve}, this method just stores the first + * found. + * + * @param type Annotated to be searched + * @return an {@link AnnotationSearchResult} holding all the information; some parts of it may be null indicating no such + * information was found + */ + public static AnnotationSearchResult annotationSearch(Annotated type) { + AnnotationSearchResult annotationSearchResult = new AnnotationSearchResult(); + + for (Annotation annotation : type.getAnnotations()) { + // identify stereotypes + Class annotationClass = annotation.annotationType(); + if (annotationClass.getAnnotation(Stereotype.class) != null) { + recursiveStereotypeSearch(annotationClass, annotationSearchResult); + } + } + return annotationSearchResult; + } + + private static void recursiveStereotypeSearch(Class stereotype, + AnnotationSearchResult annotationSearchResult) { + // search each stereotype for priority/alternative/reserve annotation + Priority priorityAnnotation = stereotype.getAnnotation(Priority.class); + if (priorityAnnotation != null) { + annotationSearchResult.addPriority(priorityAnnotation.value()); + } + Reserve reserve = stereotype.getAnnotation(Reserve.class); + if (reserve != null) { + annotationSearchResult.setReserve(reserve.annotationType()); + } + Alternative alternative = stereotype.getAnnotation(Alternative.class); + if (alternative != null) { + annotationSearchResult.setAlternative(alternative.annotationType()); + } + // perform a recursive search for more stereotypes + for (Annotation annotation : stereotype.getAnnotations()) { + Class annotationClass = annotation.annotationType(); + if (annotationClass.getAnnotation(Stereotype.class) != null) { + recursiveStereotypeSearch(annotationClass, annotationSearchResult); + } + } + } + + /** + * Holds information about priorities found in stereotypes as well as whether there the type is alternative/reserve + */ + public static class AnnotationSearchResult { + private Class reserve; + private Class alternative; + private final Set priorities; + + private AnnotationSearchResult() { + this.reserve = null; + this.alternative = null; + this.priorities = new HashSet<>(); + } + + public Class getReserve() { + return reserve; + } + + public Class getAlternative() { + return alternative; + } + + public Set getPriorities() { + return priorities; + } + + public void addPriority(Integer priority) { + this.priorities.add(priority); + } + + public void setAlternative(Class alternative) { + if (this.alternative == null) { + this.alternative = alternative; + } + } + + public void setReserve(Class reserve) { + if (this.reserve == null) { + this.reserve = reserve; + } + } + } + } diff --git a/impl/src/main/java/org/jboss/weld/util/bean/ForwardingBeanAttributes.java b/impl/src/main/java/org/jboss/weld/util/bean/ForwardingBeanAttributes.java index ec28e2c8535..96e656157c2 100644 --- a/impl/src/main/java/org/jboss/weld/util/bean/ForwardingBeanAttributes.java +++ b/impl/src/main/java/org/jboss/weld/util/bean/ForwardingBeanAttributes.java @@ -65,6 +65,11 @@ public boolean isAlternative() { return attributes().isAlternative(); } + @Override + public boolean isReserve() { + return attributes().isReserve(); + } + @Override public int hashCode() { return attributes().hashCode(); diff --git a/jboss-tck-runner/src/test/weld-embedded/arquillian.xml b/jboss-tck-runner/src/test/weld-embedded/arquillian.xml index ac577eb7c5a..1b7905e0456 100644 --- a/jboss-tck-runner/src/test/weld-embedded/arquillian.xml +++ b/jboss-tck-runner/src/test/weld-embedded/arquillian.xml @@ -3,6 +3,7 @@ 40 + diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/BrokenBeanProducer.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/BrokenBeanProducer.java new file mode 100644 index 00000000000..2f5e34397ca --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/BrokenBeanProducer.java @@ -0,0 +1,20 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.Dependent; +import jakarta.enterprise.inject.Alternative; +import jakarta.enterprise.inject.Produces; + +@Dependent +public class BrokenBeanProducer { + + @Produces + @Alternative + @MyStereotype + @MyOtherStereotype + @ApplicationScoped + public String produce() { + return "broken"; + } + +} diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/ClassBean.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/ClassBean.java new file mode 100644 index 00000000000..18d329dc3a0 --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/ClassBean.java @@ -0,0 +1,11 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Alternative; + +@ApplicationScoped +@MyOtherStereotype +@MyStereotype +@Alternative +public class ClassBean { +} diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityClassBeanTest.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityClassBeanTest.java new file mode 100644 index 00000000000..50da91e2ac9 --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityClassBeanTest.java @@ -0,0 +1,31 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import jakarta.enterprise.inject.spi.DefinitionException; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.ShouldThrowException; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.BeanArchive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.weld.test.util.Utils; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class MultipleStereotypeWithPriorityClassBeanTest { + + @Deployment + @ShouldThrowException(DefinitionException.class) + public static Archive getDeployment() { + return ShrinkWrap + .create(BeanArchive.class, Utils.getDeploymentNameAsHash(MultipleStereotypeWithPriorityClassBeanTest.class)) + .addClasses(ClassBean.class, MyStereotype.class, MyOtherStereotype.class); + } + + @Test + public void multipleStereotypesFound() { + // should throw definition exception + } + +} diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityProducerBeanTest.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityProducerBeanTest.java new file mode 100644 index 00000000000..769ab303b6b --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MultipleStereotypeWithPriorityProducerBeanTest.java @@ -0,0 +1,31 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import jakarta.enterprise.inject.spi.DefinitionException; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.ShouldThrowException; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.BeanArchive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.weld.test.util.Utils; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class MultipleStereotypeWithPriorityProducerBeanTest { + + @Deployment + @ShouldThrowException(DefinitionException.class) + public static Archive getDeployment() { + return ShrinkWrap + .create(BeanArchive.class, Utils.getDeploymentNameAsHash(MultipleStereotypeWithPriorityProducerBeanTest.class)) + .addClasses(BrokenBeanProducer.class, MyStereotype.class, MyOtherStereotype.class); + } + + @Test + public void multipleStereotypesFound() { + // should throw definition exception + } + +} diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyOtherStereotype.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyOtherStereotype.java new file mode 100644 index 00000000000..c546873acbc --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyOtherStereotype.java @@ -0,0 +1,13 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import jakarta.annotation.Priority; +import jakarta.enterprise.inject.Stereotype; + +@Stereotype +@Retention(RetentionPolicy.RUNTIME) +@Priority(20) +public @interface MyOtherStereotype { +} diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyStereotype.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyStereotype.java new file mode 100644 index 00000000000..e8898876ab3 --- /dev/null +++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/alternative/priority/broken/MyStereotype.java @@ -0,0 +1,13 @@ +package org.jboss.weld.tests.producer.alternative.priority.broken; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import jakarta.annotation.Priority; +import jakarta.enterprise.inject.Stereotype; + +@Retention(RetentionPolicy.RUNTIME) +@Stereotype +@Priority(10) +public @interface MyStereotype { +} diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java index 8460e68eb9c..5a79f3ba397 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/BeanInfoImpl.java @@ -106,7 +106,7 @@ public boolean isAlternative() { @Override public boolean isReserve() { - throw new UnsupportedOperationException("Not yet implemented"); + return cdiBean.isReserve(); } @Override diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/LiteExtensionTranslator.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/LiteExtensionTranslator.java index d85c740b597..6dccf1d6f78 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/LiteExtensionTranslator.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/LiteExtensionTranslator.java @@ -176,6 +176,7 @@ public void synthesis(@Priority(Integer.MAX_VALUE) @Observes jakarta.enterprise. configurator.scope(syntheticBean.scope); } configurator.alternative(syntheticBean.isAlternative); + configurator.reserve(syntheticBean.isReserve); configurator.priority(syntheticBean.priority); configurator.name(syntheticBean.name); configurator.stereotypes(syntheticBean.stereotypes); diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java index 2831fb41af0..13d04d234ad 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/StereotypeInfoImpl.java @@ -9,6 +9,7 @@ import jakarta.annotation.Priority; import jakarta.enterprise.context.NormalScope; import jakarta.enterprise.inject.Alternative; +import jakarta.enterprise.inject.Reserve; import jakarta.enterprise.inject.build.compatible.spi.ScopeInfo; import jakarta.enterprise.inject.build.compatible.spi.StereotypeInfo; import jakarta.enterprise.inject.spi.BeanManager; @@ -63,7 +64,7 @@ public boolean isAlternative() { @Override public boolean isReserve() { - throw new UnsupportedOperationException("Not yet implemented"); + return cdiDeclaration.isAnnotationPresent(Reserve.class); } @Override diff --git a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java index 08088a9f7f9..2e9c2252000 100644 --- a/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java +++ b/weld-lite-extension-translator/src/main/java/org/jboss/weld/lite/extension/translator/SyntheticBeanBuilderImpl.java @@ -20,6 +20,7 @@ class SyntheticBeanBuilderImpl extends SyntheticComponentBuilderBase qualifiers = new HashSet<>(); Class scope; boolean isAlternative; + boolean isReserve; int priority; String name; Set> stereotypes = new HashSet<>(); @@ -82,7 +83,8 @@ public SyntheticBeanBuilder alternative(boolean isAlternative) { @Override public SyntheticBeanBuilder reserve(boolean isReserve) { - throw new UnsupportedOperationException("Not yet implemented"); + this.isReserve = isReserve; + return this; } @Override From ef2950005f6dc2869b9b524fe497e32bb9f708ab Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Fri, 21 Nov 2025 16:30:54 +0100 Subject: [PATCH 4/4] Re-enable WFLY testing, the preview nightly build should now be able to execute with CDI 5.0 --- .github/workflows/ci-actions.yml | 8 -------- jboss-tck-runner/src/test/tck/tck-tests-web.xml | 6 ------ 2 files changed, 14 deletions(-) diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml index 5748ad03480..f1618c5dfb2 100644 --- a/.github/workflows/ci-actions.yml +++ b/.github/workflows/ci-actions.yml @@ -80,8 +80,6 @@ jobs: incontainer-tests: name: "Weld In-container Tests - JDK ${{matrix.java.name}}" runs-on: ubuntu-latest - # Disabled until baseline WFLY supports EE 11 due to BeanManager#getELResolver calls - if: false needs: initial-build timeout-minutes: 120 strategy: @@ -150,8 +148,6 @@ jobs: CDI-TCK: name: "CDI TCK - JDK ${{matrix.java.name}}" runs-on: ubuntu-latest - # Disabled until baseline WFLY supports EE 11 due to BeanManager#getELResolver calls - if: false needs: initial-build timeout-minutes: 120 strategy: @@ -220,8 +216,6 @@ jobs: relaxed-mode-test: name: "Relaxed mode testing - JDK ${{matrix.java.name}}" runs-on: ubuntu-latest - # Disabled until baseline WFLY supports EE 11 due to BeanManager#getELResolver calls - if: false needs: initial-build timeout-minutes: 120 strategy: @@ -346,8 +340,6 @@ jobs: name: "Weld Examples build and test - JDK 17}" runs-on: ubuntu-latest needs: initial-build - # Disabled until baseline WFLY supports EE 11 due to BeanManager#getELResolver calls - if: false timeout-minutes: 120 steps: - uses: actions/checkout@v5 diff --git a/jboss-tck-runner/src/test/tck/tck-tests-web.xml b/jboss-tck-runner/src/test/tck/tck-tests-web.xml index e5267c96352..0382f72dea7 100644 --- a/jboss-tck-runner/src/test/tck/tck-tests-web.xml +++ b/jboss-tck-runner/src/test/tck/tck-tests-web.xml @@ -30,12 +30,6 @@ - - - - - -