Skip to content

Add ASM API parameter to Atlas constructor #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/main/java/org/cadixdev/atlas/Atlas.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.cadixdev.bombe.analysis.asm.ClassProviderInheritanceProvider;
import org.cadixdev.bombe.provider.ClassProvider;
import org.cadixdev.bombe.jar.JarEntryTransformer;
import org.objectweb.asm.Opcodes;

import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -40,17 +41,31 @@ public class Atlas implements Closeable {

private final ExecutorService executorService;
private final boolean manageExecutor;
private final int api;

/**
* Creates an Atlas with an associated executor service.
*
* @param executorService The executor service
* @param manageExecutor Whether to shutdown the executor service when closing the atlas
* @since 0.2.1
* @param api The ASM API version to use
* @since 0.2.3
*/
private Atlas(final ExecutorService executorService, final boolean manageExecutor) {
private Atlas(final ExecutorService executorService, final boolean manageExecutor, final int api) {
this.executorService = executorService;
this.manageExecutor = manageExecutor;
this.api = api;
}

/**
* Creates an Atlas with an associated executor service.
*
* @param executorService The executor service
* @param manageExecutor Whether to shutdown the executor service when closing the atlas
* @since 0.2.1
*/
private Atlas(final ExecutorService executorService, final boolean manageExecutor) {
this(executorService, manageExecutor, Opcodes.ASM7);
}

/**
Expand Down Expand Up @@ -138,7 +153,7 @@ public void run(final JarFile jar, final Path output) throws IOException {

// Create the context for the JAR file
final AtlasTransformerContext context = new AtlasTransformerContext(
new ClassProviderInheritanceProvider(new CompositeClassProvider(classpath))
new ClassProviderInheritanceProvider(api, new CompositeClassProvider(classpath))
);

// Construct the transformers
Expand Down