[bytecode-compatibility-transformer] Port to asm4
Michal Srb
msrb at fedoraproject.org
Mon Dec 2 07:41:27 UTC 2013
commit 960d349279a572cc775ca7fd34740aaa5460000c
Author: Michal Srb <msrb at redhat.com>
Date: Mon Dec 2 08:38:32 2013 +0100
Port to asm4
- Regenerate BR
...ort-to-asm-asm.patch => 0001-Port-to-asm4.patch | 83 ++++++++++++++++----
bytecode-compatibility-transformer.spec | 16 ++--
2 files changed, 74 insertions(+), 25 deletions(-)
---
diff --git a/0001-Port-to-asm-asm.patch b/0001-Port-to-asm4.patch
similarity index 63%
rename from 0001-Port-to-asm-asm.patch
rename to 0001-Port-to-asm4.patch
index 77cafc6..3f276e3 100644
--- a/0001-Port-to-asm-asm.patch
+++ b/0001-Port-to-asm4.patch
@@ -1,22 +1,40 @@
-From 3ada0e7f61fcf7bdc00f63c31ec044e878639b30 Mon Sep 17 00:00:00 2001
+From acf28c5507f22ad9409c85772708c03c72906529 Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb at redhat.com>
-Date: Wed, 27 Nov 2013 13:42:52 +0100
-Subject: [PATCH] Port to asm:asm
+Date: Thu, 28 Nov 2013 13:18:50 +0100
+Subject: [PATCH] Port to asm4
---
- src/main/java/org/jenkinsci/bytecode/AdaptField.java | 8 ++++----
- .../org/jenkinsci/bytecode/ClassRewritingContext.java | 12 ++++++------
- src/main/java/org/jenkinsci/bytecode/Kind.java | 2 +-
- src/main/java/org/jenkinsci/bytecode/MemberAdapter.java | 4 ++--
- .../java/org/jenkinsci/bytecode/MemberTransformSpec.java | 8 ++++----
- src/main/java/org/jenkinsci/bytecode/Transformer.java | 16 ++++++++--------
- 6 files changed, 25 insertions(+), 25 deletions(-)
+ pom.xml | 6 +++---
+ src/main/java/org/jenkinsci/bytecode/AdaptField.java | 12 ++++++------
+ .../jenkinsci/bytecode/ClassRewritingContext.java | 12 ++++++------
+ src/main/java/org/jenkinsci/bytecode/Kind.java | 2 +-
+ .../java/org/jenkinsci/bytecode/MemberAdapter.java | 4 ++--
+ .../org/jenkinsci/bytecode/MemberTransformSpec.java | 8 ++++----
+ .../java/org/jenkinsci/bytecode/Transformer.java | 20 ++++++++++----------
+ 7 files changed, 32 insertions(+), 32 deletions(-)
+diff --git a/pom.xml b/pom.xml
+index 07ad5b5..d353d88 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -110,9 +110,9 @@
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+- <groupId>org.kohsuke</groupId>
+- <artifactId>asm3</artifactId>
+- <version>3.3.0</version>
++ <groupId>org.ow2.asm</groupId>
++ <artifactId>asm</artifactId>
++ <version>4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jenkins-ci</groupId>
diff --git a/src/main/java/org/jenkinsci/bytecode/AdaptField.java b/src/main/java/org/jenkinsci/bytecode/AdaptField.java
-index 5e8a1d6..4701f6f 100644
+index 5e8a1d6..4a8cbb1 100644
--- a/src/main/java/org/jenkinsci/bytecode/AdaptField.java
+++ b/src/main/java/org/jenkinsci/bytecode/AdaptField.java
-@@ -1,8 +1,8 @@
+@@ -1,9 +1,10 @@
package org.jenkinsci.bytecode;
import org.jvnet.hudson.annotation_indexer.Indexed;
@@ -25,11 +43,15 @@ index 5e8a1d6..4701f6f 100644
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
++import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-@@ -14,8 +14,8 @@ import java.lang.reflect.Modifier;
+ import java.lang.reflect.AnnotatedElement;
+@@ -12,10 +13,9 @@ import java.lang.reflect.Member;
+ import java.lang.reflect.Method;
+ import java.lang.reflect.Modifier;
- import static java.lang.annotation.ElementType.*;
+-import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
-import static org.kohsuke.asm3.Opcodes.*;
-import static org.kohsuke.asm3.Type.*;
@@ -38,6 +60,15 @@ index 5e8a1d6..4701f6f 100644
/**
* Rewrites a field reference by adapting the type of the field.
+@@ -36,7 +36,7 @@ import static org.kohsuke.asm3.Type.*;
+ * @author Kohsuke Kawaguchi
+ */
+ @Retention(RUNTIME)
+- at Target({FIELD,METHOD})
++ at Target({ElementType.FIELD,ElementType.METHOD})
+ @Indexed
+ @AdapterAnnotation(AdaptField.FactoryImpl.class)
+ public @interface AdaptField {
diff --git a/src/main/java/org/jenkinsci/bytecode/ClassRewritingContext.java b/src/main/java/org/jenkinsci/bytecode/ClassRewritingContext.java
index ca0a0a6..2277fac 100644
--- a/src/main/java/org/jenkinsci/bytecode/ClassRewritingContext.java
@@ -116,7 +147,7 @@ index ce99e85..02d5245 100644
/**
* All the adapters of {@linkplain #kind a specific member type} keyed by their name and descriptor.
diff --git a/src/main/java/org/jenkinsci/bytecode/Transformer.java b/src/main/java/org/jenkinsci/bytecode/Transformer.java
-index aaa6a59..12dbf25 100644
+index aaa6a59..b1f8aae 100644
--- a/src/main/java/org/jenkinsci/bytecode/Transformer.java
+++ b/src/main/java/org/jenkinsci/bytecode/Transformer.java
@@ -1,12 +1,12 @@
@@ -129,12 +160,12 @@ index aaa6a59..12dbf25 100644
-import org.kohsuke.asm3.MethodAdapter;
-import org.kohsuke.asm3.MethodVisitor;
-import org.kohsuke.asm3.Type;
-+import org.objectweb.asm.ClassAdapter;
++import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
-+import org.objectweb.asm.MethodAdapter;
+import org.objectweb.asm.MethodVisitor;
++import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
import java.io.IOException;
@@ -148,6 +179,24 @@ index aaa6a59..12dbf25 100644
/**
* Transform byte code where code references bytecode rewrite annotations.
+@@ -66,7 +66,7 @@ public class Transformer {
+
+ final boolean[] modified = new boolean[1];
+
+- cr.accept(new ClassAdapter(cw) {
++ cr.accept(new ClassVisitor(Opcodes.ASM4, cw) {
+ private ClassRewritingContext context;
+
+ @Override
+@@ -79,7 +79,7 @@ public class Transformer {
+ public MethodVisitor visitMethod(int access, final String methodName, final String methodDescriptor, String methodSignature, String[] exceptions) {
+ final MethodVisitor base = super.visitMethod(access, methodName, methodDescriptor, methodSignature, exceptions);
+
+- return new MethodAdapter(base) {
++ return new MethodVisitor(Opcodes.ASM4, base) {
+ @Override
+ public void visitMethodInsn(int opcode, String owner, String name, String desc) {
+ modified[0] |= spec.methods.rewrite(context,opcode,owner,name,desc,base);
--
1.8.3.1
diff --git a/bytecode-compatibility-transformer.spec b/bytecode-compatibility-transformer.spec
index 3ee7833..b859264 100644
--- a/bytecode-compatibility-transformer.spec
+++ b/bytecode-compatibility-transformer.spec
@@ -1,6 +1,6 @@
Name: bytecode-compatibility-transformer
Version: 1.4
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Evolve modular codebase without losing compatibility
# License is specified in pom.xml
@@ -10,18 +10,17 @@ Source0: https://github.com/jenkinsci/%{name}/archive/%{name}-%{version}.
# Taken from http://opensource.org/licenses/mit-license.php
Source1: LICENSE.txt
-# use standard asm3, not forked version
-Patch0: 0001-Port-to-asm-asm.patch
+Patch0: 0001-Port-to-asm4.patch
BuildRequires: maven-local
-BuildRequires: mvn(asm:asm)
BuildRequires: mvn(commons-io:commons-io)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.ant:ant)
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
+BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(org.jenkins-ci:annotation-indexer)
BuildRequires: mvn(org.jenkins-ci:constant-pool-scanner)
-BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
+BuildRequires: mvn(org.ow2.asm:asm)
BuildArch: noarch
@@ -45,9 +44,6 @@ This package contains the API documentation for %{name}.
cp %{SOURCE1} .
-%pom_remove_dep :asm3
-%pom_add_dep asm:asm
-
%build
%mvn_build
@@ -61,6 +57,10 @@ cp %{SOURCE1} .
%doc LICENSE.txt
%changelog
+* Mon Dec 02 2013 Michal Srb <msrb at redhat.com> - 1.4-2
+- Port to asm4
+- Regenerate BR
+
* Wed Nov 27 2013 Michal Srb <msrb at redhat.com> - 1.4-1
- Update to upstream version 1.4
More information about the scm-commits
mailing list