view src/clojure/asm/package.html @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
line wrap: on
line source
1 <html>
2 <!--
3 * ASM: a very small and fast Java bytecode manipulation framework
4 * Copyright (c) 2000-2005 INRIA, France Telecom
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holders nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGE.
30 -->
31 <body>
32 Provides a small and fast bytecode manipulation framework.
34 <p>
35 The <a href="http://www.objectweb.org/asm">ASM</a> framework is organized
36 around the {@link clojure.asm.ClassVisitor ClassVisitor},
37 {@link clojure.asm.FieldVisitor FieldVisitor} and
38 {@link clojure.asm.MethodVisitor MethodVisitor} interfaces, which allow
39 one to visit the fields and methods of a class, including the bytecode
40 instructions of each method.
42 <p>
43 In addition to these main interfaces, ASM provides a {@link
44 clojure.asm.ClassReader ClassReader} class, that can parse an
45 existing class and make a given visitor visit it. ASM also provides
46 a {@link clojure.asm.ClassWriter ClassWriter} class, which is
47 a visitor that generates Java class files.
49 <p>
50 In order to generate a class from scratch, only the {@link
51 clojure.asm.ClassWriter ClassWriter} class is necessary. Indeed,
52 in order to generate a class, one must just call its visit<i>XXX</i>
53 methods with the appropriate arguments to generate the desired fields
54 and methods. See the "helloworld" example in the ASM distribution for
55 more details about class generation.
57 <p>
58 In order to modify existing classes, one must use a {@link
59 clojure.asm.ClassReader ClassReader} class to analyze
60 the original class, a class modifier, and a {@link clojure.asm.ClassWriter
61 ClassWriter} to construct the modified class. The class modifier
62 is just a {@link clojure.asm.ClassVisitor ClassVisitor}
63 that delegates most of the work to another {@link clojure.asm.ClassVisitor
64 ClassVisitor}, but that sometimes changes some parameter values,
65 or call additional methods, in order to implement the desired
66 modification process. In order to make it easier to implement such
67 class modifiers, ASM provides the {@link clojure.asm.ClassAdapter
68 ClassAdapter} and {@link clojure.asm.MethodAdapter MethodAdapter}
69 classes, which implement the {@link clojure.asm.ClassVisitor ClassVisitor}
70 and {@link clojure.asm.MethodVisitor MethodVisitor} interfaces by
71 delegating all work to other visitors. See the "adapt" example in the ASM
72 distribution for more details about class modification.
74 <p>
75 The size of the core ASM library, <tt>asm.jar</tt>, is only 42KB, which is much
76 smaller than the size of the
77 <a href="http://jakarta.apache.org/bcel">BCEL</a> library (504KB), and than the
78 size of the
79 <a href="http://serp.sourceforge.net">SERP</a> library (150KB). ASM is also
80 much faster than these tools. Indeed the overhead of a load time class
81 transformation process is of the order of 60% with ASM, 700% or more with BCEL,
82 and 1100% or more with SERP (see the <tt>test/perf</tt> directory in the ASM
83 distribution)!
85 @since ASM 1.3
86 </body>
87 </html>