Hello,
TL;DR: It seems that most or all uses of getClass() produce [super @KeyForBottom Void] and the uses in the code expect [super @UnknownKeyFor NullType] starting with checkerframework 3.16.0. Is there some specific change in 3.16.0 that introduces this that I can learn about? Does anyone know how to work around it?
Details:
I am trying to upgrade the checkerframework version used by Apache Beam. When I reach 3.16.0 I hit a new issue I do not yet understand how to fix. The issue persists through 3.27.0. There are checker framework crashes in 3.16.0 and 3.17.0 that are not relevant, so I will submit my question with 3.18.0.
It seems most of the errors are roughly similar. Here is one (note that the method name is "TypeDescriptors.of" so it reads a little funny):
TypeDescriptors.java:354: error: [type.argument] incompatible type argument for type parameter T extends Object of of.
(TypeDescriptor<T>) TypeDescriptor.of(instance.getClass()), supertype, extractor);
^
found : capture#464[ extends @UnknownKeyFor Object super @KeyForBottom Void]
required: [extends @UnknownKeyFor Object super @UnknownKeyFor NullType]
The code in question:
public static <T, V> TypeDescriptor<V> extractFromTypeParameters(
@NonNull T instance, Class<? super T> supertype, TypeVariableExtractor<T, V> extractor) {
return extractFromTypeParameters(
(TypeDescriptor<T>) TypeDescriptor.of(instance.getClass()), supertype, extractor);
}
There are quite a few other similar, typically simple, uses.
Kenn