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

Decide on other mentions of Full-only concepts in the CDI Lite spec p… #541

Merged
merged 1 commit into from
Oct 12, 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
2 changes: 2 additions & 0 deletions spec/src/main/asciidoc/cdi-spec.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ include::core/injectionandresolution_full.asciidoc[]

include::core/scopescontexts_full.asciidoc[]

include::core/lifecycle_full.asciidoc[]

include::core/interceptors_full.asciidoc[]

include::core/decorators.asciidoc[]
Expand Down
25 changes: 1 addition & 24 deletions spec/src/main/asciidoc/core/injectionandresolution.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ An alternative may be given a priority for the application:
* by placing the `@Priority` annotation on the bean class of a managed bean, or
* by placing the `@Priority` annotation on the bean class that declares the producer method, field or resource.

Custom bean implementations which are also alternatives may implement <<prioritized, Prioritized interface>> in which case they will be enabled for entire application with given priority.
// TODO this refers to Portable Extensions, maybe move to Full? maybe mention Build Compatible Extensions?

[[enablement]]

==== Enabled and disabled beans
Expand Down Expand Up @@ -102,10 +99,6 @@ A bean is eligible for injection to a certain injection point if:
* it is available for injection in the module that contains the class that declares the injection point, and
* it is assignable to the injection point (using <<assignable_parameters>>).


For a custom implementation of the `Bean` interface defined in <<bean>>, the container calls `getTypes()` and `getQualifiers()` to determine the bean types and qualifiers.
// TODO this refers to Portable Extensions, maybe move to Full? maybe mention Build Compatible Extensions?

[[unsatisfied_and_ambig_dependencies]]

==== Unsatisfied and ambiguous dependencies
Expand All @@ -124,9 +117,6 @@ If there is exactly one bean remaining, the container will select this bean, and
The container must validate all injection points of all enabled beans, all observer methods and all disposer methods when the application is initialized to ensure that there are no unsatisfied or unresolvable ambiguous dependencies.
If an unsatisfied or unresolvable ambiguous dependency exists, the container automatically detects the problem and treats it as a deployment problem.

For a custom implementation of the `Bean` interface defined in <<bean>>, the container calls `getInjectionPoints()` to determine the set of injection points.
// TODO this refers to Portable Extensions, maybe move to Full? maybe mention Build Compatible Extensions?

[[legal_injection_point_types]]

==== Legal injection point types
Expand Down Expand Up @@ -309,11 +299,6 @@ In certain scenarios, for example if a request scoped bean is injected into a se
* The container may use a client proxy when creating beans with circular dependencies.
This is only necessary when the circular dependencies are initialized via a managed bean constructor or producer method parameter.
(Beans with scope `@Dependent` never have circular dependencies.)
* Finally, client proxies may be passivated, even when the bean itself may not be.
Therefore the container must use a client proxy whenever a bean with normal scope is injected into a bean with a passivating scope, as defined in <<passivating_scope>>.
(On the other hand, beans with scope `@Dependent` must be serialized along with their client.)
// TODO move passivation to Full?


Client proxies are never required for a bean whose scope is a pseudo-scope such as `@Dependent`.

Expand Down Expand Up @@ -471,8 +456,7 @@ Behavior of this method in {cdi_full} is specified therein.
* The `isDelegate()` method may, in {cdi_lite} environment, always return `false`.
Behavior of this method in {cdi_full} is specified therein.
* The `isTransient()` method returns `true` if the injection point is a transient field, and `false` otherwise.
If the injection point represents a dynamically obtained instance then the `isTransient()` method returns `true` if the `Instance` injection point is a transient field, and `false` otherwise. If this injection point is declared as transient, after bean's passivation, the value will not be restored. Instance<> injection point is the preferred approach.
// TODO move passivation to Full?
If the injection point represents a dynamically obtained instance then the `isTransient()` method returns `true` if the `Instance` injection point is a transient field, and `false` otherwise.

Occasionally, a bean with scope `@Dependent` needs to access metadata relating to the object into which it is injected.
For example, the following producer method creates injectable `Logger` s.
Expand All @@ -486,8 +470,6 @@ The log category of a `Logger` depends upon the class of the object into which i
----

The container must provide a bean with scope `@Dependent`, bean type `InjectionPoint` and qualifier `@Default`, allowing dependent objects, as defined in <<dependent_objects>>, to obtain information about the injection point to which they belong.
The built-in implementation must be a passivation capable dependency, as defined in <<passivation_capable_dependency>>.
// TODO move passivation to Full?
manovotn marked this conversation as resolved.
Show resolved Hide resolved

If a bean that declares any scope other than `@Dependent` has an injection point of type `InjectionPoint` and qualifier `@Default`, the container automatically detects the problem and treats it as a definition error.

Expand Down Expand Up @@ -746,9 +728,6 @@ The container must provide a built-in bean that:
* has no bean name, and
* has an implementation provided automatically by the container.

The built-in implementation must be a passivation capable dependency, as defined in <<passivation_capable_dependency>>.
// TODO move passivation to Full?

[[annotationliteral_typeliteral]]

==== Using `AnnotationLiteral` and `TypeLiteral`
Expand Down Expand Up @@ -790,7 +769,6 @@ The following built-in annotations define a `Literal` static nested class to sup
* `jakarta.enterprise.inject.Any`
* `jakarta.enterprise.inject.Default`
* `jakarta.enterprise.inject.Specializes`
// TODO move to Full?
Ladicek marked this conversation as resolved.
Show resolved Hide resolved
* `jakarta.enterprise.inject.Vetoed`
* `jakarta.enterprise.util.Nonbinding`
* `jakarta.enterprise.context.Initialized`
Expand All @@ -800,7 +778,6 @@ The following built-in annotations define a `Literal` static nested class to sup
* `jakarta.enterprise.context.ApplicationScoped`
* `jakarta.enterprise.context.Dependent`
* `jakarta.enterprise.context.ConversationScoped`
// TODO move to Full?
* `jakarta.enterprise.inject.Alternative`
* `jakarta.enterprise.inject.Typed`

Expand Down
43 changes: 42 additions & 1 deletion spec/src/main/asciidoc/core/injectionandresolution_full.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ An alternative is not available for injection, lookup or name resolution to clas

{cdi_full} provides an additional way to select alternatives to the one defined in <<declaring_selected_alternatives_application>>.

[[declaring_selected_alternatives_application_full]]

===== Declaring selected alternatives for an application in {cdi_full}

In addition to rules defined in <<declaring_selected_alternatives_application>>, the following rule applies.

Custom bean implementations which are also alternatives may implement <<prioritized, Prioritized interface>> in which case they will be enabled for entire application with given priority.
manovotn marked this conversation as resolved.
Show resolved Hide resolved

[[declaring_selected_alternatives_bean_archive]]

===== Declaring selected alternatives for a bean archive
Expand Down Expand Up @@ -57,7 +65,6 @@ If there is no annotation with the specified name, or the annotation is not an `
If the same type is listed twice under the `<alternatives>` element, the container automatically detects the problem and treats it as a deployment problem.

For a custom implementation of the `Bean` interface defined in <<bean>>, the container calls `isAlternative()` to determine whether the bean is an alternative, and `getBeanClass()` and `getStereotypes()` to determine whether an alternative is selected in a certain bean archive.
// TODO this refers to Portable Extensions, maybe move to Full? maybe mention Build Compatible Extensions?

[[enablement_full]]

Expand Down Expand Up @@ -111,6 +118,8 @@ In addition to rules defined in <<performing_typesafe_resolution>>, the followin

* Parameterized and raw types are considered to match if they are identical or if the bean type is _assignable_ to the required type, as defined in <<assignable_parameters>> or <<delegate_assignable_parameters>>.

Furthermore, for a custom implementation of the `Bean` interface defined in <<bean>>, the container calls `getTypes()` and `getQualifiers()` to determine the bean types and qualifiers.

[[unsatisfied_and_ambig_dependencies_full]]

==== Unsatisfied and ambiguous dependencies in {cdi_full}
Expand All @@ -119,6 +128,8 @@ In addition to rules defined in <<unsatisfied_and_ambig_dependencies>>, the foll

An unsatisfied or ambiguous dependency cannot exist for a decorator delegate injection point, defined in <<delegate_attribute>>.

Furthermore, for a custom implementation of the `Bean` interface defined in <<bean>>, the container calls `getInjectionPoints()` to determine the set of injection points.

[[assignable_parameters_full]]

==== Assignability of raw and parameterized types in {cdi_full}
Expand All @@ -138,6 +149,18 @@ In addition to rules defined in <<ambig_names>>, the following rules apply.
When an ambiguous name exists, the container attempts to resolve the ambiguity.
The container eliminates all eligible beans that are not alternatives selected for the bean archive or selected for the application, except for producer methods and fields of beans that are alternatives.

[[client_proxies_full]]

=== Client proxies in {cdi_full}

In addition to the reasons for indirection defined in <<client_proxies>>, in {cdi_full} client proxies may be passivated, even when the bean itself may not be.
Therefore, the container must use a client proxy whenever a bean with normal scope is injected into a bean with a passivating scope, as defined in <<passivating_scope>>.
(On the other hand, beans with scope `@Dependent` must be serialized along with their client.)

manovotn marked this conversation as resolved.
Show resolved Hide resolved
[[injection_full]]

=== Dependency injection in {cdi_full}

==== Injection point metadata in {cdi_full}

The behavior of `InjectionPoint` metadata is overridden as follows:
Expand All @@ -147,6 +170,10 @@ If the injection point represents a dynamically obtained instance, then the `get
* The `isDelegate()` method returns `true` if the injection point is a decorator delegate injection point, and `false` otherwise.
If the injection point represents a dynamically obtained instance then `isDelegate()` returns false.

