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

Fix invalid annotation literals #443

Merged
merged 1 commit into from
Sep 21, 2023

Commits on Mar 7, 2023

  1. Fix invalid annotation literals

    The `Annotation.equals()` contract directly states that for two
    annotation objects to be equal, they must (among others) both
    implement the [same] annotation interface.
    
    The CDI TCK used to create instances of memberless annotations
    simply by instantiating an anonymous subclass of `AnnotationLiteral`,
    which doesn't implement the annotation interface and hence is invalid.
    
    It has never been a problem, because `AnnotationLiteral` implements
    equality in a slightly more permissive manner: instead of checking
    that both objects implement the same annotation interface, it checks
    that both objects are annotations that have an equal `annotationType()`.
    It becomes problematic when an implementation uses a different mechanism
    to instantiate annotations than extending `AnnotationLiteral`, one that
    closely follows the `Annotation` contract.
    
    This commit replaces all usages of such anonymous subclasses by
    proper `AnnotationLiteral` subclasses that implement the annotation
    interface as well.
    Ladicek committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    c475f49 View commit details
    Browse the repository at this point in the history