Use correct module name for java_import in shouldConvertWithBp2build verification

This change makes sure that prebuilt module has correct module name
prefix("prebuilt_") inside method shouldConvertWithBp2build, to avoid
the bp2build conflict issue when a normal module and a prebuilt module
with the same name are both allowlisted.

Test: CI, added unit tests and the steps to reproduce in b/303376793

Bug: 303376793
Bug: 303868211
Change-Id: I4f1126182ec1f52ae6a08046a77204939230edef
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index 426dffa..ad0ec65 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -1041,3 +1041,28 @@
 		ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
 	})
 }
+
+func TestJavaLibrarySameNameAsPrebuilt(t *testing.T) {
+	runJavaLibraryTestCaseWithRegistrationCtxFunc(t, Bp2buildTestCase{
+		Description: "java_library and prebuilt module have the same name",
+		Filesystem: map[string]string{
+			"foo/bar/Android.bp": simpleModule("java_import", "test_lib"),
+		},
+		Blueprint: `java_library {
+    name: "test_lib",
+    srcs: ["a.java"],
+    sdk_version: "current",
+    bazel_module: { bp2build_available: true },
+}
+`,
+		ExpectedBazelTargets: []string{
+			MakeBazelTarget("java_library", "test_lib", AttrNameToString{
+				"srcs":        `["a.java"]`,
+				"sdk_version": `"current"`,
+			}),
+			MakeNeverlinkDuplicateTarget("java_library", "test_lib"),
+		},
+	}, func(ctx android.RegistrationContext) {
+		ctx.RegisterModuleType("java_import", java.ImportFactory)
+	})
+}