Fix NPE when a workflow implementation uses a composed @WorkflowImpl annotation - #3024
Open
muhrifqii wants to merge 2 commits into
Open
Fix NPE when a workflow implementation uses a composed @WorkflowImpl annotation#3024muhrifqii wants to merge 2 commits into
muhrifqii wants to merge 2 commits into
Conversation
maciejdudko
requested changes
Aug 21, 2026
maciejdudko
left a comment
Contributor
There was a problem hiding this comment.
Hi @muhrifqii, thank you for your contribution and for reporting the problem. I have reviewed the PR and I think it's good, it just needs one correction to tests before we can merge it (see comment).
| Workflow.newActivityStub( | ||
| ComposedAnnotatedActivity.class, | ||
| ActivityOptions.newBuilder() | ||
| .setStartToCloseTimeout(Duration.ofSeconds(1)) |
Contributor
There was a problem hiding this comment.
Timeout needs to be longer so that it works reliably in CI environment.
Suggested change
| .setStartToCloseTimeout(Duration.ofSeconds(1)) | |
| .setStartToCloseTimeout(Duration.ofSeconds(10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
WorkersTemplate#configureWorkflowImplementationsByWorkerNamenow usesAnnotationUtils.findAnnotationinstead ofClass#getAnnotationto look up@WorkflowImpl.Added
AutoDiscoveryComposedAnnotationTestand a dedicatedcomposedannotationfixture package that reproduce the bug with a user-defined composed annotation on both a workflow and an activity implementation.Why?
If a workflow implementation class is annotated with a custom composed (meta) annotation, for example a user-defined annotation that is itself annotated with
@WorkflowImpl, rather than@WorkflowImplapplied directly - worker auto-discovery threw an NPE.Class#getAnnotationonly resolves annotations present directly on the class, so it returnednull, and the next line (annotation.workers()) NPE'd.@ActivityImpl/@NexusServiceImpllookups were already consistent throughout, which is why only workflows registered viaworkers()were affected.Checklist
Closes N/A - found while implementing
temporal-spring-boot-autoconfigurein an application with a custom composed annotation.How was this tested:
Added
AutoDiscoveryComposedAnnotationTest, confirmed it reproduces the NPE before the fix and passes afterRan the full
temporal-spring-boot-autoconfiguretest suite; all tests pass.Any docs updates needed?
No.