summaryrefslogtreecommitdiff
path: root/android/api_levels.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2022-07-01 19:39:14 +0000
committer Cole Faust <colefaust@google.com> 2022-07-01 19:39:14 +0000
commite5bf3fb4c2ef475051ef74b29ef732118b8766bf (patch)
tree62fc004955242c48018b9eb85c6f4bf48b48ec05 /android/api_levels.go
parent5d80d895b6e99e881454919e7b40f4ae78696582 (diff)
Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"
This reverts commit 5d80d895b6e99e881454919e7b40f4ae78696582. Reason for revert: The issue that broke the build the first time this was submitted has been fixed in ag/19125702. Also the errorprone build was added to presubmit for changes to these files so we should hopefully catch any other issues at presubmit now: cl/458501206 Change-Id: I80ca08df49c58a1ad70de917822301368d49fc67
Diffstat (limited to 'android/api_levels.go')
-rw-r--r--android/api_levels.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/android/api_levels.go b/android/api_levels.go
index 81638940c..aa55aa149 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -54,6 +54,14 @@ type ApiLevel struct {
isPreview bool
}
+func (this ApiLevel) FinalInt() int {
+ if this.IsPreview() {
+ panic("Requested a final int from a non-final ApiLevel")
+ } else {
+ return this.number
+ }
+}
+
func (this ApiLevel) FinalOrFutureInt() int {
if this.IsPreview() {
return FutureApiLevelInt