Skip to content

[4.x] Declarative Scheduling extension should not validate CDI beans #10807

@danielkec

Description

@danielkec

Environment Details

  • Helidon Version: 4.x
  • Helidon MP

Reported by @noahmonster

Problem Description

When user is advised to replace deprecated Scheduling annotations in CDI bean while having Helidon codegen active this check makes it impossible to use new scheduling annotations on a CDI bean.

    private void checkTypeIsService(RegistryRoundContext roundContext, TypeInfo typeInfo) {
        Optional<ClassModel.Builder> descriptor = roundContext.generatedType(ctx.descriptorType(typeInfo.typeName()));
        if (descriptor.isEmpty()) {
            throw new CodegenException("Type annotated with one of the scheduling annotations is not a service itself."
                                               + " It must be annotated with "
                                               + SERVICE_ANNOTATION_SINGLETON.classNameWithEnclosingNames() + ".",
                                       typeInfo.originatingElementValue());
        }
    }

We should apply the check only on declarative beans or ingnore CDI beans.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

High priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions