Skip to content

Commit

Permalink
Add ASM API parameter to Atlas constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
phase committed Nov 27, 2021
1 parent 5dd628a commit 317ede4
Showing 1 changed file with 18 additions and 3 deletions.
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

0 comments on commit 317ede4

Please sign in to comment.