If the injection point represents a dynamically obtained instance then the `isTransient()` method returns `true` if the `Instance` injection point is a transient field, and `false` otherwise. If this injection point is declared as transient, after bean's passivation, the value will not be restored. Instance<> injection point is the preferred approach.

In {cdi_full}, the built-in implementation of `InjectionPoint` must be a passivation capable dependency, as defined in <<passivation_capable_dependency>>.

[[bean_metadata_full]]

==== Bean metadata in {cdi_full}
Expand Down Expand Up @@ -175,3 +202,17 @@ If:
* the injection point is a field, an initializer method parameter or a bean constructor of a decorator, with qualifier `@Decorated`, then the type parameter of the injected `Bean` must be the same as the delegate type.

Otherwise, the container automatically detects the problem and treats it as a definition error.

[[programmatic_lookup_full]]

=== Programmatic lookup in {cdi_full}

[[dynamic_lookup_full]]

==== The `Instance` interface in {cdi_full}

[[builtin_instance_full]]

==== The built-in `Instance` in {cdi_full}

In addition to rules defined in <<builtin_instance>>, the built-in implementation of `Instance` must be a passivation capable dependency, as defined in <<passivation_capable_dependency>>.
19 changes: 4 additions & 15 deletions spec/src/main/asciidoc/core/lifecycle.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,17 @@ In this case, any object returned by the producer method will not have any depen

=== Container invocations and interception

When the application invokes:

* a method of a bean via a contextual reference to the bean, as defined in <<contextual_reference>>,
* a method of a bean via a non-contextual reference to the bean, if the instance was created by the container (e.g. using `InjectionTarget.produce()` or `UnmanagedInstance.produce()`), or
// TODO mentions Full-only concepts
* a method of a bean via a non-contextual reference to the bean, if the instance was enhanced with the `InterceptionFactory` interface as defined in <<interception_factory>>,
// TODO mentions Full-only concepts

the invocation is treated as a _business method invocation_.
When the application invokes a method of a bean via a contextual reference to the bean, as defined in <<contextual_reference>>, the invocation is treated as a _business method invocation_.

When the container invokes a method of a bean, the invocation may or may not be treated as a business method invocation:

* Invocations of initializer methods by the container are not business method invocations.
* Invocations of producer, disposer and observer methods by the container are business method invocations and are intercepted by method interceptors and decorators.
// TODO mentions decorators
* Invocations of producer, disposer and observer methods by the container are business method invocations and are intercepted by method interceptors.
* Invocation of lifecycle callbacks by the container are not business method invocations, but are intercepted by interceptors for lifecycle callbacks.
* Invocations of interceptors and decorator methods during method or lifecycle callback interception are not business method invocations, and therefore no recursive interception occurs.
// TODO mentions decorators
* Invocations of interceptor methods during method or lifecycle callback interception are not business method invocations, and therefore no recursive interception occurs.
* Invocations of methods declared by `java.lang.Object` are not business method invocations.

A method invocation passes through method interceptors and decorators if, and only if, it is a business method invocation.
// TODO mentions decorators
A method invocation passes through method interceptors if, and only if, it is a business method invocation.

Otherwise, the invocation is treated as a normal Java method call and is not intercepted by the container.

Expand Down
29 changes: 29 additions & 0 deletions spec/src/main/asciidoc/core/lifecycle_full.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[lifecycle_full]]

== Lifecycle of contextual instances in {cdi_full}

[[biz_method_full]]

=== Container invocations and interception in {cdi_full}

Instead of the rules in <<biz_method>>, the following rules apply in {cdi_full}.

When the application invokes:

* a method of a bean via a contextual reference to the bean, as defined in <<contextual_reference>>,
* a method of a bean via a non-contextual reference to the bean, if the instance was created by the container (e.g. using `InjectionTarget.produce()` or `UnmanagedInstance.produce()`, or
* a method of a bean via a non-contextual reference to the bean, if the instance was enhanced with the `InterceptionFactory` interface as defined in <<interception_factory>>,

the invocation is treated as a _business method invocation_.

When the container invokes a method of a bean, the invocation may or may not be treated as a business method invocation:

* Invocations of initializer methods by the container are not business method invocations.
* Invocations of producer, disposer and observer methods by the container are business method invocations and are intercepted by method interceptors and decorators.
* Invocation of lifecycle callbacks by the container are not business method invocations, but are intercepted by interceptors for lifecycle callbacks.
* Invocations of interceptors and decorator methods during method or lifecycle callback interception are not business method invocations, and therefore no recursive interception occurs.
* Invocations of methods declared by `java.lang.Object` are not business method invocations.

A method invocation passes through method interceptors and decorators if, and only if, it is a business method invocation.

Otherwise, the invocation is treated as a normal Java method call and is not intercepted by the container.