-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This update adds a code inspection feature that validates the correctness of include and exclude options used in Doma annotations by ensuring the specified field names exist in the argument type.
✅ Supported Annotations
The following Doma annotations are covered:
@Insert@Update@BatchInsert@BatchUpdate@MultiInsert@Returning
🔍 Validation Logic
-
The inspection checks that all field names listed in the
includeorexcludeoptions are defined within the method’s argument type. -
If the argument type contains embedded types (classes annotated with
@Embeddable), fields from those types are also considered valid. -
In cases where nested fields are specified (e.g.,
"address.city"), the logic follows the field chain:- Verifies that the top-level field exists in the parameter type.
- Resolves the field type and checks that the nested field exists within it.
🧾 Example
For the method below:
@Update(include = {"name", "salary"})
int update(Employee employee);The inspection verifies that:
- The parameter
employeeis of typeEmployee Employeehas fieldsnameandsalary- If not, an error highlight is shown on the invalid field name
This feature helps catch incorrect annotation parameter values early and ensures reliable mapping between annotation metadata and data model structure.