Skip to content

Exclude legacy @javax.validation.Constraint from convention-based annotation attribute override check #36412

@tknkrtl

Description

@tknkrtl

Overview

The AnnotationTypeMapping class attempts to exclude Bean Validation constraint annotations from attribute override validation logic to avoid unnecessary @AliasFor warnings on standard attributes like message, groups, and payload. However, the current implementation is strictly hard coded to jakarta.validation.Constraint.

annotation.annotationType().getName().equals("jakarta.validation.Constraint"

This check fails for custom constraints meta-annotated with the legacy javax.validation.Constraint (JSR-303/JSR-380).

Proposed Enhancement

Instead of an exact match, the framework should be namespace-agnostic regarding Bean Validation. I suggest:

  • Using endsWith(".validation.Constraint") to support both namespaces.
  • Or providing a fallback for the javax package to maintain backward compatibility for libraries that haven't fully migrated.

Related Issues

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions