File: 01-upgrade-asm.patch

package info (click to toggle)
access-modifier-checker 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 216 kB
  • ctags: 134
  • sloc: java: 477; xml: 188; makefile: 7
file content (88 lines) | stat: -rw-r--r-- 3,893 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Description: Upgrade to the latest version of ASM
Author: Emmanuel Bourg <ebourg@apache.org>
Bug: https://github.com/kohsuke/access-modifier/pull/2
--- a/access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Checker.java
+++ b/access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Checker.java
@@ -28,12 +28,12 @@
 import org.kohsuke.accmod.impl.Restrictions.Parser;
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.EmptyVisitor;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -138,7 +138,7 @@
             }
 
             try {
-                new ClassReader(is).accept(new EmptyVisitor() {
+                new ClassReader(is).accept(new ClassVisitor(Opcodes.ASM5) {
                     private String className;
 
                     @Override
@@ -153,7 +153,7 @@
 
                     @Override
                     public FieldVisitor visitField(int access, final String name, String desc, String signature, Object value) {
-                        return new EmptyVisitor() {
+                        return new FieldVisitor(Opcodes.ASM5) {
                             @Override
                             public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
                                 return onAnnotationFor(className+'.'+name,desc);
@@ -163,7 +163,7 @@
 
                     @Override
                     public MethodVisitor visitMethod(int access, final String methodName, final String methodDesc, String signature, String[] exceptions) {
-                        return new EmptyVisitor() {
+                        return new MethodVisitor(Opcodes.ASM5) {
                             @Override
                             public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
                                 return onAnnotationFor(className+'.'+methodName+methodDesc,desc);
@@ -221,7 +221,7 @@
         FileInputStream in = new FileInputStream(clazz);
         try {
             ClassReader cr = new ClassReader(in);
-            cr.accept(new EmptyVisitor() {
+            cr.accept(new ClassVisitor(Opcodes.ASM5) {
                 private String className;
                 private String methodName,methodDesc;
                 private int line;
@@ -243,7 +243,7 @@
                 public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
                     this.methodName  = name;
                     this.methodDesc = desc;
-                    return new EmptyVisitor() {
+                    return new MethodVisitor(Opcodes.ASM5) {
                         @Override
                         public void visitLineNumber(int _line, Label start) {
                             line = _line;
--- a/access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Restrictions.java
+++ b/access-modifier-checker/src/main/java/org/kohsuke/accmod/impl/Restrictions.java
@@ -25,6 +25,7 @@
 
 import org.kohsuke.accmod.AccessRestriction;
 import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
 
 import java.util.ArrayList;
@@ -83,11 +84,12 @@
         public String toString() { return "NONE"; }
     });
 
-    abstract static class Parser implements AnnotationVisitor {
+    abstract static class Parser extends AnnotationVisitor {
         private List<Type> restrictions = new ArrayList<Type>();
         private final RestrictedElement target;
 
         protected Parser(RestrictedElement target) {
+            super(Opcodes.ASM5);
             this.target = target;
         }