Skip to content

WW-4421 Fix duplicate @Action annotation check being skipped#1579

Open
lukaszlenart wants to merge 1 commit intomainfrom
fix/WW-4421-duplicate-action-annotation-check
Open

WW-4421 Fix duplicate @Action annotation check being skipped#1579
lukaszlenart wants to merge 1 commit intomainfrom
fix/WW-4421-duplicate-action-annotation-check

Conversation

@lukaszlenart
Copy link
Member

Summary

  • Fix duplicate @Action name detection being skipped when execute() is annotated with @Action
  • Extract the duplicate check loop to run unconditionally before the conditional block in PackageBasedActionConfigBuilder.buildConfiguration()
  • Add test fixtures and unit tests for both the previously-broken and already-working scenarios

Fixes WW-4421

Problem

The duplicate @Action name detection in PackageBasedActionConfigBuilder.buildConfiguration() was embedded inside a conditional block (!map.containsKey(DEFAULT_METHOD)) whose primary purpose is deciding whether to auto-create a mapping for execute(). When execute() is annotated with @Action, the condition is false and the entire duplicate detection is skipped — silently allowing two methods to map to the same action name, with one overwriting the other non-deterministically.

Changes

PackageBasedActionConfigBuilder.java — Moved the actionNames duplicate check loop before the if (!map.containsKey(DEFAULT_METHOD) ...) block so it runs for all annotated methods regardless of execute() annotation status.

Test fixtures:

  • DuplicateActionNameWithExecuteAnnotationAction@Action("duplicate") on both execute() and another method (the previously undetected case)
  • DuplicateActionNameWithoutExecuteAnnotationAction — unannotated execute() with two methods sharing @Action("duplicate") (regression guard)

PackageBasedActionConfigBuilderTest.java — Two new test methods verifying ConfigurationException is thrown in both scenarios.

Test plan

  • testDuplicateActionNameWithAnnotatedExecute passes (new — validates the fix)
  • testDuplicateActionNameWithoutAnnotatedExecute passes (regression guard)
  • All 117 convention plugin tests pass with no regressions

🤖 Generated with Claude Code

…) is annotated

The duplicate @action name detection in PackageBasedActionConfigBuilder
was embedded inside a conditional block that only ran when execute() was
NOT annotated with @action. This meant two methods could map to the same
action name silently when execute() had an @action annotation, with one
overwriting the other non-deterministically.

Extract the duplicate check to run unconditionally before the conditional
block, so it applies to all annotated methods regardless of whether
execute() is annotated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lukaszlenart lukaszlenart force-pushed the fix/WW-4421-duplicate-action-annotation-check branch from 99e4d49 to 7770119 Compare February 15, 2026 15:45
@lukaszlenart lukaszlenart added this to the 7.2.0 milestone Feb 15, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
70.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants