Skip to content

Commit

Permalink
Merge pull request #225 from basil/asm
Browse files Browse the repository at this point in the history
Stop using repackaged ASM; upgrade ASM to 9.1
  • Loading branch information
jglick authored May 24, 2021
2 parents 27ddde4 + 84f9bf0 commit 2f05ce9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>asm5</artifactId>
<version>5.0.1</version>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
Expand Down
20 changes: 10 additions & 10 deletions core/src/main/java/org/kohsuke/stapler/ClassDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

import org.apache.commons.io.IOUtils;
import org.jvnet.tiger_types.Types;
import org.kohsuke.asm5.ClassReader;
import org.kohsuke.asm5.ClassVisitor;
import org.kohsuke.asm5.Label;
import org.kohsuke.asm5.MethodVisitor;
import org.kohsuke.asm5.Type;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -54,7 +55,6 @@

import static java.util.logging.Level.FINE;
import static java.util.logging.Level.WARNING;
import static org.kohsuke.asm5.Opcodes.ASM5;

/**
* Reflection information of a {@link Class}.
Expand Down Expand Up @@ -310,13 +310,13 @@ private static String[] loadParametersFromAsm(final Method m) throws IOException

final TreeMap<Integer,String> localVars = new TreeMap<Integer,String>();
ClassReader r = new ClassReader(clazz.openStream());
r.accept(new ClassVisitor(ASM5) {
r.accept(new ClassVisitor(Opcodes.ASM9) {
final String md = Type.getMethodDescriptor(m);
// First localVariable is "this" for non-static method
final int limit = (m.getModifiers() & Modifier.STATIC) != 0 ? 0 : 1;
@Override public MethodVisitor visitMethod(int access, String methodName, String desc, String signature, String[] exceptions) {
if (methodName.equals(m.getName()) && desc.equals(md))
return new MethodVisitor(ASM5) {
return new MethodVisitor(Opcodes.ASM9) {
@Override public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
if (index >= limit)
localVars.put(index, name);
Expand Down Expand Up @@ -350,11 +350,11 @@ private static String[] loadParametersFromAsm(final Constructor m) throws IOExce
InputStream is = clazz.openStream();
try {
ClassReader r = new ClassReader(is);
r.accept(new ClassVisitor(ASM5) {
r.accept(new ClassVisitor(Opcodes.ASM9) {
final String md = getConstructorDescriptor(m);
public MethodVisitor visitMethod(int access, String methodName, String desc, String signature, String[] exceptions) {
if (methodName.equals("<init>") && desc.equals(md))
return new MethodVisitor(ASM5) {
return new MethodVisitor(Opcodes.ASM9) {
@Override public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
if (index>0) // 0 is 'this'
localVars.put(index, name);
Expand Down

0 comments on commit 2f05ce9

Please sign in to comment.