File: 0012_use_debian_asm4.patch

package info (click to toggle)
libspring-java 3.0.6.RELEASE-17
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,744 kB
  • ctags: 58,990
  • sloc: java: 325,579; xml: 67,955; sql: 176; makefile: 40; ruby: 33; sh: 6
file content (299 lines) | stat: -rw-r--r-- 10,343 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
Description: Upgrade from ASM 3 to ASM 4. This patch can be dropped after upgrading to Spring 3.2 or later
Origin: backport, https://github.com/spring-projects/spring-framework/commit/c16f18a5
Bug: https://jira.spring.io/browse/SPR-9669
--- /dev/null
+++ b/projects/org.springframework.core/src/main/java/org/springframework/asm/SpringAsmInfo.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.asm;
+
+/**
+ * Utility class exposing constants related to Spring's internal repackaging of the ASM
+ * bytecode manipulation library.
+ *
+ * <p>See <a href="package-summary.html">package-level Javadoc</a> for more
+ * information on {@code org.springframework.asm}.
+ *
+ * @author Chris Beams
+ * @since 3.2
+ */
+public final class SpringAsmInfo {
+
+	/**
+	 * The ASM version used internally throughout the framework.
+	 *
+	 * @see Opcodes#ASM4
+	 */
+	public static final int ASM_VERSION = org.objectweb.asm.Opcodes.ASM4;
+
+}
--- a/projects/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java
+++ b/projects/org.springframework.core/src/main/java/org/springframework/core/LocalVariableTableParameterNameDiscoverer.java
@@ -29,11 +29,12 @@
 import org.apache.commons.logging.LogFactory;
 
 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 org.objectweb.asm.commons.EmptyVisitor;
+import org.springframework.asm.SpringAsmInfo;
 import org.springframework.util.ClassUtils;
 
 /**
@@ -78,7 +79,7 @@
 	}
 
 	@SuppressWarnings("unchecked")
-	public String[] getParameterNames(Constructor ctor) {
+	public String[] getParameterNames(Constructor<?> ctor) {
 		Class<?> declaringClass = ctor.getDeclaringClass();
 		Map<Member, String[]> map = this.parameterNamesCache.get(declaringClass);
 		if (map == null) {
@@ -136,7 +137,7 @@
 	 * Helper class that inspects all methods (constructor included) and then
 	 * attempts to find the parameter names for that member.
 	 */
