Revert^3 "Implement detecting container violations."

2a88491afc72707c21a125b81f7dcd252d2fc5f1

Change-Id: Iba4527f391a093703978fe01177b56fec4604b28
diff --git a/android/apex.go b/android/apex.go
index b19c477..79ee0a8 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -16,7 +16,6 @@
 
 import (
 	"fmt"
-	"reflect"
 	"slices"
 	"sort"
 	"strconv"
@@ -146,17 +145,6 @@
 	return false
 }
 
-// To satisfy the comparable interface
-func (i ApexInfo) Equal(other any) bool {
-	otherApexInfo, ok := other.(ApexInfo)
-	return ok && i.ApexVariationName == otherApexInfo.ApexVariationName &&
-		i.MinSdkVersion == otherApexInfo.MinSdkVersion &&
-		i.Updatable == otherApexInfo.Updatable &&
-		i.UsePlatformApis == otherApexInfo.UsePlatformApis &&
-		reflect.DeepEqual(i.InApexVariants, otherApexInfo.InApexVariants) &&
-		reflect.DeepEqual(i.InApexModules, otherApexInfo.InApexModules)
-}
-
 // ApexTestForInfo stores the contents of APEXes for which this module is a test - although this
 // module is not part of the APEX - and thus has access to APEX internals.
 type ApexTestForInfo struct {
diff --git a/android/container.go b/android/container.go
index 63fb362..43dccf6 100644
--- a/android/container.go
+++ b/android/container.go
@@ -15,10 +15,8 @@
 package android
 
 import (
-	"fmt"
 	"reflect"
 	"slices"
-	"strings"
 
 	"github.com/google/blueprint"
 )
@@ -397,40 +395,6 @@
 
 var ContainersInfoProvider = blueprint.NewProvider[ContainersInfo]()
 
-func satisfyAllowedExceptions(ctx ModuleContext, allowedExceptionLabels []exceptionHandleFuncLabel, m, dep Module) bool {
-	for _, label := range allowedExceptionLabels {
-		if exceptionHandleFunctionsTable[label](ctx, m, dep) {
-			return true
-		}
-	}
-	return false
-}
-
-func (c *ContainersInfo) GetViolations(mctx ModuleContext, m, dep Module, depInfo ContainersInfo) []string {
-	var violations []string
-
-	// Any containers that the module belongs to but the dependency does not belong to must be examined.
-	_, containersUniqueToModule, _ := ListSetDifference(c.belongingContainers, depInfo.belongingContainers)
-
-	// Apex container should be examined even if both the module and the dependency belong to
-	// the apex container to check that the two modules belong to the same apex.
-	if InList(ApexContainer, c.belongingContainers) && !InList(ApexContainer, containersUniqueToModule) {
-		containersUniqueToModule = append(containersUniqueToModule, ApexContainer)
-	}
-
-	for _, containerUniqueToModule := range containersUniqueToModule {
-		for _, restriction := range containerUniqueToModule.restricted {
-			if InList(restriction.dependency, depInfo.belongingContainers) {
-				if !satisfyAllowedExceptions(mctx, restriction.allowedExceptions, m, dep) {
-					violations = append(violations, restriction.errorMessage)
-				}
-			}
-		}
-	}
-
-	return violations
-}
-
 func generateContainerInfo(ctx ModuleContext) ContainersInfo {
 	var containers []*container
 
@@ -472,32 +436,3 @@
 		SetProvider(ctx, ContainersInfoProvider, containersInfo)
 	}
 }
