diff --git a/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java b/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java index 3ab939738ac..ac0252f5e47 100644 --- a/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java +++ b/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java @@ -196,13 +196,6 @@ public class Weld extends SeContainerInitializer implements ContainerInstanceFac */ public static final String ARCHIVE_ISOLATION_SYSTEM_PROPERTY = "org.jboss.weld.se.archive.isolation"; - /** - * Since Weld 5.1.0.Final, this property is deprecated and serves no purpose. - * It will be removed in future versions. - */ - @Deprecated(since = "5.1.0.Final") - public static final String DEV_MODE_SYSTEM_PROPERTY = "org.jboss.weld.development"; - /** * Standard behavior is that empty {@code beans.xml} is treated as discovery mode {@code annotated}. * This configuration property allows to change the behavior to discovery mode {@code all} which is how it used to work @@ -949,18 +942,6 @@ public Weld scanClasspathEntries() { return property(SCAN_CLASSPATH_ENTRIES_SYSTEM_PROPERTY, true); } - /** - * Since Weld 5.1.0.Final, this method is deprecated and became no-op. - * It will be removed in future versions. - * - * @return self - * @see #DEV_MODE_SYSTEM_PROPERTY - */ - @Deprecated(since = "5.1.0.Final") - public Weld enableDevMode() { - return property(DEV_MODE_SYSTEM_PROPERTY, true); - } - /** * Registers annotations which will be considered as bean defining annotations. * diff --git a/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java b/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java index 07b64d057a6..dec5b1f358f 100644 --- a/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java +++ b/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java @@ -16,6 +16,8 @@ */ package org.jboss.weld.environment.se; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; import java.util.Collection; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -249,12 +251,16 @@ private void fireContainerInitializedEvent() { } /** - * Provides access to all beans within the application. Retained for backward compatibility - WeldContainer implements - * {@linkjakarta.enterprise.inject.Instance}. + * Deprecated - {@code WeldContainer} implements {@linkjakarta.enterprise.inject.Instance} and applications can + * therefore directly perform programmatic lookup from this object. + * See {@link #select(Type, Annotation...)} and other methods. + *

+ * Provides access to all beans within the application. * * @return the instance * @deprecated Applications are encouraged to use methods for programmatic lookup directly. */ + @Deprecated(forRemoval = true) public Instance instance() { checkState(); return getInstance(); diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainEmptyArgsTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainEmptyArgsTest.java index 94806f2b959..b0ac076862c 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainEmptyArgsTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainEmptyArgsTest.java @@ -46,7 +46,7 @@ public void init() { public void testMainEmptyArgs() { WeldContainer container = startMain.go(); - MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get(); + MainTestBean mainTestBean = container.select(MainTestBean.class).get(); assertNotNull(mainTestBean); ParametersTestBean paramsBean = mainTestBean.getParametersTestBean(); diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java index a9fa29b5e3e..3177e618f3c 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java @@ -53,7 +53,7 @@ public void testMain() { assertEquals(container.getId(), RegistrySingletonProvider.STATIC_INSTANCE); - MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get(); + MainTestBean mainTestBean = container.select(MainTestBean.class).get(); assertNotNull(mainTestBean); ParametersTestBean paramsBean = mainTestBean.getParametersTestBean(); diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java index 875139e55e3..413c0ceac28 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java @@ -43,7 +43,7 @@ public void testInitialize() { Weld weld = new Weld(); WeldContainer container = weld.initialize(); - MainTestBean mainTestBean = container.instance().select(MainTestBean.class).get(); + MainTestBean mainTestBean = container.select(MainTestBean.class).get(); assertNotNull(mainTestBean); ParametersTestBean paramsBean = mainTestBean.getParametersTestBean(); diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/container/isolation/ContainerIsolationTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/container/isolation/ContainerIsolationTest.java index 8984787c48c..0d17248bc78 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/container/isolation/ContainerIsolationTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/container/isolation/ContainerIsolationTest.java @@ -40,7 +40,7 @@ public void testContainerIsolation() { Weld weld2 = new Weld("2"); WeldContainer weldContainer2 = weld2.initialize(); - Foo foo2 = weldContainer2.instance().select(Foo.class).get(); + Foo foo2 = weldContainer2.select(Foo.class).get(); foo1.setValue(1); foo2.setValue(2); diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/inheritance/PostConstructInheritanceTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/inheritance/PostConstructInheritanceTest.java index da4f5bd1e56..0b16730e8d2 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/inheritance/PostConstructInheritanceTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/inheritance/PostConstructInheritanceTest.java @@ -37,7 +37,7 @@ public void testPostConstructInherited() { Plant.postConstructCalled = false; WeldContainer weldContainer = weld.initialize(); - weldContainer.instance().select(Tree.class).get(); + weldContainer.select(Tree.class).get(); assertTrue(Plant.postConstructCalled); } finally { diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/instance/SimpleInstanceTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/instance/SimpleInstanceTest.java index 0db53b8550b..ee48922530c 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/instance/SimpleInstanceTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/instance/SimpleInstanceTest.java @@ -15,8 +15,8 @@ public void testSelect() throws Exception { Weld weld = new Weld(); try { WeldContainer wc = weld.initialize(); - Assert.assertNotNull(wc.instance().select(KPT.class).select(new KPQLiteral()).get()); - Assert.assertNotNull(wc.instance().select(KPT.class, new KPQLiteral()).get()); + Assert.assertNotNull(wc.select(KPT.class).select(new KPQLiteral()).get()); + Assert.assertNotNull(wc.select().select(KPT.class, new KPQLiteral()).get()); } finally { weld.shutdown(); } diff --git a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/singleton/SingletonContextTest.java b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/singleton/SingletonContextTest.java index ccab137e53c..5708d57c852 100644 --- a/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/singleton/SingletonContextTest.java +++ b/environments/se/core/src/test/java/org/jboss/weld/environment/se/test/singleton/SingletonContextTest.java @@ -33,7 +33,7 @@ public class SingletonContextTest { public void testSingletonBeanLifecycle() { Weld weld = new Weld(); WeldContainer container = weld.initialize(); - assertEquals("bar", container.instance().select(Translator.class).get().translate("hello")); + assertEquals("bar", container.select().select(Translator.class).get().translate("hello")); assertTrue(Translator.isInitCallbackInvoked); assertTrue(Dictionary.isInitCallbackInvoked); weld.shutdown(); diff --git a/impl/src/main/java/org/jboss/weld/Container.java b/impl/src/main/java/org/jboss/weld/Container.java index 89c28e13671..c9507849462 100644 --- a/impl/src/main/java/org/jboss/weld/Container.java +++ b/impl/src/main/java/org/jboss/weld/Container.java @@ -172,14 +172,6 @@ public BeanManagerImpl getBeanManager(String key) { return managers.get(key); } - /** - * @deprecated Use {@link #getBeanManager(String)} instead - */ - @Deprecated - public BeanManagerImpl activityManager(String key) { - return getBeanManager(key); - } - private String addBeanManager(BeanManagerImpl manager) { String id = manager.getId(); if (manager.getId() == null) { diff --git a/impl/src/main/java/org/jboss/weld/annotated/enhanced/EnhancedAnnotated.java b/impl/src/main/java/org/jboss/weld/annotated/enhanced/EnhancedAnnotated.java index 8e7be0632b4..7793e9fa295 100644 --- a/impl/src/main/java/org/jboss/weld/annotated/enhanced/EnhancedAnnotated.java +++ b/impl/src/main/java/org/jboss/weld/annotated/enhanced/EnhancedAnnotated.java @@ -16,6 +16,8 @@ */ package org.jboss.weld.annotated.enhanced; +import static org.jboss.weld.util.reflection.Reflections.EMPTY_ANNOTATIONS; + import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Set; @@ -30,8 +32,7 @@ import org.jboss.weld.util.collections.Arrays2; /** - * AnnotatedItem provides a uniform access to the annotations on an annotated - * item defined either in Java or XML + * AnnotatedItem provides uniform access to the annotations on an annotated item defined either in Java or XML * * @author Pete Muir */ @@ -61,25 +62,27 @@ public interface EnhancedAnnotated extends Annotated { /** * Gets the binding types for this element + *

+ * This reflection type should not know about CDI qualifiers. + * However, it is very convenient, so we keep it here. * * @returns A set of binding types present on the type. Returns an empty set * if there are no matches. - * @deprecated This reflection type should not know about JSR-299 binding - * types */ - @Deprecated Set getQualifiers(); /** * Gets the binding types for this element + *

+ * This reflection type should not know about CDI qualifiers. + * However, it is very convenient, so we keep it here. * * @returns An array of binding types present on the type. Returns an empty * array if there are no matches. - * @deprecated This reflection type should not know about JSR-299 binding - * types */ - @Deprecated - Annotation[] getBindingsAsArray(); + default Annotation[] getBindingsAsArray() { + return getQualifiers().toArray(EMPTY_ANNOTATIONS); + } /** * Get the type hierarchy of any interfaces implemented by this class. diff --git a/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/AbstractEnhancedAnnotated.java b/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/AbstractEnhancedAnnotated.java index 5fea3b3a9f8..c46f5f3e557 100644 --- a/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/AbstractEnhancedAnnotated.java +++ b/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/AbstractEnhancedAnnotated.java @@ -17,7 +17,6 @@ package org.jboss.weld.annotated.enhanced.jlr; import static org.jboss.weld.util.collections.WeldCollections.immutableMapView; -import static org.jboss.weld.util.reflection.Reflections.EMPTY_ANNOTATIONS; import java.lang.annotation.Annotation; import java.lang.reflect.ParameterizedType; @@ -225,7 +224,6 @@ public Set getMetaAnnotations(Class metaAnnota return ImmutableSet.copyOf(metaAnnotationMap.get(metaAnnotationType)); } - @Deprecated public Set getQualifiers() { Set qualifiers = getMetaAnnotations(Qualifier.class); if (qualifiers.size() > 0) { @@ -235,11 +233,6 @@ public Set getQualifiers() { } } - @Deprecated - public Annotation[] getBindingsAsArray() { - return getQualifiers().toArray(EMPTY_ANNOTATIONS); - } - public A getAnnotation(Class annotationType) { return annotationType.cast(annotationMap.get(annotationType)); } diff --git a/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyInstantiator.java b/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyInstantiator.java index 69509a3ab25..72ca05360f3 100644 --- a/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyInstantiator.java +++ b/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyInstantiator.java @@ -131,8 +131,7 @@ public static ProxyInstantiator create(WeldConfiguration configuration) { result = DefaultProxyInstantiator.INSTANCE; } } else { - result = create(configuration.getBooleanProperty(ConfigurationKey.RELAXED_CONSTRUCTION) - || configuration.getBooleanProperty(ConfigurationKey.PROXY_UNSAFE)); + result = create(configuration.getBooleanProperty(ConfigurationKey.RELAXED_CONSTRUCTION)); } BootstrapLogger.LOG.debugv("Using instantiator: {0}", result.getClass().getName()); return result; diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java b/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java index 5294fe6fe2b..56204bbe9ee 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java @@ -146,7 +146,7 @@ public class WeldStartup { static { - VersionLogger.LOG.version(Formats.version(null)); + VersionLogger.LOG.version(Formats.version()); } private BeanManagerImpl deploymentManager; diff --git a/impl/src/main/java/org/jboss/weld/config/ConfigurationKey.java b/impl/src/main/java/org/jboss/weld/config/ConfigurationKey.java index 119796a649f..d6907295719 100644 --- a/impl/src/main/java/org/jboss/weld/config/ConfigurationKey.java +++ b/impl/src/main/java/org/jboss/weld/config/ConfigurationKey.java @@ -118,8 +118,7 @@ public enum ConfigurationKey { /** * Weld supports a non-standard workaround to be able to create client proxies for Java types that cannot be proxied by the - * container, using non-portable - * JVM APIs. + * container, using non-portable JVM APIs. */ @Description("Weld supports a non-standard workaround to be able to create client proxies for Java types that cannot be proxied by the container, using non-portable JVM APIs.") RELAXED_CONSTRUCTION("org.jboss.weld.construction.relaxed", false), @@ -130,16 +129,6 @@ public enum ConfigurationKey { */ PROXY_INSTANTIATOR("org.jboss.weld.proxy.instantiator", ""), - /** - * Weld supports a non-standard workaround to be able to create client proxies for Java types that cannot be proxied by the - * container, using non-portable - * JVM APIs. - * - * @deprecated this option is deprecated. RELAXED_CONSTRUCTION should be used instead - */ - @Description("This option is deprecated - org.jboss.weld.construction.relaxed should be used instead.") - PROXY_UNSAFE("org.jboss.weld.proxy.unsafe", false), - /** * XML descriptor validation is enabled by default. */ @@ -154,30 +143,6 @@ public enum ConfigurationKey { @Description("For certain combinations of scopes, the container is permitted to optimize an injectable reference lookup. The optimization is disabled by default.") INJECTABLE_REFERENCE_OPTIMIZATION("org.jboss.weld.injection.injectableReferenceOptimization", false), - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_INVOCATION_MONITOR_EXCLUDE_TYPE("org.jboss.weld.probe.invocationMonitor.excludeType", ""), - - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_INVOCATION_MONITOR_SKIP_JAVABEAN_PROPERTIES("org.jboss.weld.probe.invocationMonitor.skipJavaBeanProperties", true), - - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_EVENT_MONITOR_EXCLUDE_TYPE("org.jboss.weld.probe.eventMonitor.excludeType", ""), - /** * This optimization is used to reduce the HTTP session replication overhead. However, the inconsistency detection mechanism * may cause problems in some @@ -186,14 +151,6 @@ public enum ConfigurationKey { @Description("This optimization is used to reduce the HTTP session replication overhead. However, the inconsistency detection mechanism may cause problems in some development environments.") BEAN_IDENTIFIER_INDEX_OPTIMIZATION("org.jboss.weld.serialization.beanIdentifierIndexOptimization", true), - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_EMBED_INFO_SNIPPET("org.jboss.weld.probe.embedInfoSnippet", true), - /** * If set to true, the attributes should be fetched lazily from the backing store for some contexts (e.g. * attributes of an HTTP session for a @@ -202,31 +159,6 @@ public enum ConfigurationKey { @Description("If set to true, the attributes should be fetched lazily from the backing store for some contexts (e.g. attributes of an HTTP session for a session context).") CONTEXT_ATTRIBUTES_LAZY_FETCH("org.jboss.weld.context.attributes.lazyFetch", true), - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_JMX_SUPPORT("org.jboss.weld.probe.jmxSupport", false), - - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_EVENT_MONITOR_CONTAINER_LIFECYCLE_EVENTS("org.jboss.weld.probe.eventMonitor.containerLifecycleEvents", false), - - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_ALLOW_REMOTE_ADDRESS("org.jboss.weld.probe.allowRemoteAddress", - "127.0.0.1|::1|::1%.+|0:0:0:0:0:0:0:1|0:0:0:0:0:0:0:1%.+"), - /** * Weld supports a non-standard workaround to be able to create proxies for Java types which declare non-private non-static * final methods. These methods are @@ -284,14 +216,6 @@ public enum ConfigurationKey { @Description("A regular expression. If a non-empty string, then all annotated types whose jakarta.enterprise.inject.spi.AnnotatedType#getJavaClass().getName() matches this pattern are vetoed if not annotated with a bean defining annotation.") VETO_TYPES_WITHOUT_BEAN_DEFINING_ANNOTATION("org.jboss.weld.bootstrap.vetoTypesWithoutBeanDefiningAnnotation", ""), - /** - * This option is deprecated and has no function since Weld 5.1.0.Final. - * It will be removed in upcoming versions. - */ - @Deprecated(since = "5.1.0.Final") - @Description("This option is deprecated and has no function since Weld 5.1.0.Final.") - PROBE_EXPORT_DATA_AFTER_DEPLOYMENT("org.jboss.weld.probe.exportDataAfterDeployment", ""), - /** * If set to true: *