Skip to content

Commit fa92e8f

Browse files
committed
Removal of deprecated APIs: @New
1 parent f6b0ae4 commit fa92e8f

File tree

10 files changed

+2
-211
lines changed

10 files changed

+2
-211
lines changed

api/src/main/java/jakarta/enterprise/inject/Any.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
* </p>
3838
*
3939
* <p>
40-
* Every bean has the qualifier <code>&#064;Any</code>, even if it does not explicitly declare this qualifier, except for the
41-
* special {@link New &#064;New qualified beans}.
40+
* Every bean has the qualifier <code>&#064;Any</code>, even if it does not explicitly declare this qualifier.
4241
* </p>
4342
*
4443
* <p>

api/src/main/java/jakarta/enterprise/inject/Instance.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,6 @@
7272
* </pre>
7373
*
7474
* <p>
75-
* Finally, the {@link New &#064;New} qualifier may be used, allowing the application to obtain a
76-
* {@link New &#064;New} qualified bean:
77-
* </p>
78-
*
79-
* <pre>
80-
* &#064;Inject
81-
* &#064;New(ChequePaymentProcessor.class)
82-
* Instance&lt;PaymentProcessor&gt; chequePaymentProcessor;
83-
* </pre>
84-
*
85-
* <p>
8675
* For an injected <code>Instance</code>:
8776
* </p>
8877
*

api/src/main/java/jakarta/enterprise/inject/New.java

Lines changed: 0 additions & 115 deletions
This file was deleted.

api/src/main/java/jakarta/enterprise/inject/spi/ProcessBeanAttributes.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package jakarta.enterprise.inject.spi;
1919

20-
import jakarta.enterprise.inject.New;
2120
import jakarta.enterprise.inject.spi.configurator.BeanAttributesConfigurator;
2221

2322
/**
@@ -26,9 +25,6 @@
2625
* registering the {@link Bean} object.
2726
* </p>
2827
* <p>
29-
* No event is fired for {@link New} qualified beans.
30-
* </p>
31-
* <p>
3228
* Any observer of this event is permitted to wrap and/or replace the {@link BeanAttributes} by calling either {@link #setBeanAttributes(BeanAttributes)} or {@link #configureBeanAttributes()}.
3329
* If both methods are called within an observer notification an {@link IllegalStateException} is thrown.
3430
* The container must use the final value of this property, after all observers have been called, to manage instances of the bean.

api/src/test/java/org/jboss/cdi/api/test/AnnotationLiteralTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import jakarta.enterprise.inject.Alternative;
1515
import jakarta.enterprise.inject.Any;
1616
import jakarta.enterprise.inject.Default;
17-
import jakarta.enterprise.inject.New;
1817
import jakarta.enterprise.inject.Specializes;
1918
import jakarta.enterprise.inject.TransientReference;
2019
import jakarta.enterprise.inject.Typed;
@@ -55,13 +54,6 @@ public void testNullMemberValueOnToString() {
5554
new FooLiteral(null).hashCode();
5655
}
5756

58-
@Test
59-
public void testNewLiteral() {
60-
New literal = New.Literal.INSTANCE;
61-
assertEquals(literal.value(), New.class);
62-
assertEquals(New.Literal.of(Boolean.class).value(), Boolean.class);
63-
}
64-
6557
@SuppressWarnings("serial")
6658
@Test
6759
public void testDefaultLiteral() {

spec/src/main/asciidoc/core/definition.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Qualifier types are also used as event selectors by event consumers, as defined
215215

216216
Three standard qualifier types are defined in the package `jakarta.enterprise.inject`. In addition, the built-in qualifier type `@Named` is defined by the package `jakarta.inject`.
217217

218-
Every bean has the built-in qualifier `@Any`, even if it does not explicitly declare this qualifier, except for the special `@New` qualified beans defined in <<new>>.
218+
Every bean has the built-in qualifier `@Any`, even if it does not explicitly declare this qualifier.
219219

220220
If a bean does not explicitly declare a qualifier other than `@Named` or `@Any`, the bean has exactly one additional qualifier, of type `@Default`. This is called the _default qualifier_.
221221

spec/src/main/asciidoc/core/implementation.asciidoc

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -697,57 +697,6 @@ For example, the following field has the qualifier `@Named("paymentService")`:
697697

698698
If any other injection point declares a `@Named` annotation that does not specify the `value` member, the container automatically detects the problem and treats it as a definition error.
699699

700-
[[new]]
701-
702-
=== `@New` qualified beans
703-
704-
_The @New qualifier was deprecated in CDI 1.1.
705-
CDI applications are encouraged to inject @Dependent scoped beans instead._
706-
707-
For each managed bean, a second bean exists which:
708-
709-
* has the same bean class,
710-
* has the same bean types,
711-
* has the same bean constructor, initializer methods and injected fields, and
712-
* has the same interceptor bindings.
713-
714-
715-
However, this second bean:
716-
717-
* has scope `@Dependent`,
718-
* has exactly one qualifier: `@jakarta.enterprise.inject.New(X.class)` where `X` is the bean class,
719-
* has no bean name,
720-
* has no stereotypes,
721-
* has no observer methods, producer methods or fields or disposer methods, and
722-
* is not an alternative, and
723-
* is enabled, in the sense of <<enablement>>, if and only if some other enabled bean has an injection point with the qualifier `@New(X.class)` where `X` is the bean class.
724-
725-
726-
This bean is called the _@New qualified bean_ for the class `X`.
727-
728-
Note that this second bean exists - and may be enabled and available for injection - even if the first bean is disabled, as defined by <<enablement>>, or if the bean class is deployed outside of a bean archive, as defined in <<bean_archive>>, and is therefore not discovered during the bean discovery process defined in <<packaging_deployment>>.
729-
The container discovers `@New` qualified beans by inspecting injection points of other enabled beans.
730-
731-
This allows the application to obtain a new instance of a bean which is not bound to the declared scope, but has had dependency injection performed.
732-
733-
[source, java]
734-
----
735-
@Produces @ConversationScoped
736-
@Special Order getSpecialOrder(@New(Order.class) Order order) {
737-
...
738-
return order;
739-
}
740-
----
741-
742-
When the qualifier `@New` is specified at an injection point and no `value` member is explicitly specified, the container defaults the `value` to the declared type of the injection point.
743-
So the following injection point has qualifier `@New(Order.class)`:
744-
745-
[source, java]
746-
----
747-
@Produces @ConversationScoped
748-
@Special Order getSpecialOrder(@New Order order) { ... }
749-
----
750-
751700
[[unproxyable]]
752701

753702
=== Unproxyable bean types

spec/src/main/asciidoc/core/injectionandresolution.asciidoc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ A bean is said to be _enabled_ if:
106106

107107
Otherwise, the bean is said to be disabled.
108108

109-
Note that <<new>> defines a special rule that determines whether a `@New` qualified bean is enabled or disabled.
110-
This rule applies as only to `@New` qualified beans, as an exception to the normal rule defined here.
111-
112109
[[inconsistent_specialization]]
113110

114111
==== Inconsistent specialization
@@ -650,13 +647,6 @@ PaymentProcessor pp = anyPaymentProcessor.select(qualifier).get().process(paymen
650647

651648
In this example, the returned bean has qualifier `@Synchronous` or `@Asynchronous` depending upon the value of `synchronously`.
652649

653-
Finally, the `@New` qualifier may be used, allowing the application to obtain a `@New` qualified bean, as defined in <<new>>:
654-
655-
[source, java]
656-
----
657-
@Inject @New(ChequePaymentProcessor.class) Instance<PaymentProcessor> chequePaymentProcessor;
658-
----
659-
660650
It's even possible to iterate over a set of beans:
661651

662652
[source, java]
@@ -807,7 +797,6 @@ The following built-in annotations define a `Literal` static nested class to sup
807797

808798
* `jakarta.enterprise.inject.Any`
809799
* `jakarta.enterprise.inject.Default`
810-
* `jakarta.enterprise.inject.New`
811800
* `jakarta.enterprise.inject.Specializes`
812801
* `jakarta.enterprise.inject.Vetoed`
813802
* `jakarta.enterprise.util.Nonbinding`

spec/src/main/asciidoc/core/spi.asciidoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,6 @@ If any `ProcessInjectionTarget` method is called outside of the observer method
14261426
The container must fire an event for each managed bean, producer, interceptor or decorator deployed in a bean archive, before registering the `Bean` object.
14271427
No event is fired for any:
14281428

1429-
* `@New` qualified bean, defined in <<new>>, or,
14301429
* beans added programmatically using `AfterBeanDiscovery.addBean()`, or,
14311430
* for any built-in beans.
14321431

@@ -1499,7 +1498,6 @@ With `BeanAttributesConfigurator` you can perform the following operations :
14991498
==== `ProcessBean` event
15001499

15011500
The container must fire an event for each bean, interceptor or decorator deployed in a bean archive, after firing the `ProcessBeanAttributes` for the bean and before registering the `Bean` object.
1502-
No event is fired for any `@New` qualified bean, defined in <<new>>.
15031501

15041502
The event object type in the package `jakarta.enterprise.inject.spi` depends upon what kind of bean was discovered:
15051503

spec/src/main/asciidoc/javaee/implementation_ee.asciidoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,3 @@ When running in Jakarta EE, the container must extend the rules defined for bean
331331
The container must also ensure that:
332332

333333
* An initializer method defined in an EJB session bean is _not_ required to be a business method of the session bean.
334-
335-
[[new_ee]]
336-
337-
=== `@New` qualified beans in Jakarta EE
338-
339-
When running in Jakarta EE, the container must extend the rules defined for managed beans in <<new>> to EJB session beans.

0 commit comments

Comments
 (0)