Skip to content

Commit e2ecfd0

Browse files
committed
Fix multi-version jars.
1 parent 510f628 commit e2ecfd0

File tree

1 file changed

+8
-1
lines changed
  • byte-buddy-dep/src/main/java/net/bytebuddy/build

1 file changed

+8
-1
lines changed

byte-buddy-dep/src/main/java/net/bytebuddy/build/Plugin.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4364,6 +4364,11 @@ public Summary apply(Source source, Target target, Factory... factory) throws IO
43644364
@HashCodeAndEqualsPlugin.Enhance
43654365
class Default extends AbstractBase {
43664366

4367+
/**
4368+
* The prefix folder for {@code META-INF/versions/} which contains multi-release files.
4369+
*/
4370+
private static final String META_INF_VERSIONS = "META-INF/versions/";
4371+
43674372
/**
43684373
* The Byte Buddy instance to use.
43694374
*/
@@ -4698,7 +4703,9 @@ public Summary apply(Source source, Target target, List<? extends Plugin.Factory
46984703
}
46994704
if (name.endsWith(CLASS_FILE_EXTENSION) && !name.endsWith(PACKAGE_INFO) && !name.equals(MODULE_INFO)) {
47004705
dispatcher.accept(new Preprocessor(element,
4701-
name.substring(0, name.length() - CLASS_FILE_EXTENSION.length()).replace('/', '.'),
4706+
name.substring(name.startsWith(META_INF_VERSIONS)
4707+
? name.indexOf('/', META_INF_VERSIONS.length()) + 1
4708+
: 0, name.length() - CLASS_FILE_EXTENSION.length()).replace('/', '.'),
47024709
classFileLocator,
47034710
typePool,
47044711
listener,

0 commit comments

Comments
 (0)