Skip to content

Report non-string declarative recipe tags as validation errors#8162

Merged
timtebeek merged 1 commit into
mainfrom
tim/davis-v5
Jul 2, 2026
Merged

Report non-string declarative recipe tags as validation errors#8162
timtebeek merged 1 commit into
mainfrom
tim/davis-v5

Conversation

@timtebeek

@timtebeek timtebeek commented Jul 2, 2026

Copy link
Copy Markdown
Member
  • Fixes ClassCastException when declarative recipe tag is not a string #8161. A tag defined in a declarative YAML recipe as a non-string value (e.g. a mapping) slipped into the recipe's Set<String> through an erased cast, so a ClassCastException was thrown later when consumers iterated getTags(). YamlResourceLoader.mapToRecipe now filters tags to strings—keeping getTags() type-safe—and reports any non-string entry through the recipe's Validated channel so the malformed recipe surfaces via validate() instead of crashing. Added a YamlResourceLoaderTest case covering a mix of valid and invalid tags.

A tag defined as a non-string value (e.g. a mapping) slipped into the
recipe's Set<String> through an erased cast, causing a ClassCastException
later when consumers iterated getTags(). Filter tags to strings and
surface any non-string entry via recipe validation instead.

Fixes #8161
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jul 2, 2026
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Jul 2, 2026
@timtebeek timtebeek merged commit cb2b511 into main Jul 2, 2026
1 of 2 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jul 2, 2026
@timtebeek timtebeek deleted the tim/davis-v5 branch July 2, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ClassCastException when declarative recipe tag is not a string

1 participant