Skip to content

Commit c39018b

Browse files
Updated ASM source to 5.0.3
git-svn-id: https://svn.code.sf.net/p/drgarbagetools/code/trunk@603 29b5cefd-a3af-4257-b993-4d75a07eac1e
1 parent fcff6ff commit c39018b

20 files changed

+2635
-4
lines changed

com.drgarbage.asm.src/build.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@
189189

190190
<target name="shrink" depends="compile-debug" if="product.shrink">
191191
<echo message="Shrinking"/>
192-
<!--
193192
<java classname="org.objectweb.asm.optimizer.Shrinker">
194193
<classpath>
195194
<pathelement location="${out.build}/tmp"/>
@@ -203,7 +202,6 @@
203202
<arg value="${out.build}/tmp"/>
204203
<arg value="${out.build}"/>
205204
</java>
206-
-->
207205
</target>
208206

209207
<target name="noshrink" depends="compile-debug" if="product.noshrink">
@@ -316,15 +314,14 @@
316314

317315
<target name="jar" depends="dist.init,dist.version,compile,shrink">
318316
<multipleAnt dir="${archive}"/>
319-
<!--
320317
<java classname="org.objectweb.asm.optimizer.JarOptimizer">
321318
<classpath>
322319
<pathelement location="${out.build}/tmp"/>
323320
</classpath>
321+
<!--arg value="${src}/org/objectweb/asm/optimizer/jdk1.2.2_017.txt.gz"/-->
324322
<arg value="${src}/org/objectweb/asm/optimizer/jdk1.3.1_19.txt.gz"/>
325323
<arg value="${out.dist.lib}"/>
326324
</java>
327-
-->
328325
</target>
329326

330327
<target name="jdoc" depends="init,dist.init">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/***
2+
* ASM: a very small and fast Java bytecode manipulation framework
3+
* Copyright (c) 2000-2011 INRIA, France Telecom
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met:
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. Neither the name of the copyright holders nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28+
* THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
package org.objectweb.asm.optimizer;
31+
32+
import org.objectweb.asm.AnnotationVisitor;
33+
import org.objectweb.asm.Opcodes;
34+
import org.objectweb.asm.Type;
35+
36+
/**
37+
* An {@link AnnotationVisitor} that collects the {@link Constant}s of the
38+
* annotations it visits.
39+
*
40+
* @author Eric Bruneton
41+
*/
42+
public class AnnotationConstantsCollector extends AnnotationVisitor {
43+
44+
private final ConstantPool cp;
45+
46+
public AnnotationConstantsCollector(
47+
final AnnotationVisitor av,
48+
final ConstantPool cp)
49+
{
50+
super(Opcodes.ASM4, av);
51+
this.cp = cp;
52+
}
53+
54+
@Override
55+
public void visit(final String name, final Object value) {
56+
if (name != null) {
57+
cp.newUTF8(name);
58+
}
59+
if (value instanceof Byte) {
60+
cp.newInteger(((Byte) value).byteValue());
61+
} else if (value instanceof Boolean) {
62+
cp.newInteger(((Boolean) value).booleanValue() ? 1 : 0);
63+
} else if (value instanceof Character) {
64+
cp.newInteger(((Character) value).charValue());
65+
} else if (value instanceof Short) {
66+
cp.newInteger(((Short) value).shortValue());
67+
} else if (value instanceof Type) {
68+
cp.newUTF8(((Type) value).getDescriptor());
69+
} else if (value instanceof byte[]) {
70+
byte[] v = (byte[]) value;
71+
for (int i = 0; i < v.length; i++) {
72+
cp.newInteger(v[i]);
73+
}
74+
} else if (value instanceof boolean[]) {
75+
boolean[] v = (boolean[]) value;
76+
for (int i = 0; i < v.length; i++) {
77+
cp.newInteger(v[i] ? 1 : 0);
78+
}
79+
} else if (value instanceof short[]) {
80+
short[] v = (short[]) value;
81+
for (int i = 0; i < v.length; i++) {
82+
cp.newInteger(v[i]);
83+
}
84+
} else if (value instanceof char[]) {
85+
char[] v = (char[]) value;
86+
for (int i = 0; i < v.length; i++) {
87+
cp.newInteger(v[i]);
88+
}
89+
} else if (value instanceof int[]) {
90+
int[] v = (int[]) value;
91+
for (int i = 0; i < v.length; i++) {
92+
cp.newInteger(v[i]);
93+
}
94+
} else if (value instanceof long[]) {
95+
long[] v = (long[]) value;
96+
for (int i = 0; i < v.length; i++) {
97+
cp.newLong(v[i]);
98+
}
99+
} else if (value instanceof float[]) {
100+
float[] v = (float[]) value;
101+
for (int i = 0; i < v.length; i++) {
102+
cp.newFloat(v[i]);
103+
}
104+
} else if (value instanceof double[]) {
105+
double[] v = (double[]) value;
106+
for (int i = 0; i < v.length; i++) {
107+
cp.newDouble(v[i]);
108+
}
109+
} else {
110+
cp.newConst(value);
111+
}
112+
av.visit(name, value);
113+
}
114+
115+
@Override
116+
public void visitEnum(
117+
final String name,
118+
final String desc,
119+
final String value)
120+
{
121+
if (name != null) {
122+
cp.newUTF8(name);
123+
}
124+
cp.newUTF8(desc);
125+
cp.newUTF8(value);
126+
av.visitEnum(name, desc, value);
127+
}
128+
129+
@Override
130+
public AnnotationVisitor visitAnnotation(
131+
final String name,
132+
final String desc)
133+
{
134+
if (name != null) {
135+
cp.newUTF8(name);
136+
}
137+
cp.newUTF8(desc);
138+
return new AnnotationConstantsCollector(av.visitAnnotation(name, desc),
139+
cp);
140+
}
141+
142+
@Override
143+
public AnnotationVisitor visitArray(final String name) {
144+
if (name != null) {
145+
cp.newUTF8(name);
146+
}
147+
return new AnnotationConstantsCollector(av.visitArray(name), cp);
148+
}
149+
150+
@Override
151+
public void visitEnd() {
152+
av.visitEnd();
153+
}
154+
}

0 commit comments

Comments
 (0)