-
-func checkContainerViolations(ctx ModuleContext) {
-	if _, ok := ctx.Module().(InstallableModule); ok {
-		containersInfo, _ := getContainerModuleInfo(ctx, ctx.Module())
-		ctx.VisitDirectDepsIgnoreBlueprint(func(dep Module) {
-			if !dep.Enabled(ctx) {
-				return
-			}
-
-			// Pre-existing violating dependencies are tracked in containerDependencyViolationAllowlist.
-			// If this dependency is allowlisted, do not check for violation.
-			// If not, check if this dependency matches any restricted dependency and
-			// satisfies any exception functions, which allows bypassing the
-			// restriction. If all of the exceptions are not satisfied, throw an error.
-			if depContainersInfo, ok := getContainerModuleInfo(ctx, dep); ok {
-				if allowedViolations, ok := ContainerDependencyViolationAllowlist[ctx.ModuleName()]; ok && InList(dep.Name(), allowedViolations) {
-					return
-				} else {
-					violations := containersInfo.GetViolations(ctx, ctx.Module(), dep, depContainersInfo)
-					if len(violations) > 0 {
-						errorMessage := fmt.Sprintf("%s cannot depend on %s. ", ctx.ModuleName(), dep.Name())
-						errorMessage += strings.Join(violations, " ")
-						ctx.ModuleErrorf(errorMessage)
-					}
-				}
-			}
-		})
-	}
-}
diff --git a/android/module.go b/android/module.go
index 65f8079..5d68a87 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1778,9 +1778,6 @@
 	}
 
 	setContainerInfo(ctx)
-	if ctx.Config().Getenv("DISABLE_CONTAINER_CHECK") != "true" {
-		checkContainerViolations(ctx)
-	}
 
 	ctx.licenseMetadataFile = PathForModuleOut(ctx, "meta_lic")
 
diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go
index bb811f5..14c0b63 100644
--- a/apex/aconfig_test.go
+++ b/apex/aconfig_test.go
@@ -74,8 +74,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 		},
 		{
@@ -124,8 +122,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 		},
 		{
@@ -349,8 +345,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 			expectedError: `.*my_java_library_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
 		},
@@ -398,8 +392,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 			expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
 		},
@@ -701,8 +693,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 			expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
 		},
@@ -779,8 +769,6 @@
 					apex_available: [
 						"myapex",
 					],
-					sdk_version: "none",
-					system_modules: "none",
 				}`,
 		},
 	}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 8305333..8d34e9f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4929,7 +4929,6 @@
 		java_import {
 			name: "libfoo",
 			jars: ["libfoo.jar"],
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -4970,22 +4969,6 @@
 	t.Run("prebuilt with source preferred", func(t *testing.T) {
 
 		bp := `
-		apex {
-			name: "myapex",
-			key: "myapex.key",
-			updatable: false,
-			java_libs: [
-				"libfoo",
-				"libbar",
-			],
-		}
-
-		apex_key {
-			name: "myapex.key",
-			public_key: "testkey.avbpubkey",
-			private_key: "testkey.pem",
-		}
-
 		prebuilt_apex {
 			name: "myapex",
 			arch: {
@@ -5002,21 +4985,10 @@
 		java_import {
 			name: "libfoo",
 			jars: ["libfoo.jar"],
-			apex_available: [
-				"myapex",
-			],
-			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_library {
 			name: "libfoo",
-			srcs: ["foo/bar/MyClass.java"],
-			apex_available: [
-				"myapex",
-			],
-			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5024,21 +4996,12 @@
 			public: {
 				jars: ["libbar.jar"],
 			},
-			apex_available: [
-				"myapex",
-			],
-			compile_dex: true,
 		}
 
 		java_sdk_library {
 			name: "libbar",
 			srcs: ["foo/bar/MyClass.java"],
 			unsafe_ignore_missing_latest_api: true,
-			apex_available: [
-				"myapex",
-			],
-			compile_dex: true,
-			sdk_version: "core_current",
 		}
 	`
 
@@ -5047,9 +5010,11 @@
 
 		checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
 		checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
+		ensureNoSourceVariant(t, ctx, "libfoo")
 
 		checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
 		checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
+		ensureNoSourceVariant(t, ctx, "libbar")
 	})
 
 	t.Run("prebuilt preferred with source", func(t *testing.T) {
@@ -5075,7 +5040,6 @@
 
 		java_library {
 			name: "libfoo",
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5202,7 +5166,6 @@
 			jars: ["libfoo.jar"],
 			apex_available: ["myapex"],
 			permitted_packages: ["foo"],
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5357,14 +5320,12 @@
 			name: "libfoo",
 			jars: ["libfoo.jar"],
 			apex_available: ["myapex"],
-			sdk_version: "core_current",
 		}
 
 		java_library {
 			name: "libfoo",
 			srcs: ["foo/bar/MyClass.java"],
 			apex_available: ["myapex"],
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5456,7 +5417,6 @@
 			jars: ["libfoo.jar"],
 			apex_available: ["myapex"],
 			permitted_packages: ["foo"],
-			sdk_version: "core_current",
 		}
 
 		java_library {
@@ -5464,7 +5424,6 @@
 			srcs: ["foo/bar/MyClass.java"],
 			apex_available: ["myapex"],
 			installable: true,
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5555,7 +5514,6 @@
 			name: "libfoo",
 			jars: ["libfoo.jar"],
 			apex_available: ["myapex"],
-			sdk_version: "core_current",
 		}
 
 		java_library {
@@ -5564,7 +5522,6 @@
 			apex_available: ["myapex"],
 			permitted_packages: ["foo"],
 			installable: true,
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library_import {
@@ -5583,7 +5540,6 @@
 			apex_available: ["myapex"],
 			permitted_packages: ["bar"],
 			compile_dex: true,
-			sdk_version: "core_current",
 		}
 	`
 
@@ -6178,7 +6134,6 @@
 			name: "TesterHelpAppFoo",
 			srcs: ["foo/bar/MyClass.java"],
 			apex_available: [ "myapex" ],
-			sdk_version: "test_current",
 		}
 
 	`)
@@ -7781,7 +7736,7 @@
 			srcs: ["foo/bar/MyClass.java"],
 			sdk_version: "none",
 			system_modules: "none",
-			static_libs: ["myotherjar"],
+			libs: ["myotherjar"],
 			apex_available: [
 				"myapex",
 				"myapex.updatable",
@@ -8442,7 +8397,6 @@
 			apex_available: [
 				"myapex",
 			],
-			sdk_version: "current",
 		}
 
 		systemserverclasspath_fragment {
@@ -9485,7 +9439,6 @@
 			srcs: ["mybootclasspathlib.java"],
 			apex_available: ["myapex"],
 			compile_dex: true,
-			sdk_version: "current",
 		}
 
 		systemserverclasspath_fragment {
@@ -9801,7 +9754,6 @@
 				unsafe_ignore_missing_latest_api: true,
 				min_sdk_version: "31",
 				static_libs: ["util"],
-				sdk_version: "core_current",
 			}
 
 			java_library {
@@ -9810,7 +9762,6 @@
 				apex_available: ["myapex"],
 				min_sdk_version: "31",
 				static_libs: ["another_util"],
-				sdk_version: "core_current",
 			}
 
 			java_library {
@@ -9818,7 +9769,6 @@
                 srcs: ["a.java"],
 				min_sdk_version: "31",
 				apex_available: ["myapex"],
-				sdk_version: "core_current",
 			}
 		`)
 	})
@@ -9874,7 +9824,7 @@
 	})
 
 	t.Run("bootclasspath_fragment jar must set min_sdk_version", func(t *testing.T) {
-		preparer.
+		preparer.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "mybootclasspathlib".*must set min_sdk_version`)).
 			RunTestWithBp(t, `
 				apex {
 					name: "myapex",
@@ -9905,8 +9855,6 @@
 					apex_available: ["myapex"],
 					compile_dex: true,
 					unsafe_ignore_missing_latest_api: true,
-					sdk_version: "current",
-					min_sdk_version: "30",
 				}
 		`)
 	})
