typetools / typetools/checker-framework
Refinement of parameter types in overridden methods and polymorphic types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Here is an example of code that I would expect to type-check, but it issues an override.param.invalid error.
import org.checkerframework.checker.nullness.qual.*;
public class RefineOverrideShort {
class Super<T> {
void m6(@Nullable String s) { }
}
class Sub<T> extends Super<T> {
@Override
void m6(@PolyNull String s) { }
}
}
From a client's point of view, the subclass can be used in any situation that the superclass can be: there are no superclass calls that are illegal in the subclass. Therefore, I believe that the overriding should be permitted.
There are more test cases in file checker-framework/checker/tests/nullness/RefineOverride.java.
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 with checker-framework/checker/tests/nullness/RefineOverride.java and run the existing nullness tests to reproduce the override.param.invalid diagnostics for the provided RefineOverrideShort example. Trace the checker logic that validates parameter annotations in overridden methods, then add or adjust tests so the reported refinement and polymorphic cases match the intended type-checking behavior.
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