SdkSpec = Scope + ApiLevel

SdkSpec.Version was an int type. Now it becomes ApiLevel type which
is a better abstraction of the version (or api level).

Bug: 1655587
Test: m

Change-Id: I4d67b9b9eae45f653b6af4f5b73da9e091b3dfab
diff --git a/java/base.go b/java/base.go
index 73e5352..9bc0738 100644
--- a/java/base.go
+++ b/java/base.go
@@ -535,7 +535,7 @@
 }
 
 func (j *Module) MinSdkVersionString() string {
-	return j.MinSdkVersion().Version.String()
+	return j.MinSdkVersion().ApiLevel.String()
 }
 
 func (j *Module) AvailableFor(what string) bool {
@@ -1255,7 +1255,7 @@
 
 	if ctx.Device() {
 		lintSDKVersionString := func(sdkSpec android.SdkSpec) string {
-			if v := sdkSpec.Version; v.IsNumbered() {
+			if v := sdkSpec.ApiLevel; !v.IsPreview() {
 				return v.String()
 			} else {
 				return ctx.Config().DefaultAppTargetSdk(ctx).String()
@@ -1482,7 +1482,7 @@
 	if err != nil {
 		return err
 	}
-	if ver.ApiLevel(ctx).GreaterThan(sdkVersion) {
+	if ver.GreaterThan(sdkVersion) {
 		return fmt.Errorf("newer SDK(%v)", ver)
 	}
 	return nil