Julian Hyde created CALCITE-6408:
------------------------------------
Summary: Not-null ThreadLocal
Key: CALCITE-6408
URL: https://issues.apache.org/jira/browse/CALCITE-6408
Project: Calcite
Issue Type: Improvement
Reporter: Julian Hyde
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|https://github.com/apache/calcite/commit/f82028f4b983707bd9af3d9ba73820ef2431e971]
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)