Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Many points in the code need to wrap ThreadLocal.get() in requireNonNull or castNonNull to keep checkerFramework happy. This change removes those, by providing a sub-class of ThreadLocal whose values are known to be never null.
In CALCITE-915 we added class TryThreadLocal to make it easier to remember to unset a thread-local value, and in commit f82028f4 we made its get method return a not-null value. But the only constructor was TryThreadLocal.of(T initialValue). In this change, we add TryThreadLocal.withSupplier(Supplier<T>), so that each thread can have its own value, and convert all uses of ThreadLocal where to use it.
Attachments
Issue Links
- is related to
-
CALCITE-6552 Enable CheckerFramework in 'server' module
- Closed
- relates to
-
CALCITE-915 Tests do not unset ThreadLocal values on exit
- Closed
- links to