typetools / typetools/checker-framework
3.8:
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Iterator;
import java.util.List;
abstract class YourClassNameHere {
@Nullable Number foo(List<? extends Number> numbers) {
return getOnlyElement(numbers);
}
abstract <T> @Nullable T getOnlyElement(Iterable<T> values);
}
3.7: nullness verification OK
3.8:
Error: [type.argument.type.incompatible] incompatible type argument for type parameter T extends Object of getOnlyElement.
found : ?[ extends @UnknownKeyFor Number super @KeyForBottom Void]
required: [extends @UnknownKeyFor Object super @UnknownKeyFor null]
The error appears when trying to upgrade the Checker Framework from 3.7 to 3.8 in Apache Calcite.
CI: https://github.com/apache/calcite/pull/2294/checks?check_run_id=1531065596#step:4:263
PR: https://github.com/apache/calcite/pull/2294
It looks like the workaround is to declare getOnlyElement as getOnlyElement(Iterable<? extends T> values), however, Guava's signature is Iterables.getOnlyElement(Iterable<T> values)
Do you think it is CF issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Java snippet with Checker Framework 3.7 and 3.8, then inspect the linked Apache Calcite CI run and pull request. Trace the generic type-argument and nullness-checking diagnostics to determine whether the 3.8 behavior is a regression. Done means the behavior is explained and either corrected or documented with a confirmed workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100