-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
External Library Models: Adding support for @nullable Method paramete…
…rs (#1006) With these changes we can read annotations from method parameters and use them with our External Library Models in the following manner. Externally annotated code example: ```java @NullMarked public class ParameterAnnotationExample { public static Integer add(Integer a, Integer b) { return a + b; } public static Object getNewObjectIfNull(@nullable Object object) { if (object == null) { return new Object(); } else { return object; } } } ``` ```java class Test { static ParameterAnnotationExample annotationExample = new ParameterAnnotationExample(); static void testPositive() { // BUG: Diagnostic contains: passing @nullable parameter 'null' where @nonnull is required annotationExample.add(5,null); } static void testNegative() { annotationExample.getNewObjectIfNull(null); } } ``` In order to accomplish this, we had to change the `astubx` format to use fully-qualified names for argument and return types. This also required changes to JarInfer. These are backward-incompatible changes, so we have changed the magic number for `astubx` files. --------- Co-authored-by: Manu Sridharan <[email protected]>
- Loading branch information
Showing
17 changed files
with
713 additions
and
68 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
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
Oops, something went wrong.