Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of deprecated bits for next major version #473

Merged
merged 6 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions api/src/main/java/jakarta/enterprise/inject/Any.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
* </p>
*
* <p>
* Every bean has the qualifier <code>&#064;Any</code>, even if it does not explicitly declare this qualifier, except for the
* special {@link New &#064;New qualified beans}.
* Every bean has the qualifier <code>&#064;Any</code>, even if it does not explicitly declare this qualifier.
* </p>
*
* <p>
Expand Down
11 changes: 0 additions & 11 deletions api/src/main/java/jakarta/enterprise/inject/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@
* </pre>
*
* <p>
* Finally, the {@link New &#064;New} qualifier may be used, allowing the application to obtain a
* {@link New &#064;New} qualified bean:
* </p>
*
manovotn marked this conversation as resolved.
Show resolved Hide resolved
* <pre>
* &#064;Inject
* &#064;New(ChequePaymentProcessor.class)
* Instance&lt;PaymentProcessor&gt; chequePaymentProcessor;
* </pre>
*
* <p>
* For an injected <code>Instance</code>:
* </p>
*
Expand Down
115 changes: 0 additions & 115 deletions api/src/main/java/jakarta/enterprise/inject/New.java

This file was deleted.

14 changes: 0 additions & 14 deletions api/src/main/java/jakarta/enterprise/inject/spi/Bean.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,4 @@ public interface Bean<T> extends Contextual<T>, BeanAttributes<T> {
* @return the set of {@linkplain InjectionPoint injection points} of the bean
*/
public Set<InjectionPoint> getInjectionPoints();

/**
* <p>
* Determines if {@link Contextual#create(CreationalContext)} sometimes return a null value.
* </p>
*
* <p>
* As of CDI 1.1 this method is deprecated and can safely always return false.
* </p>
*
* @return <code>true</code> if the {@code create()} method may return a null value, and <code>false</code> otherwise
*/
public boolean isNullable();

}
41 changes: 2 additions & 39 deletions api/src/main/java/jakarta/enterprise/inject/spi/BeanManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,6 @@ public interface BeanManager {
*/
public void validate(InjectionPoint injectionPoint);

/**
* Fire an event and notify observers.
*
* <p>
* This method is deprecated from CDI 2.0 and {@link #getEvent()} should be used instead.
* </p>
*
* @param event the event object
* @param qualifiers the event qualifiers
* @throws IllegalArgumentException if the runtime type of the event object contains a type variable
* @throws IllegalArgumentException if two instances of the same non repeating qualifier type are given
* @throws IllegalArgumentException if an instance of an annotation that is not a qualifier type is given
* @throws IllegalArgumentException if the runtime type of the event object is assignable to the type of a container
* lifecycle event
* @throws ObserverException if a notified observer throws a checked exception, it will be wrapped and rethrown as an
* (unchecked) {@link ObserverException}
*/
public void fireEvent(Object event, Annotation... qualifiers);

/**
* Return an ordered set of {@linkplain ObserverMethod observer methods} for an event.
*
Expand Down Expand Up @@ -443,24 +424,6 @@ public interface BeanManager {
*/
public <T> AnnotatedType<T> createAnnotatedType(Class<T> type);

/**
* <p>
* Obtains an {@link InjectionTarget} for the given {@link AnnotatedType}. The container ignores the annotations and types
* declared by the elements of the actual Java class and uses the metadata provided via the {@link Annotated} interface
* instead.
* </p>
*
* <p>
* This method is deprecated from CDI 1.1 and {@link #getInjectionTargetFactory(AnnotatedType)} should be used instead.
* </p>
*
* @param <T> the type
* @param type the {@link AnnotatedType}
* @return a container provided implementation of {@link InjectionTarget}
* @throws IllegalArgumentException if there is a definition error associated with any injection point of the type
*/
public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type);

/**
* <p>
* An implementation of {@link InjectionTargetFactory} that provides container created {@link InjectionTarget} instances.
Expand Down Expand Up @@ -552,7 +515,7 @@ public interface BeanManager {
*
* @param <T> the type
* @param attributes a {@link BeanAttributes} which determines the bean types, qualifiers, scope, name and stereotypes of
* the returned {@link Bean}, and the return values of {@link Bean#isAlternative()} and {@link Bean#isNullable()}
* the returned {@link Bean}, and the return value of {@link Bean#isAlternative()}
* @param beanClass a class, which determines the return value of {@link Bean#getBeanClass()}
* @param injectionTargetFactory an {@link InjectionTargetFactory}, used to obtain an {@link InjectionTarget}
* @return a container provided implementation of {@link Bean}
Expand All @@ -576,7 +539,7 @@ public <T> Bean<T> createBean(BeanAttributes<T> attributes, Class<T> beanClass,
* @param <T> the type
* @param <X> the type of the declaring bean
* @param attributes a {@link BeanAttributes} which determines the bean types, qualifiers, scope, name and stereotypes of
* the returned {@link Bean}, and the return values of {@link Bean#isAlternative()} and {@link Bean#isNullable()}
* the returned {@link Bean}, and the return value of {@link Bean#isAlternative()}
* @param beanClass a class, which determines the return value of <code>Bean.getClass()</code>
* @param producerFactory a {@link ProducerFactory}, used to obtain a {@link Producer}
* @return a container provided implementation of {@link Bean}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,6 @@ public interface BeforeBeanDiscovery {
*/
public void addInterceptorBinding(Class<? extends Annotation> bindingType, Annotation... bindingTypeDef);

/**
* <p>
* Adds a given {@link AnnotatedType} to the set of types which will be scanned during bean
* discovery.
* </p>
*
* <p>
* This method is deprecated from CDI 1.1 and {@link #addAnnotatedType(AnnotatedType, String)} should be used instead.
* </p>
*
* @throws IllegalStateException if called outside of the observer method invocation
* @param type The {@link AnnotatedType} to add for later scanning
*/
public void addAnnotatedType(AnnotatedType<?> type);

/**
* <p>
* Adds a given {@link AnnotatedType} to the set of types which will be scanned during bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* <p>
* Provides access to metadata about an observed event payload. The metadata may be for events fired with either of
* {@link Event} or {@link BeanManager#fireEvent(Object, Annotation...)}.
* {@link Event} or {@link BeanManager#getEvent()}
* </p>
* <p>
* {@link EventMetadata} may only be injected into an observer method. For example:
Expand All @@ -52,7 +52,7 @@ public interface EventMetadata {

/**
* Get the {@link InjectionPoint} representing the injected {@link Event} instance which fired the event, or
* <code>null</code> if it was fired from {@link BeanManager#fireEvent(Object, Annotation...)};
* <code>null</code> if it was fired from {@link BeanManager#getEvent()}
*
* @return InjectionPoint of the Event
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package jakarta.enterprise.inject.spi;

import jakarta.enterprise.inject.New;
import jakarta.enterprise.inject.spi.configurator.BeanAttributesConfigurator;

/**
Expand All @@ -26,9 +25,6 @@
* registering the {@link Bean} object.
* </p>
* <p>
* No event is fired for {@link New} qualified beans.
* </p>
* <p>
* Any observer of this event is permitted to wrap and/or replace the {@link BeanAttributes} by calling either {@link #setBeanAttributes(BeanAttributes)} or {@link #configureBeanAttributes()}.
* If both methods are called within an observer notification an {@link IllegalStateException} is thrown.
* The container must use the final value of this property, after all observers have been called, to manage instances of the bean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
/**
* <p>
* The container fires an event of this type for each Java class or interface added by
* {@link BeforeBeanDiscovery#addAnnotatedType(AnnotatedType)},
* {@link BeforeBeanDiscovery#addAnnotatedType(AnnotatedType, String)} or
* {@link BeforeBeanDiscovery#addAnnotatedType(AnnotatedType, String)} or
* {@link AfterTypeDiscovery#addAnnotatedType(AnnotatedType, String)}
* </p>
* <p>
Expand All @@ -31,7 +30,7 @@
* </p>
* <p>
* For example, the following observer decorates the {@link AnnotatedType} for every class that is
* added by {@link BeforeBeanDiscovery#addAnnotatedType(AnnotatedType)}.
* added by {@link BeforeBeanDiscovery#addAnnotatedType(AnnotatedType, String)}.
* </p>
*
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
* and lifecycle callbacks.</p>
*
* <p>An instance of {@link jakarta.enterprise.inject.spi.InjectionTarget}
* may be
* {@linkplain jakarta.enterprise.inject.spi.BeanManager#createInjectionTarget(AnnotatedType)
* obtained} from the {@link jakarta.enterprise.inject.spi.BeanManager},
* may be product of
* {@linkplain jakarta.enterprise.inject.spi.BeanManager#getInjectionTargetFactory(AnnotatedType)}
* obtained from the {@link jakarta.enterprise.inject.spi.BeanManager},
* allowing a portable extension to request these container services for
* objects under the control of the portable extension.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import jakarta.enterprise.inject.Alternative;
import jakarta.enterprise.inject.Any;
import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.New;
import jakarta.enterprise.inject.Specializes;
import jakarta.enterprise.inject.TransientReference;
import jakarta.enterprise.inject.Typed;
Expand Down Expand Up @@ -55,13 +54,6 @@ public void testNullMemberValueOnToString() {
new FooLiteral(null).hashCode();
}

@Test
public void testNewLiteral() {
New literal = New.Literal.INSTANCE;
assertEquals(literal.value(), New.class);
assertEquals(New.Literal.of(Boolean.class).value(), Boolean.class);
}

@SuppressWarnings("serial")
@Test
public void testDefaultLiteral() {
Expand Down
2 changes: 1 addition & 1 deletion spec/src/main/asciidoc/core/definition.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Qualifier types are also used as event selectors by event consumers, as defined

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`.

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>>.
Every bean has the built-in qualifier `@Any`, even if it does not explicitly declare this qualifier.

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_.

Expand Down
6 changes: 3 additions & 3 deletions spec/src/main/asciidoc/core/events.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public interface EventMetadata {
----

* `getQualifiers()` returns the set of qualifiers with which the event was fired.
* `getInjectionPoint()` returns the `InjectionPoint` from which this event payload was fired, or `null` if it was fired from `BeanManager.fireEvent(...)`.
* `getInjectionPoint()` returns the `InjectionPoint` from which this event payload was fired, or `null` if it was fired from `BeanManager.getEvent()`.
* `getType()` returns the type representing runtime class of the event object with type variables resolved.


Expand Down Expand Up @@ -534,7 +534,7 @@ Observer methods may throw exceptions:
Exception management during an asynchronous event is defined in <<async_exception>>.
* Otherwise, the exception aborts processing of the event.
No other observer methods of that event will be called.
The `BeanManager.fireEvent()` or `Event.fire()` method rethrows the exception.
The `BeanManager.getEvent()` or `Event.fire()` method rethrows the exception.
If the exception is a checked exception, it is wrapped and rethrown as an (unchecked) `ObserverException`.


Expand Down Expand Up @@ -594,6 +594,6 @@ The transaction context and lifecycle contexts active when an observer method is
As specified in <<builtin_contexts>>, contexts associated with built-in normal scope don't propagate across asynchronous observers.
* If the observer method is a before completion transactional observer method, it is called within the context of the transaction that is about to complete and with the same lifecycle contexts.
* Otherwise, if the observer method is any other kind of transactional observer method, it is called in an unspecified transaction context, but with the same lifecycle contexts as the transaction that just completed.
* Otherwise, the observer method is called in the same transaction context and lifecycle contexts as the invocation of `Event.fire()` or `BeanManager.fireEvent()`.
* Otherwise, the observer method is called in the same transaction context and lifecycle contexts as the invocation of `Event.fire()` or `BeanManager.getEvent()`.