-
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 documentation and resolve some open questions #515
Conversation
Hey @Ladicek currently on vacation until 30th of August. Will review when I get back! |
Sure, no worries, and enjoy! :-) |
api/src/main/java/jakarta/enterprise/lang/model/AnnotationInfo.java
Outdated
Show resolved
Hide resolved
- renamed/moved `AnnotationInfo.MEMBER_VALUE` to `AnnotationMember.VALUE` - replaced the phrase "component type" with "element type" when speaking about arrays, because JLS uses both and each has a different meaning - removed `ContextConfig`, custom context registration is now fully handled in `MetaAnnotations` - removed unnecessarily concrete language from `@SkipIfPortableExtensionPresent` - methods in the `Types` class now have more specific return types - implementations of `AnnotationInfo`, `AnnotationMember` and `AnnotationTarget` are now required to define `equals` and `hashCode`, and are explicitly not required to use a single object to represent a single construct - the `ClassInfo` declaration is now required to return annotations `@Inherited` from a superclass, per `@Inherited` spec and CDI spec - explicitly documented that `ClassInfo` doesn't provide access to nested classes or an enclosing class, and `PackageInfo` doesn't provide access to package members - corrected some language to distinguish between generic classes (before type argument application) and parameterized types (after type argument application) - specified meaning of `MethodInfo.name` and `returnType` for constructors, mirroring what reflection does (returning the declaring class) - defined how implicit bounds are represented in `TypeVariable` and `WildcardType` - removed `ObserverInfo.id()` - usage of `Optional` was eliminated everywhere - instead of "`void` type", we now always use "`void` pseudo-type" - added `@since 4.0` tags everywhere - changed `@link` tags to `@linkplain` if the link text isn't an identifier
c0ecb24
to
2d14e87
Compare
* @throws IllegalArgumentException if the {@code scopeAnnotation} isn't meta-annotated {@code @NormalScope} | ||
* or {@code @Scope} | ||
*/ | ||
void addContext(Class<? extends Annotation> scopeAnnotation, Class<? extends AlterableContext> contextClass); |
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.
Can we add variants that take a ClassInfo
for contextClass
since this is likely to be part of the implementation
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.
At this point (@Discovery
), there's no way how to obtain a ClassInfo
.
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.
All I can think of is we can change that parameter to String
, if Class
is bad.
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.
Ok leave it as is
// to the numeric primitive types and maybe String. I currently left the numeric | ||
// as* methods documented as coercing, while asString as not coercing, but this | ||
// needs more discussion. I personally don't like coercion here and would always | ||
// throw if the type mismatches. |
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.
Seems it is a slippery slope and just disallowing coercion may be easier to reason about. Having said that my current implementation is doing coercion
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'd prefer disallowing coercion, but again, I can be convinced otherwise :-)
|
||
// TODO what about constructors? | ||
/** | ||
* Returns the name of this method. In case of constructors, returns the binary name of the declaring 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.
Should it not return <init>
for constructors?
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.
It could do both. I thought class name would be better, as that's what reflection does, but I can be convinced otherwise.
Thanks! |
AnnotationInfo.MEMBER_VALUE
toAnnotationMember.VALUE
about arrays, because JLS uses both and each has a different meaning
ContextConfig
, custom context registration is now fullyhandled in
MetaAnnotations
@SkipIfPortableExtensionPresent
Types
class now have more specific return typesAnnotationInfo
,AnnotationMember
andAnnotationTarget
are now required to define
equals
andhashCode
, and are explicitlynot required to use a single object to represent a single construct
ClassInfo
declaration is now required to return annotations@Inherited
from a superclass, per@Inherited
spec and CDI specClassInfo
doesn't provide access to nestedclasses or an enclosing class, and
PackageInfo
doesn't provide accessto package members
type argument application) and parameterized types (after type argument
application)
MethodInfo.name
andreturnType
for constructors,mirroring what reflection does (returning the declaring class)
TypeVariable
and
WildcardType
ObserverInfo.id()
Optional
was eliminated everywherevoid
type", we now always use "void
pseudo-type"@since 4.0
tags everywhere@link
tags to@linkplain
if the link text isn't an identifier