Skip to content

Commit

Permalink
[export] JPMS module info calculation fails
Browse files Browse the repository at this point in the history
There was a recent change dd2f0c5 that took a shortcut to calculate the embedded packages unconditionally. It used the bundle class path analysis to analyze all the jars in the executable. 

However, this significantly slows down Eclipse but worse, it then tries to reinterpret the annotation headers. In my case, I got 3 types on the Bundle-Activator.

The analysis should only be done when it is needed and I'd suggest to do it either in a separate Builder or try to analyze the manifests for speedup.

This patch just makes the analysis conditional but that is a temporary fix to make it compatible with the the previous code.

This needs to be cherry picked for 6.3.0 since it is a very serious regression.

Fixes  #5257

Signed-off-by: Peter Kriens <[email protected]>
Signed-off-by: BJ Hargrave <[email protected]>
  • Loading branch information
pkriens authored and bjhargrave committed May 23, 2022
1 parent 6a8bac4 commit 0d1be49
Showing 1 changed file with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,19 +357,24 @@ public Jar executable() throws Exception {
}
}

List<String> bcpList = new ArrayList<>();
bcpList.add(".");
bcpList.addAll(classpath);
bcpList.addAll(actualPaths);

builder.setProperty(BUNDLE_CLASSPATH, bcpList.stream()
.collect(joining(",")));
builder.setProperty(EXPORT_CONTENTS, "aQute.launcher.pre");

// Ignore common warnings resulting from the Bundle-ClassPath which
// are irrelevant in this use case
builder.setProperty(FIXUPMESSAGES,
"Classes found in the wrong directory, private references, Export-Package duplicate package name, Invalid package name: * in Export-Package");
String moduleProperty = builder.getProperty(JPMS_MODULE_INFO);
if (moduleProperty != null) {

List<String> bcpList = new ArrayList<>();
bcpList.add(".");
bcpList.addAll(classpath);
bcpList.addAll(actualPaths);

builder.setProperty(BUNDLE_CLASSPATH, bcpList.stream()
.collect(joining(",")));
builder.setProperty(EXPORT_CONTENTS, "aQute.launcher.pre");

// Ignore common warnings resulting from the Bundle-ClassPath
// which
// are irrelevant in this use case
builder.setProperty(FIXUPMESSAGES,
"Classes found in the wrong directory, private references, Export-Package duplicate package name, Invalid package name: * in Export-Package");
}

LauncherConstants lc = getConstants(actualPaths, true);
lc.embedded = true;
Expand Down

0 comments on commit 0d1be49

Please sign in to comment.