Skip to content

Commit

Permalink
ensure we use the right ASM level -- fix for BYTEMAN-404
Browse files Browse the repository at this point in the history
  • Loading branch information
adinn committed Feb 9, 2021
1 parent 4fed869 commit 4fa91a0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

/**
* a modified version of JSRInliner which uses a slightly modified version of JSRInlinerAdapter
Expand All @@ -35,7 +34,7 @@ public class BMJSRInliner extends ClassVisitor
{
public BMJSRInliner(ClassVisitor cv)
{
super(Opcodes.ASM9, cv);
super(RuleAdapter.ASM_VERSION, cv);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.jboss.byteman.agent.adapter;

import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.JSRInlinerAdapter;

/**
Expand All @@ -34,7 +33,7 @@
public class BMJSRInlinerAdapter extends JSRInlinerAdapter
{
public BMJSRInlinerAdapter(MethodVisitor mv, int access, String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM5, mv, access, name, desc, signature, exceptions);
super(RuleAdapter.ASM_VERSION, mv, access, name, desc, signature, exceptions);
if (mv instanceof LocalScopeMethodVisitor) {
// replace the instruction list so that it generates the required start and end local scope calls
instructions = new BMInsnList(localVariables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class BMLocalScopeAdapter extends ClassVisitor
{
public BMLocalScopeAdapter(ClassVisitor cv)
{
super(OpcodesHelper.ASM9, cv);
super(RuleAdapter.ASM_VERSION, cv);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.jboss.byteman.agent.adapter;

import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.MethodNode;

/**
Expand All @@ -46,7 +45,7 @@ public class BMLocalScopeMethodAdapter extends MethodNode
* @param exceptions names of exceptions thrown by the method
*/
public BMLocalScopeMethodAdapter(MethodVisitor mv, int access, String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM5, access, name, desc, signature, exceptions);
super(RuleAdapter.ASM_VERSION, access, name, desc, signature, exceptions);
this.mv = mv;
if (mv instanceof LocalScopeMethodVisitor) {
// replace the instruction list so that it generates the required start and end local scope calls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
*/
public class RuleAdapter extends ClassVisitor
{
public final static int ASM_VERSION = Opcodes.ASM9;

protected RuleAdapter(ClassVisitor cv, TransformContext transformContext)
{
super(Opcodes.ASM9, cv);
super(ASM_VERSION, cv);
this.transformContext = transformContext;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.objectweb.asm.Label;
import org.jboss.byteman.rule.Rule;
import org.jboss.byteman.agent.TransformContext;
import org.objectweb.asm.Opcodes;

import java.util.LinkedList;
import java.util.HashMap;
Expand All @@ -41,7 +40,7 @@
// public class RuleMethodAdapter extends GeneratorAdapter {
public class RuleMethodAdapter extends MethodVisitor {
public RuleMethodAdapter(final MethodVisitor mv, final TransformContext transformContext, final int access, final String name, final String desc, Rule rule) {
super(Opcodes.ASM5, mv);
super(RuleAdapter.ASM_VERSION, mv);
this.access = access;
this.name = name;
this.descriptor = desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package org.jboss.byteman.agent.check;

import org.jboss.byteman.agent.adapter.RuleAdapter;
import org.objectweb.asm.*;

/**
Expand All @@ -38,7 +39,7 @@ public class ClassStructureAdapter extends ClassVisitor {
private String superName = null;
private String outerClass = null;

public ClassStructureAdapter() { super(Opcodes.ASM9); }
public ClassStructureAdapter() { super(RuleAdapter.ASM_VERSION); }

public boolean isInterface() {
return isInterface;
Expand Down

0 comments on commit 4fa91a0

Please sign in to comment.