-
Notifications
You must be signed in to change notification settings - Fork 77
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
improve extension API and resolve all remaining open questions #544
Conversation
@graemerocher There are 2 changes here that are worth highlighting. The The other thing is that
|
9330b41
to
93dc036
Compare
BTW, this completes the extension API (at least from my side). I'll write the accompanying specification text next. |
93dc036
to
fcf95e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could clarify in a comment how an implementor of the synthetic bean creator API is to create a bean looking up any additional instances using the Instance
parameter and then later dispose a bean plus diposing any beans created via the Instance
paramerer. That part is not 100% clear to me.
* | ||
* @return types of annotations that must be present on the <em>expected types</em> | ||
*/ | ||
Class<? extends Annotation>[] withAnnotations() default Annotation.class; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still concerned this defaults to any annotation. It should maybe be clarified that if not specified then only types with at least one bean defining annotation will be visited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a concern that visiting types with all annotations is impossible (in which case we may use Annotation.class
as a marker for default value, whatever that is), or that visiting types with all annotations is usually bad but still possible (in which case we'd have to create our own marker type)?
I mean, I'm fine with restricting that, just not sure to what annotations. Bean defining annotations are probably a good start, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I just noticed that Portable Extensions' @WithAnnotations
also treats a type annotated with given annotation if the type is annotated with some other annotation that is, in turn, meta-annotated with given annotation. Do we want to add that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes stereotypes meta-annotations are fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. This now looks like withAnnotations() default BeanDefiningAnnotations.class
, where BeanDefiningAnnotations
is a marker annotation type that represents the set of bean defining annotations.
fcf95e6
to
4361220
Compare
Do you mean here, or in the javadoc? In any case, it works like this:
EDIT: I also updated the comment above that describes how to implement the API that accepts |
4361220
to
94fe8fc
Compare
Added one more commit that moves the new extension API to the |
fc49019
to
3cf4d31
Compare
api/src/main/java/jakarta/enterprise/inject/build/spi/AnnotationBuilder.java
Outdated
Show resolved
Hide resolved
3cf4d31
to
94fe8fc
Compare
api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/BuildCompatibleExtension.java
Outdated
Show resolved
Hide resolved
869c143
to
2c5c21f
Compare
- settled on the name "Build Compatible Extensions" - renamed `@Processing` to `@Registration`, because if we ever want to introduce an extension phase for modifying beans before they are registered, _that_ should be called `@Processing` - moved the synthetic bean creation/destruction functions from the `CreationalContext` style to the `Instance` style - specified precisely how `ClassInfo.methods` and `fields` work, specified that `ClassConfig` behaves identically, and specified that an extension methods with parameters of type `MethodInfo` or `FieldInfo` also behave identically - removed the `@ExactType` and `@SubtypesOf` annotations and moved type queries directly to the `@Enhancement` and `@Registration` annotations - moved the `MetaAnnotations` API from accepting a callback to directly returning `ClassConfig` - specified lifecycle of `SyntheticBean{Creator,Disposer}` and `SyntheticObserver` - specified that `Messages.error` is treated as a deployment problem
2c5c21f
to
4cb5b5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Processing
to@Registration
, because if we ever wantto introduce an extension phase for modifying beans before they
are registered, that should be called
@Processing
the
CreationalContext
style to theInstance
styleClassInfo.methods
andfields
work,specified that
ClassConfig
behaves identically, and specifiedthat an extension methods with parameters of type
MethodInfo
or
FieldInfo
also behave identically@ExactType
and@SubtypesOf
annotations and movedtype queries directly to the
@Enhancement
and@Registration
annotations
MetaAnnotations
API from accepting a callbackto directly returning
ClassConfig
SyntheticBean{Creator,Disposer}
andSyntheticObserver
Messages.error
is treated as a deployment problem