You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[type-safe property references] deal with multiple references at once #1860
List<Category> all = repository.findAll(Sort.by("name", "description"));
we have multiple (in this case two) references to properties. At the moment, there is a warning and a quick fix showing up for each individually, but if you apply one of the quick fixes, the code ends up being broken due to the mixture of type-safe and stringly references to properties. It would be better if the quick fix would turn both properties into the type-safe variant in one go. Therefore, there should probably also be just one warning that underlines both strings in one range.
I minor polish suggestion: if there are multiple references in the warning, it should be Non type-safe property references for domain type 'Category' (plural for reference)
I also observe that the quick fix to fix all stringly references in the file to the type-safe variant doesn't cover all occurrences. I am using spring-data-examples/jdbc/basics/src/test/java/example/springdata/jdbc/queryQueryTests.java as the example.
The warning in queryFilterWithStringPropertyPath doesn't have the quick fix for "all in file", whereas the quick fix in sortBySinglePropertyWithStringPropertyPath has the "all-in-file" quick fix, but executing that quick fix also doesn't cover the case in queryFilterWithStringPropertyPath. It looks like the "all-in-file" quick fix covers "all" the sorting related property references OR all the references in query criteria.
We could either have the "all-in-file" quick fix really fixing all the stringly references or have the quick fix label expressing that only specific references are converted.
I'm aware of that and I wasn't sure what to do for those cases... The cases when domain type is not exact but a high probability guess I've decided not to fix... I don't know what is better just pick the most probable fix and attempt to fix all or leave those cases out..
I'm aware of that and I wasn't sure what to do for those cases... The cases when domain type is not exact but a high probability guess I've decided not to fix... I don't know what is better just pick the most probable fix and attempt to fix all or leave those cases out..
Not sure I understand that. In my case above, all the stringly property references are nicely identified and get the right quick fix, but the "fix all" quick fix seems to cover only a specific subset of the warnings (either those from queries or those from sorting)
You're right... It should have been an exact domain type match in queryFilterWithStringPropertyPath... I'll see why it isn't
I think the validation does all this correctly, the domain type match is exact and the quick fix works perfectly. As said above:
The warning in queryFilterWithStringPropertyPath doesn't have the quick fix for "all in file", whereas the quick fix in sortBySinglePropertyWithStringPropertyPath has the "all-in-file" quick fix, but executing that quick fix also doesn't cover the case in queryFilterWithStringPropertyPath. It looks like the "all-in-file" quick fix covers "all" the sorting related property references OR all the references in query criteria.
Activity
martinlippert commentedon Mar 31, 2026
I minor polish suggestion: if there are multiple references in the warning, it should be
Non type-safe property references for domain type 'Category'(plural forreference)I also observe that the quick fix to fix all stringly references in the file to the type-safe variant doesn't cover all occurrences. I am using
spring-data-examples/jdbc/basics/src/test/java/example/springdata/jdbc/queryQueryTests.javaas the example.The warning in
queryFilterWithStringPropertyPathdoesn't have the quick fix for "all in file", whereas the quick fix insortBySinglePropertyWithStringPropertyPathhas the "all-in-file" quick fix, but executing that quick fix also doesn't cover the case inqueryFilterWithStringPropertyPath. It looks like the "all-in-file" quick fix covers "all" the sorting related property references OR all the references in query criteria.We could either have the "all-in-file" quick fix really fixing all the stringly references or have the quick fix label expressing that only specific references are converted.
BoykoAlex commentedon Mar 31, 2026
I'm aware of that and I wasn't sure what to do for those cases... The cases when domain type is not exact but a high probability guess I've decided not to fix... I don't know what is better just pick the most probable fix and attempt to fix all or leave those cases out..
martinlippert commentedon Mar 31, 2026
Not sure I understand that. In my case above, all the stringly property references are nicely identified and get the right quick fix, but the "fix all" quick fix seems to cover only a specific subset of the warnings (either those from queries or those from sorting)
BoykoAlex commentedon Mar 31, 2026
You're right... It should have been an exact domain type match in
queryFilterWithStringPropertyPath... I'll see why it isn'tmartinlippert commentedon Mar 31, 2026
I think the validation does all this correctly, the domain type match is exact and the quick fix works perfectly. As said above:
martinlippert commentedon Apr 1, 2026
Looks awesome now, great work!!!