How to find out if Remapper / ClassRemapper actually remapped anything?
"\"Alexander Kriegisch\"" (via asm Mailing List) <[email protected]> Thu, 20 May 2021 05:41:43 +0200 (CEST)
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1621482696-17129-2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hello. This might be a naive question, but is there a simple (or not so simple, if necessary) way to find out if a ClassRemapper or Remapper actually did remap anything? Background: I am using Maven Shade Plugin, which in turn uses ASM in order to implement relocating packages. For that purpose is provides a >>> RelocatorRemapper extends Remapper If a plugin configuration contains any relocation rules, Maven Shade will either replace package names in Java source files or - if the target file is a class file - pass the class through to Remapper in order too do the magic. So far, so good, this works nicely. Now here is my problem: In build verification steps I would like to check which classes were actually remapped, at least for some expected relocations. Negative tests would check thatt other classes remain unchanged. But the latter does not work, because Shade passes through all classes, which often changes them, because e.g. the constant pool gets overwritten, even if no actual relocation took place because the target class neither needs to be relocated itself nor imports/references another relocated class. But still, the byte code looks different, i.e. a simple checksum comparison between the class files before and after the (basically and semantically no-op) relocation yields a difference. My idea was to try and create a pull request for Maven Shade which writes the original class into the resulting JAR file, if the relocator (and hence the remapper) did not effectively change anything. Do you have any suggestion how to do that? Thanks in advance -- Alexander Kriegisch https://scrum-master.de ------------=_1621482696-17129-2 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit -- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws ------------=_1621482696-17129-2--