Use kotlin_module not kotlin-module to identify Kotlin module metadata

See gh-16004
This commit is contained in:
Robert Thornton
2019-02-20 05:28:58 +00:00
committed by Andy Wilkinson
parent 91a005f578
commit cb6362df82
5 changed files with 163 additions and 5 deletions

View File

@@ -381,7 +381,7 @@ public class Repackager {
}
if ((entry.getName().startsWith("META-INF/")
&& !entry.getName().equals("META-INF/aop.xml")
&& !entry.getName().endsWith(".kotlin-module"))
&& !entry.getName().endsWith(".kotlin_module"))
|| entry.getName().startsWith("BOOT-INF/")
|| entry.getName().equals("module-info.class")) {
return entry;

View File

@@ -679,15 +679,15 @@ public class RepackagerTests {
public void kotlinModuleMetadataMovesBeneathBootInfClassesWhenRepackaged()
throws Exception {
this.testJarFile.addClass("A.class", ClassWithMainMethod.class);
this.testJarFile.addFile("META-INF/test.kotlin-module",
this.temporaryFolder.newFile("test.kotlin-module"));
this.testJarFile.addFile("META-INF/test.kotlin_module",
this.temporaryFolder.newFile("test.kotlin_module"));
File source = this.testJarFile.getFile();
File dest = this.temporaryFolder.newFile("dest.jar");
Repackager repackager = new Repackager(source);
repackager.repackage(dest, NO_LIBRARIES);
try (JarFile jarFile = new JarFile(dest)) {
assertThat(jarFile.getEntry("META-INF/test.kotlin-module")).isNull();
assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin-module"))
assertThat(jarFile.getEntry("META-INF/test.kotlin_module")).isNull();
assertThat(jarFile.getEntry("BOOT-INF/classes/META-INF/test.kotlin_module"))
.isNotNull();
}
}