typetools / typetools/checker-framework
Dataflow: unexpected receiver type in MethodAccessNode in a subclass
Nobody has claimed this yet.
- #5184 by @mernst — closed without merging
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Snippet:
class Super1<T> {
T methodInner() {
return null;
}
}
class Sub1<U> extends Super1<U> {
U method() {
return methodInner();
// ^------------------- (this).methodInner
}
}
When superclass's method is invoked in a subclass, the receiver of the method points to superclass' type rather than subclass':
actual:
receiver.type = Super1<T>
expected:
receiver.type = Sub1<U>
This is problematic because I can't use receiver's type to determine if I need to substitute type params in method's type for the subclass.
The same is true for FieldAccessNode.
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 tracing the MethodAccessNode handling in the Dataflow implementation, then compare it with the related FieldAccessNode behavior described in the issue. Reproduce the generic superclass/subclass example and verify that both nodes expose the subclass receiver type, including the expected type-parameter substitution 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