Add a systemModules utility type

Storing system modules in a classpath is clumsy, as there should
only ever be one system modules, and it needs to store both a
directory to pass as the argument and a set of generated files
to use as dependencies.  Store them in a separate systemModules
type instead.

Test: m checkbuild
Change-Id: I020556c736bd5091865bcca51dc0fb9e4db6b45b
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 59aef12..e57ced7 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -636,8 +636,7 @@
 			if sm.outputDir == nil && len(sm.outputDeps) == 0 {
 				panic("Missing directory for system module dependency")
 			}
-			deps.systemModules = sm.outputDir
-			deps.systemModulesDeps = sm.outputDeps
+			deps.systemModules = &systemModules{sm.outputDir, sm.outputDeps}
 		}
 	})
 	// do not pass exclude_srcs directly when expanding srcFiles since exclude_srcs
@@ -714,13 +713,10 @@
 
 	javaVersion := getJavaVersion(ctx, String(j.properties.Java_version), sdkContext(j))
 	if len(deps.bootClasspath) > 0 {
-		var systemModules classpath
-		if deps.systemModules != nil {
-			systemModules = append(systemModules, deps.systemModules)
-		}
-		implicits = append(implicits, deps.systemModulesDeps...)
-		bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
+		var systemModulesDeps android.Paths
+		bootClasspathArgs, systemModulesDeps = deps.systemModules.FormJavaSystemModulesPath(ctx.Device())
 		bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
+		implicits = append(implicits, systemModulesDeps...)
 	}
 	if len(deps.classpath.Strings()) > 0 {
 		classpathArgs = "-classpath " + strings.Join(deps.classpath.Strings(), ":")