typetools / typetools/checker-framework
Issue error if type arguments differ when the same interface is inherited by multiple super types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
If a class implements the same interface as its super class, then the AnnotatedTypeMirrors of type arguments must be equivalent. If they are not, an error should be issued. For example,
interface Interface<T> {}
class B implements Interface<@NonNull Integer> {}
class A extends B implements Interface<@Nullable Integer> {}
An error should be issued at A's declaration. This is consistent with the error issued by javac if they java types where not the same.
interface Interface<T> {}
class B implements Interface<Integer> {}
class A extends B implements Interface<String> {}
The code above issues the error below:
error: Interface cannot be inherited with different arguments: <java.lang.String> and <java.lang.Integer>
class A extends B implements Interface<String> {}
^
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
No files or tests are named. Start by locating the Java type-checking logic that handles inherited interfaces and compare the AnnotatedTypeMirrors for repeated interface type arguments; done means reporting an error at A's declaration when those arguments differ, with a regression test for the examples.
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