In java.go, add implement check for both Dependency and IDE relevant interfaces

1. Add var _ to declare the struct Import implement IDEInfo and
   IDECustomizedModuleName interfaces
2. Modify var _, a typo case for struct Module implement Dependency interface
3. Add nil checking for Dependency interface implementation
4. Add more comment for developer

Bug: 121985695

Test: 1. m aidegen
      2. $ANDROID_HOST_OUT/bin/aidegen framework
      3. check import static android.Manifest.permission.BIND_VOICE_INTERACTION;
	 denpendency should be resolved in frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

Change-Id: Ia2d2d65b83a52d35ccb3927a36bcf686d5223e20
This commit is contained in:
albaltai 2018-12-25 14:35:23 +08:00
parent 9e4c07a92f
commit 36ff7dcbf4

View file

@ -1420,9 +1420,12 @@ func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags,
return instrumentedJar
}
var _ Dependency = (*Library)(nil)
var _ Dependency = (*Module)(nil)
func (j *Module) HeaderJars() android.Paths {
if j.headerJarFile == nil {
return nil
}
return android.Paths{j.headerJarFile}
}
@ -1441,14 +1444,19 @@ func (j *Module) ResourceJars() android.Paths {
}
func (j *Module) ImplementationAndResourcesJars() android.Paths {
if j.implementationAndResourcesJar == nil {
return nil
}
return android.Paths{j.implementationAndResourcesJar}
}
func (j *Module) AidlIncludeDirs() android.Paths {
// exportAidlIncludeDirs is type android.Paths already
return j.exportAidlIncludeDirs
}
func (j *Module) ExportedSdkLibs() []string {
// exportedSdkLibs is type []string
return j.exportedSdkLibs
}
@ -1808,6 +1816,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
var _ Dependency = (*Import)(nil)
func (j *Import) HeaderJars() android.Paths {
if j.combinedClasspathFile == nil {
return nil
}
return android.Paths{j.combinedClasspathFile}
}
@ -1823,6 +1834,9 @@ func (j *Import) ResourceJars() android.Paths {
}
func (j *Import) ImplementationAndResourcesJars() android.Paths {
if j.combinedClasspathFile == nil {
return nil
}
return android.Paths{j.combinedClasspathFile}
}
@ -1834,6 +1848,10 @@ func (j *Import) ExportedSdkLibs() []string {
return j.exportedSdkLibs
}
// Add compile time check for interface implementation
var _ android.IDEInfo = (*Import)(nil)
var _ android.IDECustomizedModuleName = (*Import)(nil)
// Collect information for opening IDE project files in java/jdeps.go.
const (
removedPrefix = "prebuilt_"