Merge "Change classpath for droiddoc"
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 9ec2be8..53c75b5 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -485,7 +485,7 @@
 				} else if sdkVersion == "" {
 					linkType = javaPlatform
 				}
-				deps.classpath = append(deps.classpath, dep.HeaderJars(linkType)...)
+				deps.classpath = append(deps.classpath, dep.ImplementationJars(linkType)...)
 			case android.SourceFileProducer:
 				checkProducesJars(ctx, dep)
 				deps.classpath = append(deps.classpath, dep.Srcs()...)
diff --git a/java/java.go b/java/java.go
index 06d3564..99af2f5 100644
--- a/java/java.go
+++ b/java/java.go
@@ -313,6 +313,7 @@
 
 type SdkLibraryDependency interface {
 	HeaderJars(linkType linkType) android.Paths
+	ImplementationJars(linkType linkType) android.Paths
 }
 
 type SrcDependency interface {
diff --git a/java/sdk_library.go b/java/sdk_library.go
index e65af65..3bac8f6 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -129,6 +129,11 @@
 	systemApiStubsPath android.Paths
 	testApiStubsPath   android.Paths
 	implLibPath        android.Paths
+
+	publicApiStubsImplPath android.Paths
+	systemApiStubsImplPath android.Paths
+	testApiStubsImplPath   android.Paths
+	implLibImplPath        android.Paths
 }
 
 func (module *sdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
@@ -151,12 +156,16 @@
 			switch tag {
 			case publicApiStubsTag:
 				module.publicApiStubsPath = lib.HeaderJars()
+				module.publicApiStubsImplPath = lib.ImplementationJars()
 			case systemApiStubsTag:
 				module.systemApiStubsPath = lib.HeaderJars()
+				module.systemApiStubsImplPath = lib.ImplementationJars()
 			case testApiStubsTag:
 				module.testApiStubsPath = lib.HeaderJars()
+				module.testApiStubsImplPath = lib.ImplementationJars()
 			case implLibTag:
 				module.implLibPath = lib.HeaderJars()
+				module.implLibImplPath = lib.ImplementationJars()
 			default:
 				ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag)
 			}
@@ -557,6 +566,18 @@
 	}
 }
 
+// to satisfy SdkLibraryDependency interface
+func (module *sdkLibrary) ImplementationJars(linkType linkType) android.Paths {
+	// This module is just a wrapper for the stubs.
+	if linkType == javaSystem {
+		return module.systemApiStubsImplPath
+	} else if linkType == javaPlatform {
+		return module.implLibImplPath
+	} else {
+		return module.publicApiStubsImplPath
+	}
+}
+
 func javaSdkLibraries(config android.Config) *[]string {
 	return config.Once("javaSdkLibraries", func() interface{} {
 		return &[]string{}