From 0fef890d1a412c9c72c3e74bac91315b05ed4492 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 12 Jan 2021 13:08:45 +0100 Subject: [PATCH] Minor refactoring in CompileEnvironmentUtil --- .../cli/jvm/compiler/CompileEnvironmentUtil.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java index bf145a2e193..ec109d3b274 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java @@ -129,19 +129,17 @@ public class CompileEnvironmentUtil { try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) { while (true) { JarEntry e = jis.getNextJarEntry(); - if (e == null) { - break; - } - if (StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) { + if (e == null) break; + + if (!FileUtilRt.extensionEquals(e.getName(), "class") || + StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) { continue; } if (resetJarTimestamps) { e.setTime(DOS_EPOCH); } - if (FileUtilRt.extensionEquals(e.getName(), "class")) { - stream.putNextEntry(e); - FileUtil.copy(jis, stream); - } + stream.putNextEntry(e); + FileUtil.copy(jis, stream); } } }