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
Description: Eliminates hand-written getters, setters, equals, and hashCode. The compiler generates everything with correct immutable semantics. Reduces JAR bytecode.
Location: InterceptorHolder (line ~460)
Effort: Minimum
Replace RegistryStack (extends ArrayList) with ArrayDeque (medium)
Description: Inheriting from ArrayList exposes unnecessary public API and is an anti-pattern in JDK 17. ArrayDeque is the correct and more efficient implementation for stacks.
Location: RegistryStack (line ~410)
Effort: Low
Switch ThreadLocal.set(null) to ThreadLocal.remove() (low)
Description: set(null) does not remove the entry from the server thread pool (Tomcat/Jetty). remove() is the correct way to avoid memory leaks in environments with thread reuse.
Location: popThreadLocalRegistry (line ~385)
Effort: Minimum
Evaluate LinkedHashSet -> HashSet for ajaxTargetControls (low)
Description: LinkedHashSet maintains insertion order with extra memory cost. Check if order is semantically necessary; if not, HashSet reduces overhead.
Location: getAjaxTargetControls (line ~330)
Effort: Minimum
Remove lazy null-check in getAjaxTargetControls and getInterceptors (low)
Description: Initializing collections in the constructor with a small initial capacity (2–4) eliminates repeated checks per request without significant memory cost.
Description: Three methods with identical structure (double loop ajaxTargets + interceptors). Extracting to a generic private method with @FunctionalInterface reduces bytecode.
Tasks for ControlRegistry.java:
Convert InterceptorHolder to record (refat)
Replace RegistryStack (extends ArrayList) with ArrayDeque (medium)
Switch ThreadLocal.set(null) to ThreadLocal.remove() (low)
Evaluate LinkedHashSet -> HashSet for ajaxTargetControls (low)
Remove lazy null-check in getAjaxTargetControls and getInterceptors (low)
Consolidate processPreResponse / PreRenderHead / PreDestroy (refat)