-
Notifications
You must be signed in to change notification settings - Fork 376
KeyFor Checker: Convert annotations with parse errors to top for method invocations. #7052
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
523ed7e
Converted parse errors to top for method invocations.
smillst 661ff3f
Fix some errors.
smillst e4d676d
Corrections.
smillst fa9a5db
Only do this on KeyFor.
smillst 0adda6d
Add comments.
smillst c705d7c
Revert some changes.
smillst e85b693
More more code to KeyForDependentTypesHelper.
smillst c9f7d7a
Fix errors.
smillst 241afcb
Merge branch 'master' into unknownJavaExpressions
smillst 391ce01
Add not about unsoundness.
smillst 43abe21
Merge branch 'unknownJavaExpressions' of github.com:smillst/checker-f…
smillst 3c2af29
Merge ../checker-framework-branch-master into unknownJavaExpressions
mernst 0bf38a7
Improve grammar
mernst d97a299
Merge branch 'unknownJavaExpressions' of github.com:smillst/checker-f…
mernst b9bce37
Move comment
mernst 7741a6d
Address code review.
smillst f711669
Merge ../checker-framework-branch-master into unknownJavaExpressions
mernst e7d2b81
Rename variable
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 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,14 @@ | ||
package open.falsepos; | ||
|
||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
class Issue6520 { | ||
|
||
private record Data(String value) {} | ||
|
||
Issue6520(Stream<Data> data) { | ||
data.collect(Collectors.groupingBy(Data::value)).entrySet().stream() | ||
.filter(entry -> entry.getValue().size() > 1); | ||
} | ||
} |
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,47 @@ | ||
package open.falsepos; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
import org.checkerframework.checker.nullness.qual.KeyFor; | ||
|
||
public record Issue6750(String type) { | ||
|
||
void needKeyFor(@KeyFor("#2") String s, Map<String, String> map) { | ||
throw new RuntimeException(); | ||
} | ||
|
||
@KeyFor("#1") String returnKeyFor(Map<String, String> map) { | ||
throw new RuntimeException(); | ||
} | ||
|
||
Map<String, String> getMap(Function<String, String> s) { | ||
throw new RuntimeException(); | ||
} | ||
|
||
void use() { | ||
// :: error: (argument) | ||
needKeyFor("", getMap(String::toString)); | ||
// :: error: (expression.unparsable) :: error: (assignment) | ||
@KeyFor("getMap(String::toString)") String s = returnKeyFor(new HashMap<>(getMap(String::toString))); | ||
} | ||
|
||
void method(List<Issue6750> externals) { | ||
externals.stream().collect(Collectors.groupingBy(Issue6750::type)).entrySet().stream() | ||
.forEach( | ||
values -> { | ||
// :: error: (assignment) | ||
@KeyFor({}) String b = values.getKey(); | ||
}); | ||
} | ||
|
||
void test(List<Issue6750> externals) { | ||
externals.stream().collect(Collectors.groupingBy(Issue6750::type)).entrySet().stream() | ||
.forEach( | ||
values -> { | ||
throw new RuntimeException(""); | ||
}); | ||
} | ||
} |
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
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.
Uh oh!
There was an error while loading. Please reload this page.