Skip to content

Review unused imports in classes in CDI 4 #600

@hjohn

Description

@hjohn

I'm seeing quite a lot of imports that are only used to refer to documentation while the class or interface itself is not dependent on such a class. Examples:

jakarta.enterprise.inject.Instance refers to jakarta.enterprise.util.AnnotationLiteral but only in @See

jakarta.enterprise.context.spi.Contextual refers to jakarta.enterprise.inject.CreationException only in docs

jakarta.enterprise.inject.spi refers to jakarta.enterprise.inject.Alternative and jakarta.enterprise.inject.Stereotype only in docs

jakarta.enterprise.inject.spi refers to jakarta.enterprise.context.Dependent, jakarta.enterprise.inject.Disposes, jakarta.enterprise.event.Observes and jakarta.enterprise.inject.Produces only in docs.

Is this intended? I personally consider this bad form and convert those to fully qualified names to avoid creating the illusion of dependencies on other parts of the system where there are none.

Note that if I remove those imports, a minimal set of classes (Contextual, CreationalContext, Instance, Annotated, Bean, BeanAttributes, InjectionPoint, TypeLiteral) could be extracted to support minimal implementations of this specification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions