Consitently use ModuleProxy instead of *ModuleProxy

ModuleProxy has an IsNil method, convert the methods that return a
possibly nil *ModuleProxy to return a ModuleProxy{} instead,
and make the callers check IsNil() instead of == nil.

Test: all soong tests pass
Change-Id: Ic632015f25fbf0ef78744542212081a80d4ace3d
diff --git a/android/base_module_context.go b/android/base_module_context.go
index 5cb9e71..86c6b44 100644
--- a/android/base_module_context.go
+++ b/android/base_module_context.go
@@ -123,7 +123,7 @@
 	// dependencies that are not an android.Module.
 	GetDirectDepWithTag(name string, tag blueprint.DependencyTag) Module
 
-	GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) *ModuleProxy
+	GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) ModuleProxy
 
 	// VisitDirectDeps calls visit for each direct dependency.  If there are multiple
 	// direct dependencies on the same module visit will be called multiple times on that module
@@ -329,11 +329,11 @@
 	return nil
 }
 
-func (b *baseModuleContext) GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) *ModuleProxy {
-	if module := b.bp.GetDirectDepProxyWithTag(name, tag); module != nil {
-		return &ModuleProxy{*module}
+func (b *baseModuleContext) GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) ModuleProxy {
+	if module := b.bp.GetDirectDepProxyWithTag(name, tag); !module.IsNil() {
+		return ModuleProxy{module}
 	}
-	return nil
+	return ModuleProxy{}
 }
 
 func (b *baseModuleContext) blueprintBaseModuleContext() blueprint.BaseModuleContext {
@@ -403,11 +403,11 @@
 }
 
 func (b *baseModuleContext) validateAndroidModuleProxy(
-	module blueprint.ModuleProxy, tag blueprint.DependencyTag, strict bool) *ModuleProxy {
-	aModule := ModuleProxy{module: module}
+	module blueprint.ModuleProxy, tag blueprint.DependencyTag, strict bool) ModuleProxy {
+	aModule := ModuleProxy{module}
 
 	if !strict {
-		return &aModule
+		return aModule
 	}
 
 	if !OtherModulePointerProviderOrDefault(b, module, CommonModuleInfoProvider).Enabled {
@@ -418,10 +418,10 @@
 				b.ModuleErrorf("depends on disabled module %q", b.OtherModuleName(aModule))
 			}
 		}
-		return nil
+		return ModuleProxy{}
 	}
 
-	return &aModule
+	return aModule
 }
 
 func (b *baseModuleContext) getDirectDepsInternal(name string, tag blueprint.DependencyTag) []Module {
@@ -480,8 +480,8 @@
 
 func (b *baseModuleContext) VisitDirectDepsProxy(visit func(ModuleProxy)) {
 	b.bp.VisitDirectDepsProxy(func(module blueprint.ModuleProxy) {
-		if aModule := b.validateAndroidModuleProxy(module, b.bp.OtherModuleDependencyTag(module), b.strictVisitDeps); aModule != nil {
-			visit(*aModule)
+		if aModule := b.validateAndroidModuleProxy(module, b.bp.OtherModuleDependencyTag(module), b.strictVisitDeps); !aModule.IsNil() {
+			visit(aModule)
 		}
 	})
 }
@@ -503,8 +503,8 @@
 func (b *baseModuleContext) VisitDirectDepsProxyWithTag(tag blueprint.DependencyTag, visit func(proxy ModuleProxy)) {
 	b.bp.VisitDirectDepsProxy(func(module blueprint.ModuleProxy) {
 		if b.bp.OtherModuleDependencyTag(module) == tag {
-			if aModule := b.validateAndroidModuleProxy(module, tag, b.strictVisitDeps); aModule != nil {
-				visit(*aModule)
+			if aModule := b.validateAndroidModuleProxy(module, tag, b.strictVisitDeps); !aModule.IsNil() {
+				visit(aModule)
 			}
 		}
 	})
diff --git a/android/module_context.go b/android/module_context.go
index 369805e..6e562bb 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -496,15 +496,15 @@
 	}
 }
 
-func (m *moduleContext) GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) *ModuleProxy {
+func (m *moduleContext) GetDirectDepProxyWithTag(name string, tag blueprint.DependencyTag) ModuleProxy {
 	deps := m.getDirectDepsProxyInternal(name, tag)
 	if len(deps) == 1 {
-		return &deps[0]
+		return deps[0]
 	} else if len(deps) >= 2 {
 		panic(fmt.Errorf("Multiple dependencies having same BaseModuleName() %q found from %q",
 			name, m.ModuleName()))
 	} else {
-		return nil
+		return ModuleProxy{}
 	}
 }
 
diff --git a/android/module_proxy.go b/android/module_proxy.go
index b292b5c..cb374bf 100644
--- a/android/module_proxy.go
+++ b/android/module_proxy.go
@@ -9,7 +9,7 @@
 	module blueprint.ModuleProxy
 }
 
-var _ Module = (*ModuleProxy)(nil)
+var _ Module = ModuleProxy{}
 
 func (m ModuleProxy) IsNil() bool {
 	return m.module.IsNil()
diff --git a/android/path_properties_test.go b/android/path_properties_test.go
index 6f44f28..f2adf7e 100644
--- a/android/path_properties_test.go
+++ b/android/path_properties_test.go
@@ -64,7 +64,7 @@
 	if p.props.Foo != "" {
 		// Make sure there is only one dependency on a module listed in a property present in multiple property structs
 		m := SrcIsModule(p.props.Foo)
-		if GetModuleProxyFromPathDep(ctx, m, "") == nil {
+		if GetModuleProxyFromPathDep(ctx, m, "").IsNil() {
 			ctx.ModuleErrorf("GetDirectDepWithTag failed")
 		}
 	}
diff --git a/android/paths.go b/android/paths.go
index 6612d37..2d740b1 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -609,7 +609,7 @@
 	for _, path := range paths {
 		if m, t := SrcIsModuleWithTag(path); m != "" {
 			module := GetModuleProxyFromPathDep(ctx, m, t)
-			if module == nil {
+			if module.IsNil() {
 				ctx.ModuleErrorf(`missing dependency on %q, is the property annotated with android:"path"?`, m)
 				continue
 			}
@@ -621,7 +621,7 @@
 			if !ok {
 				panic(fmt.Errorf("%s is not an OtherModuleProviderContext", ctx))
 			}
-			if dirProvider, ok := OtherModuleProvider(mctx, *module, DirProvider); ok {
+			if dirProvider, ok := OtherModuleProvider(mctx, module, DirProvider); ok {
 				ret = append(ret, dirProvider.Dirs...)
 			} else {
 				ReportPathErrorf(ctx, "module %q does not implement DirProvider", module)
@@ -680,14 +680,14 @@
 // If the module dependency is not a SourceFileProducer or OutputFileProducer, appropriate errors will be returned.
 func getPathsFromModuleDep(ctx ModuleWithDepsPathContext, path, moduleName, tag string) (Paths, error) {
 	module := GetModuleProxyFromPathDep(ctx, moduleName, tag)
-	if module == nil {
+	if module.IsNil() {
 		return nil, missingDependencyError{[]string{moduleName}}
 	}
-	if !OtherModulePointerProviderOrDefault(ctx, *module, CommonModuleInfoProvider).Enabled {
+	if !OtherModulePointerProviderOrDefault(ctx, module, CommonModuleInfoProvider).Enabled {
 		return nil, missingDependencyError{[]string{moduleName}}
 	}
 
-	outputFiles, err := outputFilesForModule(ctx, *module, tag)
+	outputFiles, err := outputFilesForModule(ctx, module, tag)
 	if outputFiles != nil && err == nil {
 		return outputFiles, nil
 	} else {
@@ -705,8 +705,8 @@
 //
 // If tag is "" then the returned module will be the dependency that was added for ":moduleName".
 // Otherwise, it is the dependency that was added for ":moduleName{tag}".
-func GetModuleProxyFromPathDep(ctx ModuleWithDepsPathContext, moduleName, tag string) *ModuleProxy {
-	var found *ModuleProxy
+func GetModuleProxyFromPathDep(ctx ModuleWithDepsPathContext, moduleName, tag string) ModuleProxy {
+	var found ModuleProxy
 	// The sourceOrOutputDepTag uniquely identifies the module dependency as it contains both the
 	// module name and the tag. Dependencies added automatically for properties tagged with
 	// `android:"path"` are deduped so are guaranteed to be unique. It is possible for duplicate
@@ -720,7 +720,7 @@
 	// this finds the matching dependency module.
 	expectedTag := sourceOrOutputDepTag(moduleName, tag)
 	ctx.VisitDirectDepsProxyWithTag(expectedTag, func(module ModuleProxy) {
-		found = &module
+		found = module
 	})
 	return found
 }
diff --git a/apex/apex.go b/apex/apex.go
index f45d7e3..ce064b7 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -607,7 +607,7 @@
 	multilib string
 
 	// TODO(jiyong): remove this
-	module    *android.ModuleProxy
+	module    android.ModuleProxy
 	providers *providerInfoForApexFile
 }
 
@@ -623,7 +623,7 @@
 
 // TODO(jiyong): shorten the arglist using an option struct
 func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidMkModuleName string,
-	installDir string, class apexFileClass, module *android.ModuleProxy) apexFile {
+	installDir string, class apexFileClass, module android.ModuleProxy) apexFile {
 	ret := apexFile{
 		builtFile:           builtFile,
 		installDir:          installDir,
@@ -631,8 +631,8 @@
 		class:               class,
 		module:              module,
 	}
-	if module != nil {
-		if installFilesInfo, ok := android.OtherModuleProvider(ctx, *module, android.InstallFilesProvider); ok {
+	if !module.IsNil() {
+		if installFilesInfo, ok := android.OtherModuleProvider(ctx, module, android.InstallFilesProvider); ok {
 			ret.checkbuildTarget = installFilesInfo.CheckbuildTarget
 		}
 		ret.moduleDir = ctx.OtherModuleDir(module)
@@ -1438,7 +1438,7 @@
 
 	fileToCopy := android.OutputFileForModule(ctx, module, "")
 	androidMkModuleName := commonInfo.BaseModuleName + ccMod.SubName
-	return newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeSharedLib, &module)
+	return newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeSharedLib, module)
 }
 
 func apexFileForExecutable(ctx android.BaseModuleContext, module android.ModuleProxy,
@@ -1449,7 +1449,7 @@
 	dirInApex = filepath.Join(dirInApex, linkableInfo.RelativeInstallPath)
 	fileToCopy := android.OutputFileForModule(ctx, module, "")
 	androidMkModuleName := commonInfo.BaseModuleName + linkableInfo.SubName
-	af := newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeExecutable, &module)
+	af := newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeExecutable, module)
 	af.symlinks = linkableInfo.Symlinks
 	af.dataPaths = ccInfo.DataPaths
 	return af
@@ -1463,7 +1463,7 @@
 	dirInApex = filepath.Join(dirInApex, linkableInfo.RelativeInstallPath)
 	fileToCopy := android.OutputFileForModule(ctx, module, "")
 	androidMkModuleName := commonInfo.BaseModuleName + linkableInfo.SubName
-	af := newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeExecutable, &module)
+	af := newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeExecutable, module)
 	return af
 }
 
@@ -1472,7 +1472,7 @@
 	dirInApex := filepath.Join("bin", sh.SubDir)
 	setDirInApexForNativeBridge(commonInfo, &dirInApex)
 	fileToCopy := sh.OutputFile
-	af := newApexFile(ctx, fileToCopy, commonInfo.BaseModuleName, dirInApex, shBinary, &module)
+	af := newApexFile(ctx, fileToCopy, commonInfo.BaseModuleName, dirInApex, shBinary, module)
 	af.symlinks = sh.Symlinks
 	return af
 }
@@ -1481,21 +1481,21 @@
 	prebuilt *prebuilt_etc.PrebuiltEtcInfo, outputFile android.Path) apexFile {
 	dirInApex := filepath.Join(prebuilt.BaseDir, prebuilt.SubDir)
 	makeModuleName := strings.ReplaceAll(filepath.Join(dirInApex, outputFile.Base()), "/", "_")
-	return newApexFile(ctx, outputFile, makeModuleName, dirInApex, etc, &module)
+	return newApexFile(ctx, outputFile, makeModuleName, dirInApex, etc, module)
 }
 
 func apexFileForCompatConfig(ctx android.BaseModuleContext, module android.ModuleProxy,
 	config *java.PlatformCompatConfigInfo, depName string) apexFile {
 	dirInApex := filepath.Join("etc", config.SubDir)
 	fileToCopy := config.CompatConfig
-	return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, &module)
+	return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, module)
 }
 
 func apexFileForVintfFragment(ctx android.BaseModuleContext, module android.ModuleProxy,
 	commonInfo *android.CommonModuleInfo, vf *android.VintfFragmentInfo) apexFile {
 	dirInApex := filepath.Join("etc", "vintf")
 
-	return newApexFile(ctx, vf.OutputFile, commonInfo.BaseModuleName, dirInApex, etc, &module)
+	return newApexFile(ctx, vf.OutputFile, commonInfo.BaseModuleName, dirInApex, etc, module)
 }
 
 // javaModule is an interface to handle all Java modules (java_library, dex_import, etc) in the same
@@ -1524,7 +1524,7 @@
 	javaInfo *java.JavaInfo, dexImplementationJar android.Path) apexFile {
 	dirInApex := "javalib"
 	commonInfo := android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
-	af := newApexFile(ctx, dexImplementationJar, commonInfo.BaseModuleName, dirInApex, javaSharedLib, &module)
+	af := newApexFile(ctx, dexImplementationJar, commonInfo.BaseModuleName, dirInApex, javaSharedLib, module)
 	af.jacocoReportClassesFile = javaInfo.JacocoReportClassesFile
 	if lintInfo, ok := android.OtherModuleProvider(ctx, module, java.LintProvider); ok {
 		af.lintInfo = lintInfo
@@ -1544,7 +1544,7 @@
 	javaInfo *java.JavaInfo) *apexFile {
 	if profilePathOnHost := javaInfo.DexpreopterInfo.OutputProfilePathOnHost; profilePathOnHost != nil {
 		dirInApex := "javalib"
-		af := newApexFile(ctx, profilePathOnHost, commonInfo.BaseModuleName+"-profile", dirInApex, etc, nil)
+		af := newApexFile(ctx, profilePathOnHost, commonInfo.BaseModuleName+"-profile", dirInApex, etc, android.ModuleProxy{})
 		af.customStem = javaInfo.Stem + ".jar.prof"
 		return &af
 	}
@@ -1579,7 +1579,7 @@
 	dirInApex := filepath.Join(appDir, aapp.InstallApkName+"@"+sanitizedBuildIdForPath(ctx))
 	fileToCopy := aapp.OutputFile
 
-	af := newApexFile(ctx, fileToCopy, commonInfo.BaseModuleName, dirInApex, app, &module)
+	af := newApexFile(ctx, fileToCopy, commonInfo.BaseModuleName, dirInApex, app, module)
 	af.jacocoReportClassesFile = aapp.JacocoReportClassesFile
 	if lintInfo, ok := android.OtherModuleProvider(ctx, module, java.LintProvider); ok {
 		af.lintInfo = lintInfo
@@ -1594,7 +1594,7 @@
 
 	if allowlist := aapp.PrivAppAllowlist; allowlist.Valid() {
 		dirInApex := filepath.Join("etc", "permissions")
-		privAppAllowlist := newApexFile(ctx, allowlist.Path(), commonInfo.BaseModuleName+"_privapp", dirInApex, etc, &module)
+		privAppAllowlist := newApexFile(ctx, allowlist.Path(), commonInfo.BaseModuleName+"_privapp", dirInApex, etc, module)
 		apexFiles = append(apexFiles, privAppAllowlist)
 	}
 
@@ -1607,7 +1607,7 @@
 	rroDir := "overlay"
 	dirInApex := filepath.Join(rroDir, rro.Theme)
 	fileToCopy := rro.OutputFile
-	af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, app, &module)
+	af := newApexFile(ctx, fileToCopy, module.Name(), dirInApex, app, module)
 	af.certificate = rro.Certificate
 
 	return af
@@ -1615,12 +1615,12 @@
 
 func apexFileForBpfProgram(ctx android.BaseModuleContext, builtFile android.Path, apex_sub_dir string, bpfProgram android.ModuleProxy) apexFile {
 	dirInApex := filepath.Join("etc", "bpf", apex_sub_dir)
-	return newApexFile(ctx, builtFile, builtFile.Base(), dirInApex, etc, &bpfProgram)
+	return newApexFile(ctx, builtFile, builtFile.Base(), dirInApex, etc, bpfProgram)
 }
 
 func apexFileForFilesystem(ctx android.BaseModuleContext, buildFile android.Path, module android.ModuleProxy) apexFile {
 	dirInApex := filepath.Join("etc", "fs")
-	return newApexFile(ctx, buildFile, buildFile.Base(), dirInApex, etc, &module)
+	return newApexFile(ctx, buildFile, buildFile.Base(), dirInApex, etc, module)
 }
 
 // WalkPayloadDeps visits dependencies that contributes to the payload of this APEX. For each of the
@@ -1784,7 +1784,7 @@
 		// TODO(b/295593640)
 		// Needs additional verification for the resulting APEX to ensure that skipped artifacts don't make problems.
 		// For example, DT_NEEDED modules should be found within the APEX unless they are marked in `requiredNativeLibs`.
-		if f.transitiveDep && f.module != nil && android.InList(mctx.OtherModuleName(f.module), vctx.unwantedTransitiveDeps) {
+		if f.transitiveDep && !f.module.IsNil() && android.InList(mctx.OtherModuleName(f.module), vctx.unwantedTransitiveDeps) {
 			vctx.unwantedTransitiveFilesInfo = append(vctx.unwantedTransitiveFilesInfo, f)
 			continue
 		}
@@ -1948,7 +1948,7 @@
 					// existing installed apk in favour of the new APK-in-APEX.
 					// See bugs for more information.
 					appDirName := filepath.Join(appDir, commonInfo.BaseModuleName+"@"+sanitizedBuildIdForPath(ctx))
-					af := newApexFile(ctx, appInfo.OutputFile, commonInfo.BaseModuleName, appDirName, appSet, &child)
+					af := newApexFile(ctx, appInfo.OutputFile, commonInfo.BaseModuleName, appDirName, appSet, child)
 					af.certificate = java.PresignedCertificate
 					vctx.filesInfo = append(vctx.filesInfo, af)
 				} else {
@@ -2383,7 +2383,7 @@
 		}
 
 		androidMkModuleName := filepath.Base(pathInApex)
-		af := newApexFile(ctx, tempPath, androidMkModuleName, filepath.Dir(pathInApex), etc, nil)
+		af := newApexFile(ctx, tempPath, androidMkModuleName, filepath.Dir(pathInApex), etc, android.ModuleProxy{})
 		filesToAdd = append(filesToAdd, af)
 	}
 
@@ -2398,7 +2398,7 @@
 		return nil
 	}
 	classpathProtoOutput := info.ClasspathFragmentProtoOutput
-	af := newApexFile(ctx, classpathProtoOutput, classpathProtoOutput.Base(), info.ClasspathFragmentProtoInstallDir.Rel(), etc, nil)
+	af := newApexFile(ctx, classpathProtoOutput, classpathProtoOutput.Base(), info.ClasspathFragmentProtoInstallDir.Rel(), etc, android.ModuleProxy{})
 	return &af
 }
 
diff --git a/apex/builder.go b/apex/builder.go
index becda2b..d611b73 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -248,7 +248,7 @@
 func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile {
 	var aconfigFiles android.Paths
 	for _, file := range a.filesInfo {
-		if file.module == nil {
+		if file.module.IsNil() {
 			continue
 		}
 		if dep, ok := android.OtherModuleProvider(ctx, file.module, android.AconfigPropagatingProviderKey); ok {
@@ -276,7 +276,7 @@
 				"cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "),
 			},
 		})
-		files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, nil))
+		files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, android.ModuleProxy{}))
 
 		// To enable fingerprint, we need to have v2 storage files. The default version is 1.
 		storageFilesVersion := 1
@@ -298,7 +298,7 @@
 					"version":     strconv.Itoa(storageFilesVersion),
 				},
 			})
-			files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, nil))
+			files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, android.ModuleProxy{}))
 		}
 	}
 	return files
@@ -408,8 +408,8 @@
 		if m, t := android.SrcIsModuleWithTag(*a.properties.File_contexts); m != "" {
 			isFileContextsModule = true
 			otherModule := android.GetModuleProxyFromPathDep(ctx, m, t)
-			if otherModule != nil {
-				fileContextsDir = ctx.OtherModuleDir(*otherModule)
+			if !otherModule.IsNil() {
+				fileContextsDir = ctx.OtherModuleDir(otherModule)
 			}
 		}
 		fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts)
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index c21fe56..69092b7 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -298,17 +298,17 @@
 func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
 	dep := ctx.GetDirectDepProxyWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix),
 		stubImplementation)
-	if dep == nil {
+	if dep.IsNil() {
 		ctx.ModuleErrorf("Could not find implementation for stub: ")
 		return nil
 	}
-	if _, ok := android.OtherModuleProvider(ctx, *dep, CcInfoProvider); !ok {
+	if _, ok := android.OtherModuleProvider(ctx, dep, CcInfoProvider); !ok {
 		ctx.ModuleErrorf("Implementation for stub is not correct module type")
 		return nil
 	}
-	output := android.OtherModuleProviderOrDefault(ctx, *dep, LinkableInfoProvider).UnstrippedOutputFile
+	output := android.OtherModuleProviderOrDefault(ctx, dep, LinkableInfoProvider).UnstrippedOutputFile
 	if output == nil {
-		ctx.ModuleErrorf("implementation module (%s) has no output", *dep)
+		ctx.ModuleErrorf("implementation module (%s) has no output", dep)
 		return nil
 	}
 
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 225f201..67bd613 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -429,8 +429,8 @@
 	for _, src := range j.properties.Srcs {
 		if moduleName, tag := android.SrcIsModuleWithTag(src); moduleName != "" {
 			otherModule := android.GetModuleProxyFromPathDep(ctx, moduleName, tag)
-			if otherModule != nil {
-				if dep, ok := android.OtherModuleProvider(ctx, *otherModule, android.CodegenInfoProvider); ok {
+			if !otherModule.IsNil() {
+				if dep, ok := android.OtherModuleProvider(ctx, otherModule, android.CodegenInfoProvider); ok {
 					deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...)
 				}
 			}
diff --git a/java/ravenwood.go b/java/ravenwood.go
index a71195d..01aa25c 100644
--- a/java/ravenwood.go
+++ b/java/ravenwood.go
@@ -14,9 +14,9 @@
 package java
 
 import (
-	"android/soong/aconfig"
 	"strconv"
 
+	"android/soong/aconfig"
 	"android/soong/android"
 	"android/soong/tradefed"
 
@@ -371,7 +371,7 @@
 	installPath := android.PathForModuleInstall(ctx, r.BaseModuleName())
 	for _, lib := range r.ravenwoodLibgroupProperties.Libs {
 		libModule := ctx.GetDirectDepProxyWithTag(lib, ravenwoodLibContentTag)
-		if libModule == nil {
+		if libModule.IsNil() {
 			if ctx.Config().AllowMissingDependencies() {
 				ctx.AddMissingDependencies([]string{lib})
 			} else {
@@ -403,7 +403,7 @@
 	// Copy aconfig flag storage files.
 	if r.Name() == ravenwoodRuntimeName {
 		allAconfigFound := false
-		if allAconfig := ctx.GetDirectDepProxyWithTag(aconfig.AllAconfigModule, allAconfigModuleTag); allAconfig != nil {
+		if allAconfig := ctx.GetDirectDepProxyWithTag(aconfig.AllAconfigModule, allAconfigModuleTag); !allAconfig.IsNil() {
 			aadi, ok := android.OtherModuleProvider(ctx, allAconfig, aconfig.AllAconfigDeclarationsInfoProvider)
 			if ok {
 				// Binary proto file and the text proto.
diff --git a/java/robolectric.go b/java/robolectric.go
index 1d204a4..9c98f5d 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -406,7 +406,7 @@
 
 	if !ctx.Config().AlwaysUsePrebuiltSdks() && r.props.Lib != nil {
 		runtimeFromSourceModule := ctx.GetDirectDepProxyWithTag(String(r.props.Lib), libTag)
-		if runtimeFromSourceModule == nil {
+		if runtimeFromSourceModule.IsNil() {
 			if ctx.Config().AllowMissingDependencies() {
 				ctx.AddMissingDependencies([]string{String(r.props.Lib)})
 			} else {