@@ -10159,9 +10107,6 @@
 			key: "myapex.key",
 			bootclasspath_fragments: ["mybootclasspathfragment"],
 			min_sdk_version: "29",
-			java_libs: [
-				"jacocoagent",
-			],
 		}
 		apex_key {
 			name: "myapex.key",
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 7cad337..25131ee 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -104,7 +104,6 @@
 			test: {
 				enabled: true,
 			},
-			sdk_version: "core_current",
 		}
 
 		java_library {
@@ -750,7 +749,6 @@
 			],
 			srcs: ["b.java"],
 			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_sdk_library {
@@ -924,7 +922,6 @@
 			],
 			srcs: ["b.java"],
 			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_library {
@@ -1096,7 +1093,6 @@
 			],
 			srcs: ["b.java"],
 			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_library {
@@ -1249,7 +1245,6 @@
 			],
 			srcs: ["b.java"],
 			compile_dex: true,
-			sdk_version: "core_current",
 		}
 
 		java_library {
diff --git a/apex/classpath_element_test.go b/apex/classpath_element_test.go
index 9e1ac94..b9a9198 100644
--- a/apex/classpath_element_test.go
+++ b/apex/classpath_element_test.go
@@ -92,7 +92,6 @@
 			],
 			srcs: ["b.java"],
 			installable: true,
-			sdk_version: "core_current",
 		}
 
 		java_library {
diff --git a/apex/container_test.go b/apex/container_test.go
index d28b1a6..3931174 100644
--- a/apex/container_test.go
+++ b/apex/container_test.go
@@ -30,7 +30,7 @@
 	result := android.GroupFixturePreparers(
 		prepareForApexTest,
 		java.PrepareForTestWithJavaSdkLibraryFiles,
-		java.FixtureWithLastReleaseApis("mybootclasspathlib", "bar"),
+		java.FixtureWithLastReleaseApis("mybootclasspathlib"),
 	).RunTestWithBp(t, `
 		apex {
 			name: "myapex",
@@ -68,17 +68,16 @@
 			],
 			compile_dex: true,
 			static_libs: [
-				"food",
+				"foo",
 				"baz",
 			],
 			libs: [
-				"bar.stubs",
+				"bar",
 			],
 			min_sdk_version: "30",
-			sdk_version: "current",
 		}
 		java_library {
-			name: "food",
+			name: "foo",
 			srcs:[
 				"A.java",
 			],
@@ -86,15 +85,13 @@
 				"myapex",
 			],
 			min_sdk_version: "30",
-			sdk_version: "core_current",
 		}
-		java_sdk_library {
+		java_library {
 			name: "bar",
 			srcs:[
 				"A.java",
 			],
 			min_sdk_version: "30",
-			sdk_version: "core_current",
 		}
 		java_library {
 			name: "baz",
@@ -106,7 +103,6 @@
 				"myapex",
 			],
 			min_sdk_version: "30",
-			sdk_version: "core_current",
 		}
 	`)
 	testcases := []struct {
@@ -134,7 +130,7 @@
 			isApexContainer:   false,
 		},
 		{
-			moduleName:        "food",
+			moduleName:        "foo",
 			variant:           "android_common_apex30",
 			isSystemContainer: true,
 			isApexContainer:   true,
@@ -166,7 +162,7 @@
 	result := android.GroupFixturePreparers(
 		prepareForApexTest,
 		java.PrepareForTestWithJavaSdkLibraryFiles,
-		java.FixtureWithLastReleaseApis("mybootclasspathlib", "bar"),
+		java.FixtureWithLastReleaseApis("mybootclasspathlib"),
 	).RunTestWithBp(t, `
 		apex {
 			name: "myapex",
@@ -203,30 +199,26 @@
 			],
 			compile_dex: true,
 			static_libs: [
-				"food",
+				"foo",
 			],
 			libs: [
-				"bar.stubs",
+				"bar",
 			],
-			sdk_version: "current",
 		}
 		java_library {
-			name: "food",
+			name: "foo",
 			srcs:[
 				"A.java",
 			],
 			apex_available: [
 				"myapex",
 			],
-			sdk_version: "core_current",
 		}
-		java_sdk_library {
+		java_library {
 			name: "bar",
 			srcs:[
 				"A.java",
 			],
-			sdk_version: "none",
-			system_modules: "none",
 		}
 	`)
 	testcases := []struct {
@@ -254,7 +246,7 @@
 			isApexContainer:   false,
 		},
 		{
-			moduleName:        "food",
+			moduleName:        "foo",
 			variant:           "android_common_apex10000",
 			isSystemContainer: true,
 			isApexContainer:   true,
diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go
index 9c2d899..17ade1d 100644
--- a/apex/platform_bootclasspath_test.go
+++ b/apex/platform_bootclasspath_test.go
@@ -293,7 +293,6 @@
 			],
 			srcs: ["b.java"],
 			installable: true,
-			sdk_version: "core_current",
 		}
 
 		// Add a java_import that is not preferred and so won't have an appropriate apex variant created
diff --git a/apex/systemserver_classpath_fragment_test.go b/apex/systemserver_classpath_fragment_test.go
index fd9020b..452a43e 100644
--- a/apex/systemserver_classpath_fragment_test.go
+++ b/apex/systemserver_classpath_fragment_test.go
@@ -80,7 +80,6 @@
 			apex_available: [
 				"myapex",
 			],
-			sdk_version: "core_current",
 		}
 
 		systemserverclasspath_fragment {
@@ -351,7 +350,6 @@
 			apex_available: [
 				"myapex",
 			],
-			sdk_version: "core_current",
 		}
 
 		systemserverclasspath_fragment {
diff --git a/java/base.go b/java/base.go
index e516891..4cd6021 100644
--- a/java/base.go
+++ b/java/base.go
@@ -593,13 +593,6 @@
 	return j.ProductSpecific()
 }
 
-var _ android.StubsAvailableModule = (*Module)(nil)
-
-// To safisfy the StubsAvailableModule interface
-func (j *Module) IsStubsModule() bool {
-	return proptools.Bool(j.properties.Is_stubs_module)
-}
-
 func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
 	sdkVersion := j.SdkVersion(ctx)
 	if sdkVersion.Stable() {
diff --git a/java/core-libraries/Android.bp b/java/core-libraries/Android.bp
index 1cca7ad..cee7a19 100644
--- a/java/core-libraries/Android.bp
+++ b/java/core-libraries/Android.bp
@@ -38,7 +38,6 @@
     visibility: ["//visibility:public"],
     sdk_version: "none",
     system_modules: "none",
-    is_stubs_module: true,
 }
 
 java_library {
@@ -290,7 +289,6 @@
     sdk_version: "none",
     system_modules: "none",
     patch_module: "java.base",
-    is_stubs_module: true,
 }
 
 // Same as legacy.core.platform.api.stubs, but android annotations are
@@ -309,7 +307,6 @@
         "legacy.core.platform.api.stubs",
     ],
     patch_module: "java.base",
-    is_stubs_module: true,
 }
 
 java_library {
@@ -342,7 +339,6 @@
         "stable.core.platform.api.stubs",
     ],
     patch_module: "java.base",
-    is_stubs_module: true,
 }
 
 // Used when compiling higher-level code against *.core.platform.api.stubs.
diff --git a/java/dexpreopt_test.go b/java/dexpreopt_test.go
index 07d0595..73e33f4 100644
--- a/java/dexpreopt_test.go
+++ b/java/dexpreopt_test.go
@@ -54,7 +54,6 @@
 					name: "foo",
 					installable: true,
 					srcs: ["a.java"],
-					sdk_version: "current",
 				}`,
 			enabled: true,
 		},
@@ -99,7 +98,6 @@
 				java_library {
 					name: "foo",
 					installable: true,
-					sdk_version: "current",
 				}`,
 			enabled: false,
 		},
