Skip to content

Commit

Permalink
Specify behavior for records and sealed types
Browse files Browse the repository at this point in the history
Records and sealed types are valid bean types, but they are unproxyable.
Further, sealed classes are not managed beans; their permitted subclasses
are, unless they are themselves also sealed.
  • Loading branch information
Ladicek committed Oct 3, 2023
1 parent 264a1a3 commit f3d06d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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 @@ -81,7 +81,7 @@ The bean types of a bean are used by the rules of typesafe resolution defined in

Almost any Java type may be a bean type of a bean:

* A bean type may be an interface, a concrete class or an abstract class, and may be declared final or have final methods.
* A bean type may be an interface, a concrete class or an abstract class or a record, may be declared sealed or non-sealed or final, and may have final methods.
* A bean type may be a parameterized type with actual type parameters and type variables.
* A bean type may be an array type.
Two array types are considered identical only if the element type is identical.
Expand Down
3 changes: 3 additions & 0 deletions spec/src/main/asciidoc/core/implementation.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ If the managed bean class is a generic type, it must have scope `@Dependent`. If
A Java class is a managed bean if it meets all of the following conditions:

* It is not an inner class.
* It is not a sealed class.
* It is a non-abstract class.
* It does not implement `jakarta.enterprise.inject.spi.Extension` or `jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension`.
* It is not annotated `@Vetoed` or in a package annotated `@Vetoed`.
Expand Down Expand Up @@ -662,6 +663,8 @@ Certain legal bean types cannot be proxied by the container:
* classes which don't have a non-private constructor with no parameters,
* classes which are declared final,
* classes which have non-static, final methods with public, protected or default visibility,
* records,
* sealed classes and sealed interfaces,
* primitive types,
* and array types.

Expand Down

0 comments on commit f3d06d0

Please sign in to comment.