Skip to content

Commit

Permalink
Fix multi-version jars.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Sep 23, 2024
1 parent 510f628 commit e2ecfd0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion byte-buddy-dep/src/main/java/net/bytebuddy/build/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,11 @@ public Summary apply(Source source, Target target, Factory... factory) throws IO
@HashCodeAndEqualsPlugin.Enhance
class Default extends AbstractBase {

/**
* The prefix folder for {@code META-INF/versions/} which contains multi-release files.
*/
private static final String META_INF_VERSIONS = "META-INF/versions/";

/**
* The Byte Buddy instance to use.
*/
Expand Down Expand Up @@ -4698,7 +4703,9 @@ public Summary apply(Source source, Target target, List<? extends Plugin.Factory
}
if (name.endsWith(CLASS_FILE_EXTENSION) && !name.endsWith(PACKAGE_INFO) && !name.equals(MODULE_INFO)) {
dispatcher.accept(new Preprocessor(element,
name.substring(0, name.length() - CLASS_FILE_EXTENSION.length()).replace('/', '.'),
name.substring(name.startsWith(META_INF_VERSIONS)
? name.indexOf('/', META_INF_VERSIONS.length()) + 1
: 0, name.length() - CLASS_FILE_EXTENSION.length()).replace('/', '.'),
classFileLocator,
typePool,
listener,
Expand Down

0 comments on commit e2ecfd0

Please sign in to comment.