Loading android/util.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,12 +25,12 @@ import ( ) // CopyOf returns a new slice that has the same contents as s. func CopyOf(s []string) []string { func CopyOf[T any](s []T) []T { // If the input is nil, return nil and not an empty list if s == nil { return s } return append([]string{}, s...) return append([]T{}, s...) } // Concat returns a new slice concatenated from the two input slices. It does not change the input Loading android/util_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -385,7 +385,7 @@ func TestCopyOfEmptyAndNil(t *testing.T) { emptyList := []string{} copyOfEmptyList := CopyOf(emptyList) AssertBoolEquals(t, "Copy of an empty list should be an empty list and not nil", true, copyOfEmptyList != nil) copyOfNilList := CopyOf(nil) copyOfNilList := CopyOf([]string(nil)) AssertBoolEquals(t, "Copy of a nil list should be a nil list and not an empty list", true, copyOfNilList == nil) } Loading dexpreopt/dexpreopt.go +0 −2 Original line number Diff line number Diff line Loading @@ -630,5 +630,3 @@ func contains(l []string, s string) bool { } return false } var copyOf = android.CopyOf java/dexpreopt_config.go +0 −2 Original line number Diff line number Diff line Loading @@ -250,8 +250,6 @@ func bcpForDexpreopt(ctx android.PathContext, withUpdatable bool) (android.Writa var defaultBootclasspathKey = android.NewOnceKey("defaultBootclasspath") var copyOf = android.CopyOf func init() { android.RegisterMakeVarsProvider(pctx, dexpreoptConfigMakevars) } Loading java/robolectric.go +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile andr func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFile android.WritablePath, instrumentedApp *AndroidApp) { srcJarArgs := copyOf(instrumentedApp.srcJarArgs) srcJarArgs := android.CopyOf(instrumentedApp.srcJarArgs) srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...) for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) { Loading Loading
android/util.go +2 −2 Original line number Diff line number Diff line Loading @@ -25,12 +25,12 @@ import ( ) // CopyOf returns a new slice that has the same contents as s. func CopyOf(s []string) []string { func CopyOf[T any](s []T) []T { // If the input is nil, return nil and not an empty list if s == nil { return s } return append([]string{}, s...) return append([]T{}, s...) } // Concat returns a new slice concatenated from the two input slices. It does not change the input Loading
android/util_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -385,7 +385,7 @@ func TestCopyOfEmptyAndNil(t *testing.T) { emptyList := []string{} copyOfEmptyList := CopyOf(emptyList) AssertBoolEquals(t, "Copy of an empty list should be an empty list and not nil", true, copyOfEmptyList != nil) copyOfNilList := CopyOf(nil) copyOfNilList := CopyOf([]string(nil)) AssertBoolEquals(t, "Copy of a nil list should be a nil list and not an empty list", true, copyOfNilList == nil) } Loading
dexpreopt/dexpreopt.go +0 −2 Original line number Diff line number Diff line Loading @@ -630,5 +630,3 @@ func contains(l []string, s string) bool { } return false } var copyOf = android.CopyOf
java/dexpreopt_config.go +0 −2 Original line number Diff line number Diff line Loading @@ -250,8 +250,6 @@ func bcpForDexpreopt(ctx android.PathContext, withUpdatable bool) (android.Writa var defaultBootclasspathKey = android.NewOnceKey("defaultBootclasspath") var copyOf = android.CopyOf func init() { android.RegisterMakeVarsProvider(pctx, dexpreoptConfigMakevars) } Loading
java/robolectric.go +1 −1 Original line number Diff line number Diff line Loading @@ -299,7 +299,7 @@ func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile andr func (r *robolectricTest) generateRoboSrcJar(ctx android.ModuleContext, outputFile android.WritablePath, instrumentedApp *AndroidApp) { srcJarArgs := copyOf(instrumentedApp.srcJarArgs) srcJarArgs := android.CopyOf(instrumentedApp.srcJarArgs) srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...) for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) { Loading