-	private static class ParameterNameDiscoveringVisitor extends EmptyVisitor {
+	private static class ParameterNameDiscoveringVisitor extends ClassVisitor {
 
 		private static final String STATIC_CLASS_INIT = "<clinit>";
 
@@ -144,6 +145,7 @@
 		private final Map<Member, String[]> memberMap;
 
 		public ParameterNameDiscoveringVisitor(Class<?> clazz, Map<Member, String[]> memberMap) {
+			super(SpringAsmInfo.ASM_VERSION);
 			this.clazz = clazz;
 			this.memberMap = memberMap;
 		}
@@ -167,7 +169,7 @@
 	}
 
 
-	private static class LocalVariableTableVisitor extends EmptyVisitor {
+	private static class LocalVariableTableVisitor extends MethodVisitor {
 
 		private static final String CONSTRUCTOR = "<init>";
 
@@ -188,6 +190,7 @@
 
 		public LocalVariableTableVisitor(Class<?> clazz, Map<Member, String[]> map, String name, String desc,
 				boolean isStatic) {
+			super(SpringAsmInfo.ASM_VERSION);
 			this.clazz = clazz;
 			this.memberMap = map;
 			this.name = name;
--- a/projects/org.springframework.core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java
+++ b/projects/org.springframework.core/src/main/java/org/springframework/core/ParameterNameDiscoverer.java
@@ -49,6 +49,6 @@
 	 * @return an array of parameter names if the names can be resolved,
 	 * or <code>null</code> if they cannot
 	 */
-	String[] getParameterNames(Constructor ctor);
+	String[] getParameterNames(Constructor<?> ctor);
 
 }
--- a/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java
+++ b/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java
@@ -27,7 +27,6 @@
 
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.EmptyVisitor;
 import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.ReflectionUtils;
@@ -38,7 +37,7 @@
  * @author Juergen Hoeller
  * @since 3.0
  */
-final class AnnotationAttributesReadingVisitor implements AnnotationVisitor {
+final class AnnotationAttributesReadingVisitor extends AnnotationVisitor {
 
 	private final String annotationType;
 
@@ -54,7 +53,7 @@
 	public AnnotationAttributesReadingVisitor(
 			String annotationType, Map<String, Map<String, Object>> attributesMap,
 			Map<String, Set<String>> metaAnnotationMap, ClassLoader classLoader) {
-
+                super(org.springframework.asm.SpringAsmInfo.ASM_VERSION);
 		this.annotationType = annotationType;
 		this.attributesMap = attributesMap;
 		this.metaAnnotationMap = metaAnnotationMap;
@@ -82,11 +81,11 @@
 	}
 
 	public AnnotationVisitor visitAnnotation(String name, String desc) {
-		return new EmptyVisitor();
+		return new EmptyAnnotationVisitor();
 	}
 
 	public AnnotationVisitor visitArray(final String attrName) {
-		return new AnnotationVisitor() {
+		return new AnnotationVisitor(org.springframework.asm.SpringAsmInfo.ASM_VERSION) {
 			public void visit(String name, Object value) {
 				Object newValue = value;
 				Object existingValue = localAttributes.get(attrName);
@@ -103,10 +102,10 @@
 			public void visitEnum(String name, String desc, String value) {
 			}
 			public AnnotationVisitor visitAnnotation(String name, String desc) {
-				return new EmptyVisitor();
+				return new EmptyAnnotationVisitor();
 			}
 			public AnnotationVisitor visitArray(String name) {
-				return new EmptyVisitor();
+				return new EmptyAnnotationVisitor();
 			}
 			public void visitEnd() {
 			}
--- a/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java
+++ b/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/ClassMetadataReadingVisitor.java
@@ -22,7 +22,7 @@
 import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.springframework.asm.SpringAsmInfo;
 import org.springframework.core.type.ClassMetadata;
 import org.springframework.util.ClassUtils;
 
@@ -35,9 +35,10 @@
  * @author Costin Leau
  * @author Mark Fisher
  * @author Ramnivas Laddad
+ * @author Chris Beams
  * @since 2.5
  */
-class ClassMetadataReadingVisitor implements ClassVisitor, ClassMetadata {
+class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata {
 
 	private String className;
 
@@ -56,6 +57,11 @@
 	private String[] interfaces;
 	
 
+	public ClassMetadataReadingVisitor() {
+		super(SpringAsmInfo.ASM_VERSION);
+	}
+
+
 	public void visit(int version, int access, String name, String signature, String supername, String[] interfaces) {
 		this.className = ClassUtils.convertResourcePathToClassName(name);
 		this.isInterface = ((access & Opcodes.ACC_INTERFACE) != 0);
@@ -87,7 +93,7 @@
 
 	public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 		// no-op
-		return new EmptyVisitor();
+		return new EmptyAnnotationVisitor();
 	}
 
 	public void visitAttribute(Attribute attr) {
@@ -96,12 +102,12 @@
 
 	public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
 		// no-op
-		return new EmptyVisitor();
+		return new EmptyFieldVisitor();
 	}
 
 	public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
 		// no-op
-		return new EmptyVisitor();
+		return new EmptyMethodVisitor();
 	}
 
 	public void visitEnd() {
@@ -154,3 +160,38 @@
 	}
 
 }
+
+
+class EmptyAnnotationVisitor extends AnnotationVisitor {
+
+	public EmptyAnnotationVisitor() {
+		super(SpringAsmInfo.ASM_VERSION);
+	}
+
+	@Override
+	public AnnotationVisitor visitAnnotation(String name, String desc) {
+		return this;
+	}
+
+	@Override
+	public AnnotationVisitor visitArray(String name) {
+		return this;
+	}
+}
+
+
+class EmptyMethodVisitor extends MethodVisitor {
+
+	public EmptyMethodVisitor() {
+		super(SpringAsmInfo.ASM_VERSION);
+	}
+}
+
+
+class EmptyFieldVisitor extends FieldVisitor {
+
+	public EmptyFieldVisitor() {
+		super(SpringAsmInfo.ASM_VERSION);
+	}
+
+}
--- a/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java
+++ b/projects/org.springframework.core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java
@@ -20,10 +20,10 @@
 import java.util.Map;
 
 import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.MethodAdapter;
+import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
 import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.springframework.asm.SpringAsmInfo;
 import org.springframework.core.type.MethodMetadata;
 import org.springframework.util.MultiValueMap;
 
@@ -37,7 +37,7 @@
  * @author Costin Leau
  * @since 3.0
  */
-final class MethodMetadataReadingVisitor extends MethodAdapter implements MethodMetadata {
+final class MethodMetadataReadingVisitor extends MethodVisitor implements MethodMetadata {
 
 	private final String name;
 
@@ -53,7 +53,7 @@
 
 	public MethodMetadataReadingVisitor(String name, int access, String declaringClassName, ClassLoader classLoader,
 			MultiValueMap<String, MethodMetadata> methodMetadataMap) {
-		super(new EmptyVisitor());
+		super(SpringAsmInfo.ASM_VERSION);
 		this.name = name;
 		this.access = access;
 		this.declaringClassName = declaringClassName;