@@ -109,7 +107,6 @@
 				java_library {
 					name: "foo",
 					srcs: ["a.java"],
-					sdk_version: "current",
 				}`,
 			enabled: false,
 		},
@@ -147,7 +144,6 @@
 					name: "foo",
 					srcs: ["a.java"],
 					compile_dex: true,
-					sdk_version: "current",
 				}`,
 			enabled: false,
 		},
@@ -168,7 +164,6 @@
 					installable: true,
 					srcs: ["a.java"],
 					apex_available: ["com.android.apex1"],
-					sdk_version: "current",
 				}`,
 			apexVariant: true,
 			enabled:     false,
@@ -181,7 +176,6 @@
 					installable: true,
 					srcs: ["a.java"],
 					apex_available: ["com.android.apex1"],
-					sdk_version: "current",
 				}`,
 			moduleName:  "service-foo",
 			apexVariant: true,
@@ -195,7 +189,6 @@
 					installable: true,
 					srcs: ["a.java"],
 					apex_available: ["com.android.apex1"],
-					sdk_version: "current",
 				}`,
 			moduleName:  "prebuilt_service-foo",
 			apexVariant: true,
@@ -209,7 +202,6 @@
 					installable: true,
 					srcs: ["a.java"],
 					apex_available: ["com.android.apex1"],
-					sdk_version: "current",
 				}`,
 			moduleName:  "service-foo",
 			apexVariant: false,
@@ -319,7 +311,6 @@
 			installable: true,
 			srcs: ["a.java"],
 			apex_available: ["com.android.apex1"],
-			sdk_version: "current",
 		}`)
 	ctx := result.TestContext
 	module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -351,7 +342,6 @@
 			name: "foo",
 			installable: true,
 			srcs: ["a.java"],
-			sdk_version: "current",
 		}`)
 	ctx = result.TestContext
 	module = ctx.ModuleForTests("foo", "android_common")
@@ -408,7 +398,6 @@
 			installable: true,
 			srcs: ["a.java"],
 			apex_available: ["com.android.apex1"],
-			sdk_version: "current",
 		}`)
 	ctx := result.TestContext
 	module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
@@ -440,7 +429,6 @@
 			name: "foo",
 			installable: true,
 			srcs: ["a.java"],
-			sdk_version: "current",
 		}`)
 	ctx = result.TestContext
 	module = ctx.ModuleForTests("foo", "android_common")
@@ -466,7 +454,6 @@
 				profile: "art-profile",
 			},
 			srcs: ["a.java"],
-			sdk_version: "current",
 		}`)
 
 	ctx := result.TestContext
diff --git a/java/sdk_library.go b/java/sdk_library.go
index a7a254a..25317c5 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -2099,7 +2099,6 @@
 		props.Dist.Dir = proptools.StringPtr(module.apiDistPath(apiScope))
 		props.Dist.Tag = proptools.StringPtr(".jar")
 	}
-	props.Is_stubs_module = proptools.BoolPtr(true)
 
 	return props
 }
diff --git a/java/testing.go b/java/testing.go
index 03dcee6..0e85022 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -184,10 +184,6 @@
 			host_supported: true,
 			srcs: ["Test.java"],
 			sdk_version: "current",
-			apex_available: [
-				"//apex_available:anyapex",
-				"//apex_available:platform",
-			],
 		}
 	`)),
 )
@@ -412,6 +408,7 @@
 		"core.current.stubs",
 		"legacy.core.platform.api.stubs",
 		"stable.core.platform.api.stubs",
+
 		"android_stubs_current_exportable",
 		"android_system_stubs_current_exportable",
 		"android_test_stubs_current_exportable",
@@ -419,11 +416,13 @@
 		"android_system_server_stubs_current_exportable",
 		"core.current.stubs.exportable",
 		"legacy.core.platform.api.stubs.exportable",
