diff --git a/backend/src/main/java/org/booklore/app/service/AppBookService.java b/backend/src/main/java/org/booklore/app/service/AppBookService.java index 6a9de1822..02f4c8a5c 100644 --- a/backend/src/main/java/org/booklore/app/service/AppBookService.java +++ b/backend/src/main/java/org/booklore/app/service/AppBookService.java @@ -1051,7 +1051,7 @@ public class AppBookService { specs.add(AppBookSpecification.withProgress(userId, true)); } - return AppBookSpecification.combine(specs.toArray(new Specification[0])); + return AppBookSpecification.combine(specs.toArray(Specification[]::new)); } private String getSortField(String sortBy) { @@ -1118,7 +1118,7 @@ public class AppBookService { specs.add(AppBookSpecification.inLibrary(libraryId)); } - return AppBookSpecification.combine(specs.toArray(new Specification[0])); + return AppBookSpecification.combine(specs.toArray(Specification[]::new)); } private AppPageResponse buildPageResponse( diff --git a/backend/src/main/java/org/booklore/app/service/AppSeriesService.java b/backend/src/main/java/org/booklore/app/service/AppSeriesService.java index 3a368a618..06baadee6 100644 --- a/backend/src/main/java/org/booklore/app/service/AppSeriesService.java +++ b/backend/src/main/java/org/booklore/app/service/AppSeriesService.java @@ -373,7 +373,7 @@ public class AppSeriesService { specs.add(AppBookSpecification.inLibrary(libraryId)); } - return AppBookSpecification.combine(specs.toArray(new Specification[0])); + return AppBookSpecification.combine(specs.toArray(Specification[]::new)); } private Map getProgressMap(Long userId, Set bookIds) { diff --git a/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java b/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java index 2d680fc5a..b0aff9ddb 100644 --- a/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java +++ b/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java @@ -274,7 +274,7 @@ public class AppBookSpecification { .where(cb.equal(bfRoot.get("bookType"), ft)); predicates.add(root.get("id").in(sub)); } - return cb.and(predicates.toArray(new Predicate[0])); + return cb.and(predicates.toArray(Predicate[]::new)); } Subquery sub = query.subquery(Long.class); @@ -581,7 +581,7 @@ public class AppBookSpecification { default -> throw new APIException("Invalid ageRating bucket ID: " + id, HttpStatus.BAD_REQUEST); }); } - Predicate combined = cb.or(predicates.toArray(new Predicate[0])); + Predicate combined = cb.or(predicates.toArray(Predicate[]::new)); return "not".equals(mode) ? cb.not(combined) : combined; }; } @@ -613,7 +613,7 @@ public class AppBookSpecification { default -> throw new APIException("Invalid matchScore bucket ID: " + id, HttpStatus.BAD_REQUEST); }); } - Predicate combined = cb.or(predicates.toArray(new Predicate[0])); + Predicate combined = cb.or(predicates.toArray(Predicate[]::new)); return "not".equals(mode) ? cb.not(combined) : combined; }; } @@ -663,7 +663,7 @@ public class AppBookSpecification { sub.select(cb.literal(1L)) .where(cb.equal(bfJoin.get("id"), minIdSub), - cb.or(predicates.toArray(new Predicate[0]))); + cb.or(predicates.toArray(Predicate[]::new))); return "not".equals(mode) ? cb.not(cb.exists(sub)) : cb.exists(sub); }; @@ -728,7 +728,7 @@ public class AppBookSpecification { default -> throw new APIException("Invalid " + fieldName + " bucket ID: " + id, HttpStatus.BAD_REQUEST); }); } - Predicate combined = cb.or(predicates.toArray(new Predicate[0])); + Predicate combined = cb.or(predicates.toArray(Predicate[]::new)); return "not".equals(mode) ? cb.not(combined) : combined; }; } @@ -752,7 +752,7 @@ public class AppBookSpecification { default -> throw new APIException("Invalid pageCount bucket ID: " + id, HttpStatus.BAD_REQUEST); }); } - Predicate combined = cb.or(predicates.toArray(new Predicate[0])); + Predicate combined = cb.or(predicates.toArray(Predicate[]::new)); return "not".equals(mode) ? cb.not(combined) : combined; }; } @@ -823,7 +823,7 @@ public class AppBookSpecification { sub.select(cb.literal(1L)).where(cb.equal(subShelves.get("id"), id)); predicates.add(cb.exists(sub)); } - return cb.and(predicates.toArray(new Predicate[0])); + return cb.and(predicates.toArray(Predicate[]::new)); } Subquery sub = query.subquery(Long.class); @@ -875,13 +875,13 @@ public class AppBookSpecification { where.add(cb.equal(mappingRoot.get("role"), role)); } - sub.select(cb.literal(1L)).where(where.toArray(new Predicate[0])); + sub.select(cb.literal(1L)).where(where.toArray(Predicate[]::new)); predicates.add(cb.exists(sub)); } Predicate combined = "and".equals(mode) - ? cb.and(predicates.toArray(new Predicate[0])) - : cb.or(predicates.toArray(new Predicate[0])); + ? cb.and(predicates.toArray(Predicate[]::new)) + : cb.or(predicates.toArray(Predicate[]::new)); return "not".equals(mode) ? cb.not(combined) : combined; }; } @@ -953,7 +953,7 @@ public class AppBookSpecification { ); predicates.add(cb.exists(sub)); } - return cb.and(predicates.toArray(new Predicate[0])); + return cb.and(predicates.toArray(Predicate[]::new)); } // OR or NOT: single EXISTS subquery with IN clause diff --git a/backend/src/main/java/org/booklore/config/security/SecurityConfig.java b/backend/src/main/java/org/booklore/config/security/SecurityConfig.java index acdeaa527..60988fea3 100644 --- a/backend/src/main/java/org/booklore/config/security/SecurityConfig.java +++ b/backend/src/main/java/org/booklore/config/security/SecurityConfig.java @@ -85,7 +85,7 @@ public class SecurityConfig { .csrf(AbstractHttpConfigurer::disable) .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .authorizeHttpRequests(auth -> auth - .requestMatchers(unauthenticatedEndpoints.toArray(new String[0])).permitAll() + .requestMatchers(unauthenticatedEndpoints.toArray(String[]::new)).permitAll() .anyRequest().authenticated() ) .httpBasic(basic -> basic diff --git a/backend/src/main/java/org/booklore/service/BookRuleEvaluatorService.java b/backend/src/main/java/org/booklore/service/BookRuleEvaluatorService.java index 367e622f7..d1e448039 100644 --- a/backend/src/main/java/org/booklore/service/BookRuleEvaluatorService.java +++ b/backend/src/main/java/org/booklore/service/BookRuleEvaluatorService.java @@ -88,8 +88,8 @@ public class BookRuleEvaluatorService { } return group.getJoin() == org.booklore.model.dto.JoinType.AND - ? cb.and(predicates.toArray(new Predicate[0])) - : cb.or(predicates.toArray(new Predicate[0])); + ? cb.and(predicates.toArray(Predicate[]::new)) + : cb.or(predicates.toArray(Predicate[]::new)); } private Predicate buildRulePredicate(Rule rule, CriteriaQuery query, CriteriaBuilder cb, Root root, Join progressJoin, Long userId) { @@ -870,7 +870,7 @@ public class BookRuleEvaluatorService { }) .toList(); - return cb.and(predicates.toArray(new Predicate[0])); + return cb.and(predicates.toArray(Predicate[]::new)); } else { Subquery subquery = query.subquery(Long.class); Root subRoot = subquery.from(BookEntity.class);