Skip to content

Commit c01f486

Browse files
committed
Revert "[MSHADE-406] Fix filename shading"
This reverts commit a104e66.
1 parent f2a9793 commit c01f486

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/main/java/org/apache/maven/plugins/shade/DefaultShader.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,11 @@ private void logSummaryOfDuplicates(MultiValuedMap<Collection<File>, String> ove
497497
int max = 10;
498498

499499
for (int i = 0; i < Math.min(max, all.size()); i++) {
500-
logger.warn(" - {}", all.get(i));
500+
logger.warn(" - " + all.get(i));
501501
}
502502

503503
if (all.size() > max) {
504-
logger.warn(" - {} more...", all.size() - max);
504+
logger.warn(" - " + (all.size() - max) + " more...");
505505
}
506506
}
507507
}
@@ -554,7 +554,7 @@ private void addRemappedClass(
554554
jos.putNextEntry(entry);
555555
IOUtil.copy(is, jos);
556556
} catch (ZipException e) {
557-
logger.debug("We have a duplicate {} in {}", name, jar);
557+
logger.debug("We have a duplicate " + name + " in " + jar);
558558
}
559559

560560
return;
@@ -583,27 +583,28 @@ private void addRemappedClass(
583583
throw new MojoExecutionException("Error in ASM processing class " + name, ise);
584584
}
585585

586-
String mappedName = packageMapper.map(name, true, false);
587-
588586
// If nothing was relocated by ShadeClassRemapper, write the original class, otherwise the transformed one
589587
final byte[] renamedClass;
590588
if (cv.remapped) {
591-
logger.debug("Rewrote class bytecode: {} to {}", name, mappedName);
589+
logger.debug("Rewrote class bytecode: " + name);
592590
renamedClass = cw.toByteArray();
593591
} else {
594-
logger.debug("Keeping original class bytecode: {}", name);
592+
logger.debug("Keeping original class bytecode: " + name);
595593
renamedClass = originalClass;
596594
}
597595

596+
// Need to take the .class off for remapping evaluation
597+
String mappedName = packageMapper.map(name.substring(0, name.indexOf('.')), true, false);
598+
598599
try {
599600
// Now we put it back on so the class file is written out with the right extension.
600-
JarEntry entry = new JarEntry(mappedName);
601+
JarEntry entry = new JarEntry(mappedName + ".class");
601602
entry.setTime(time);
602603
jos.putNextEntry(entry);
603604

604605
jos.write(renamedClass);
605606
} catch (ZipException e) {
606-
logger.debug("We have a duplicate {} in {}", mappedName, jar);
607+
logger.debug("We have a duplicate " + mappedName + " in " + jar);
607608
}
608609
}
609610

0 commit comments

Comments
 (0)