diff --git a/src/main/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreator.kt b/src/main/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreator.kt index 9419a79be..7ac7e5692 100644 --- a/src/main/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreator.kt +++ b/src/main/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreator.kt @@ -35,7 +35,7 @@ class SourceJarCreator( private const val BL = """\p{Blank}*""" private const val COM_BL = """$BL(?:/\*[^\n]*\*/$BL)*""" private val PKG_PATTERN: Pattern = - Pattern.compile("""^${COM_BL}package$COM_BL([a-zA-Z1-9._]+)$COM_BL(?:;?.*)$""") + Pattern.compile("""^${COM_BL}package$COM_BL([a-zA-Z0-9._]+)$COM_BL(?:;?.*)$""") @JvmStatic fun extractPackage(line: String): String? = diff --git a/src/test/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreatorTest.java b/src/test/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreatorTest.java index 8e5b39191..fbaa6c5f7 100644 --- a/src/test/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreatorTest.java +++ b/src/test/kotlin/io/bazel/kotlin/builder/utils/jars/SourceJarCreatorTest.java @@ -49,4 +49,16 @@ public void testPackageNameRegex() { subj.that(pkg).isEqualTo(expectedPackage); }); } + + @Test + public void testPackageNameRegexWithZero() { + cases.forEach( + (testCase) -> { + testCase = testCase.replace("some1", "some0"); + String pkg = SourceJarCreator.Companion.extractPackage(testCase); + StandardSubjectBuilder subj = assertWithMessage("positive test case: " + testCase); + subj.that(pkg).isNotNull(); + subj.that(pkg).isEqualTo("iO.some0.package"); + }); + } }