lsp4jakarta
lsp4jakarta copied to clipboard
JEE11_Data: Repository methods must not declare invalid combinations of special parameters.
Description:
Repository methods must not declare invalid combinations of special parameters (multiple PageRequest/Limit, PageRequest+Limit, PageRequest/Limit with First, multiple Order).
A repository method must throw UnsupportedOperationException if it has:
- more than one parameter of type PageRequest or Limit,
- a parameter of type PageRequest and a parameter of type Limit,
- a parameter of type PageRequest or Limit, in combination with the keyword First, or
- more than one parameter of type Order.
Examples:
Invalid example 1
public interface ProductRepository extends DataRepository<Product, Long> {
Product findFirstByCategory(String category, Limit limit);
//Invalid: First + Limit
}
Invalid example 2
public interface ProductRepository extends DataRepository<Product, Long> {
List<Product> findAll(Order order1, Order order2);
// Invalid: more than one Order
}
Valid example
public interface ProductRepository extends DataRepository<Product, Long> {
List<Product> findAll(Order order);
//Valid: one Order parameter
}
Specification:
https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0#:~:text=A%20repository%20method%20must,of%20type%20Order
Type of language feature proposed:
Select all that apply
- [x] diagnostic
- [ ] quick-fix
- [ ] snippet
- [ ] other, please specify: