-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generics checks for parameter passing (#746)
For method calls, the nullability annotations of the type parameters for formal parameter types and actual parameter types should be exactly the same. This pull request adds code to compare nullability annotations of actual and formal parameters of generic type and reports an error if the annotations don't match. example: ``` static class A<T extends @nullable Object> { } static A<String> sampleMethod(A<A<String>> a1, A<String> a2) { return a2; } static void methodCall(A<A<@nullable String>> a1, A<String> a2) { // **_here the code will report an error as the annotations of formal and actual parameters don't match_** A<String> a = sampleMethod(a1, a2); } ```
- Loading branch information
1 parent
07a3847
commit a1d1eed
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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 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