-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(gapic-generator): Add Nullable annotation to generated classes #13558
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
base: main
Are you sure you want to change the base?
Changes from all commits
dc13ef7
56bb725
17b370c
22eb3e6
6f283eb
dc59d71
783d6b6
96dffb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ | |
| import java.util.concurrent.TimeUnit; | ||
| import javax.annotation.Generated; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
|
|
||
| // AUTO-GENERATED DOCUMENTATION AND CLASS. | ||
| /** | ||
|
|
@@ -360,7 +361,7 @@ | |
| @BetaApi | ||
| @Generated("by gapic-generator-java") | ||
| public class ComplianceClient implements BackgroundResource { | ||
| private final ComplianceSettings settings; | ||
| @Nullable private final ComplianceSettings settings; | ||
| private final ComplianceStub stub; | ||
|
|
||
| /** Constructs an instance of ComplianceClient with default settings. */ | ||
|
|
@@ -398,6 +399,7 @@ protected ComplianceClient(ComplianceStub stub) { | |
| this.stub = stub; | ||
| } | ||
|
|
||
| @Nullable | ||
|
nnicolee marked this conversation as resolved.
|
||
| public final ComplianceSettings getSettings() { | ||
| return settings; | ||
| } | ||
|
|
@@ -1548,8 +1550,8 @@ public static class ListLocationsPage | |
| ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { | ||
|
|
||
| private ListLocationsPage( | ||
| PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| ListLocationsResponse response) { | ||
| @Nullable PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| @Nullable ListLocationsResponse response) { | ||
| super(context, response); | ||
| } | ||
|
|
||
|
|
@@ -1559,14 +1561,14 @@ private static ListLocationsPage createEmptyPage() { | |
|
|
||
| @Override | ||
| protected ListLocationsPage createPage( | ||
| PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| ListLocationsResponse response) { | ||
| @Nullable PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| @Nullable ListLocationsResponse response) { | ||
| return new ListLocationsPage(context, response); | ||
| } | ||
|
|
||
| @Override | ||
| public ApiFuture<ListLocationsPage> createPageAsync( | ||
| PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| @Nullable PageContext<ListLocationsRequest, ListLocationsResponse, Location> context, | ||
| ApiFuture<ListLocationsResponse> futureResponse) { | ||
| return super.createPageAsync(context, futureResponse); | ||
| } | ||
|
|
@@ -1580,7 +1582,8 @@ public static class ListLocationsFixedSizeCollection | |
| ListLocationsPage, | ||
| ListLocationsFixedSizeCollection> { | ||
|
|
||
| private ListLocationsFixedSizeCollection(List<ListLocationsPage> pages, int collectionSize) { | ||
| private ListLocationsFixedSizeCollection( | ||
| @Nullable List<ListLocationsPage> pages, int collectionSize) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you double check this one? Do we need to add an annotation here for paging?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi! Yes, we need to add an annotation here because two places call this function (createCollection and createEmptyCollection (on line 1590-1) which calls the function with null in the first parameter (which is pages). Verified this annotation with Nullaway! |
||
| super(pages, collectionSize); | ||
| } | ||
|
|
||
|
|
@@ -1590,7 +1593,7 @@ private static ListLocationsFixedSizeCollection createEmptyCollection() { | |
|
|
||
| @Override | ||
| protected ListLocationsFixedSizeCollection createCollection( | ||
| List<ListLocationsPage> pages, int collectionSize) { | ||
| @Nullable List<ListLocationsPage> pages, int collectionSize) { | ||
| return new ListLocationsFixedSizeCollection(pages, collectionSize); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.