Closed MaxKellermann closed 4 years ago
I have no idea :-)
No seriously. This is what FF
looks like:
public class FF {
[...]
private FF() {}
private static final ThreadLocal<FF> F = new ThreadLocal<FF>() {
@Override
public FF initialValue() {
return new FF();
}
};
public static FF f() {
return F.get();
}
}
FF.f()
returns an instance of FF
for the current thread. Each thread has its own instance of FF
.
Now some ContentDescription
classes save an instance of FF
as a member variable. I did (naively) assume here that ContentDescription
is always used in the UI-Thread. But you're right, there is no such guarantee.
I hope this is fixed.
I was wondering about
ContentDescription
and itsFF
variable.FF
is a helper which puts various thread-unsafe formatters into aThreadLocal
. So whenContentDescription
instance is created, it obtains aFF
instance for the current thread. Later, whenContentDescription
methods are called, thisFF
instance is used, but who guarantees that the calling thread is the same one which created theContentDescription
?If there is such a guarantee (or API constraint), it should be documented. I wishh there was more API documentation. I can write it while figuring out the AAT source code, but I need information, and so this issue aims to collect some information.