+
 		"kotlin-stdlib",
 		"kotlin-stdlib-jdk7",
 		"kotlin-stdlib-jdk8",
 		"kotlin-annotations",
 		"stub-annotations",
+
 		"aconfig-annotations-lib",
 		"unsupportedappusage",
 	}
@@ -436,7 +435,6 @@
 				sdk_version: "none",
 				system_modules: "stable-core-platform-api-stubs-system-modules",
 				compile_dex: true,
-				is_stubs_module: true,
 			}
 		`, extra)
 	}
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index 8b994eb..7ee548f 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -338,7 +338,6 @@
 				shared_library: false,
 				public: {enabled: true},
 				min_sdk_version: "2",
-				sdk_version: "current",
 			}
 
 			java_sdk_library {
@@ -349,7 +348,6 @@
 				public: {enabled: true},
 				min_sdk_version: "2",
 				permitted_packages: ["myothersdklibrary"],
-				sdk_version: "current",
 			}
 
 			java_sdk_library {
@@ -359,7 +357,6 @@
 				compile_dex: true,
 				public: {enabled: true},
 				min_sdk_version: "2",
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
@@ -627,7 +624,6 @@
 				min_sdk_version: "2",
 				permitted_packages: ["myothersdklibrary"],
 				compile_dex: true,
-				sdk_version: "current",
 			}
 		`),
 
@@ -659,7 +655,6 @@
 				shared_library: false,
 				public: {enabled: true},
 				min_sdk_version: "2",
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
@@ -882,7 +877,6 @@
 				public: {enabled: true},
 				permitted_packages: ["mysdklibrary"],
 				min_sdk_version: "current",
-				sdk_version: "current",
 			}
 
 			java_sdk_library {
@@ -901,7 +895,6 @@
 					package_prefixes: ["newlibrary.all.mine"],
 					single_packages: ["newlibrary.mine"],
 				},
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
@@ -1087,7 +1080,6 @@
 				shared_library: false,
 				public: {enabled: true},
 				min_sdk_version: "S",
-				sdk_version: "current",
 			}
 
 			java_sdk_library {
@@ -1098,7 +1090,6 @@
 				public: {enabled: true},
 				min_sdk_version: "Tiramisu",
 				permitted_packages: ["mynewsdklibrary"],
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
@@ -1296,7 +1287,6 @@
 				shared_library: false,
 				public: {enabled: true},
 				min_sdk_version: "Tiramisu",
-				sdk_version: "current",
 			}
 			java_sdk_library {
 				name: "mynewsdklibrary",
@@ -1306,7 +1296,6 @@
 				public: {enabled: true},
 				min_sdk_version: "Tiramisu",
 				permitted_packages: ["mynewsdklibrary"],
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
diff --git a/sdk/systemserverclasspath_fragment_sdk_test.go b/sdk/systemserverclasspath_fragment_sdk_test.go
index fd6c4e7..c1c4ed6 100644
--- a/sdk/systemserverclasspath_fragment_sdk_test.go
+++ b/sdk/systemserverclasspath_fragment_sdk_test.go
@@ -80,7 +80,6 @@
 				dex_preopt: {
 					profile: "art-profile",
 				},
-				sdk_version: "current",
 			}
 		`),
 	).RunTest(t)
@@ -111,14 +110,12 @@
 			apex_available: ["myapex"],
 			srcs: ["Test.java"],
 			min_sdk_version: "33", // Tiramisu
-			sdk_version: "current",
 		}
 		java_sdk_library {
 			name: "mysdklibrary-future",
 			apex_available: ["myapex"],
 			srcs: ["Test.java"],
 			min_sdk_version: "34", // UpsideDownCake
-			sdk_version: "current",
 		}
 		sdk {
 			name: "mysdk",
@@ -202,7 +199,6 @@
 			apex_available: ["myapex"],
 			srcs: ["Test.java"],
 			min_sdk_version: "34", // UpsideDownCake
-			sdk_version: "current",
 		}
 		sdk {
 			name: "mysdk",