-
Notifications
You must be signed in to change notification settings - Fork 437
Fix false-negative when overriding method type-parameter bounds #7467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Suvrat1629
wants to merge
13
commits into
typetools:master
Choose a base branch
from
Suvrat1629:false-neg-6864
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
20559ab
add type parameter check for overriding functions
Suvrat1629 0918308
removing unnecessary files
Suvrat1629 985d365
removing unnecessary comments
Suvrat1629 23c561f
Merge branch 'master' into false-neg-6864
Suvrat1629 fccf46d
Merge branch 'master' into false-neg-6864
smillst 861acb3
Merge ../checker-framework-branch-master into false-neg-6864
mernst 9b5c018
Merge ../checker-framework-branch-master into false-neg-6864
mernst 66f84f5
Merge ../checker-framework-branch-master into false-neg-6864
mernst 9eb380b
Merge branch 'master' into false-neg-6864
mernst 1e18e30
Fix compilation error
mernst c4391f2
Add contributor
mernst ea6ec1a
Fixes
mernst 8c9585d
Rename files for uniqueness
mernst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
checker/jtreg/nullness/issue824/Class1.astub → .../jtreg/nullness/issue824/Issue824_1.astub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Issue824_2.java:14:39: compiler.err.proc.messager: [type.argument] | ||
| Issue824_2.java:15:20: compiler.err.proc.messager: [type.argument] | ||
| Issue824_2.java:15:45: compiler.err.proc.messager: [type.argument] | ||
| Issue824_2.java:16:27: compiler.err.proc.messager: [type.arguments.not.inferred] | ||
| Issue824_2.java:19:27: compiler.err.proc.messager: [type.arguments.not.inferred] | ||
| Issue824_2.java:20:26: compiler.err.proc.messager: [argument] | ||
| Issue824_2.java:24:14: compiler.err.proc.messager: [override.return] | ||
| Issue824_2.java:25:33: compiler.err.proc.messager: [type.arguments.not.inferred] | ||
| 8 errors |
2 changes: 1 addition & 1 deletion
2
...er/jtreg/nullness/issue824lib/Class1.java → ...treg/nullness/issue824lib/Issue824_1.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| public class Class1<Q> { | ||
| public class Issue824_1<Q> { | ||
| class Gen<S> {} | ||
|
|
||
| public <T> T methodTypeParam(T t) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import java.util.LinkedList; | ||
| import java.util.List; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| class Issue6864_A { | ||
| <T extends List<Integer>> T m(T x) { | ||
| return x; | ||
| } | ||
| } | ||
|
|
||
| class Issue6864_B extends Issue6864_A { | ||
| // :: error: [override.typeparam] | ||
| <T extends List<@Nullable Integer>> T m(T x) { | ||
| x.add(null); | ||
| return x; | ||
| } | ||
| } | ||
|
|
||
| public class Issue6864 { | ||
| public static void main(String[] args) { | ||
| Issue6864_A x = new Issue6864_B(); | ||
| List<Integer> y = new LinkedList<>(); | ||
| x.m(y).get(0).toString(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: typetools/checker-framework
Length of output: 200
Update the expected diagnostic in
Issue824_2.outfromoverride.returntooverride.typeparam.The test reference file currently expects
[override.return]at line 24, but the override check now correctly reports[override.typeparam]when the overriding method (<T> T methodTypeParam(T t)) fails to respect the superclass type-parameter bounds (<T extends@nonnullObject>). Update line 7 ofchecker/jtreg/nullness/issue824/Issue824_2.outaccordingly.🤖 Prompt for AI Agents