rlm@10
|
1 <html>
|
rlm@10
|
2 <!--
|
rlm@10
|
3 * ASM: a very small and fast Java bytecode manipulation framework
|
rlm@10
|
4 * Copyright (c) 2000-2005 INRIA, France Telecom
|
rlm@10
|
5 * All rights reserved.
|
rlm@10
|
6 *
|
rlm@10
|
7 * Redistribution and use in source and binary forms, with or without
|
rlm@10
|
8 * modification, are permitted provided that the following conditions
|
rlm@10
|
9 * are met:
|
rlm@10
|
10 * 1. Redistributions of source code must retain the above copyright
|
rlm@10
|
11 * notice, this list of conditions and the following disclaimer.
|
rlm@10
|
12 * 2. Redistributions in binary form must reproduce the above copyright
|
rlm@10
|
13 * notice, this list of conditions and the following disclaimer in the
|
rlm@10
|
14 * documentation and/or other materials provided with the distribution.
|
rlm@10
|
15 * 3. Neither the name of the copyright holders nor the names of its
|
rlm@10
|
16 * contributors may be used to endorse or promote products derived from
|
rlm@10
|
17 * this software without specific prior written permission.
|
rlm@10
|
18 *
|
rlm@10
|
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
rlm@10
|
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
rlm@10
|
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
rlm@10
|
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
rlm@10
|
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
rlm@10
|
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
rlm@10
|
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
rlm@10
|
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
rlm@10
|
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
rlm@10
|
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
rlm@10
|
29 * THE POSSIBILITY OF SUCH DAMAGE.
|
rlm@10
|
30 -->
|
rlm@10
|
31 <body>
|
rlm@10
|
32 Provides some useful class and method adapters. <i>The preferred way of using
|
rlm@10
|
33 these adapters is by chaining them together and to custom adapters (instead of
|
rlm@10
|
34 inheriting from them)</i>. Indeed this approach provides more combination
|
rlm@10
|
35 possibilities than inheritance. For instance, suppose you want to implement an
|
rlm@10
|
36 adapter MyAdapter than needs sorted local variables and intermediate stack map
|
rlm@10
|
37 frame values taking into account the local variables sort. By using inheritance,
|
rlm@10
|
38 this would require MyAdapter to extend AnalyzerAdapter, itself extending
|
rlm@10
|
39 LocalVariablesSorter. But AnalyzerAdapter is not a subclass of
|
rlm@10
|
40 LocalVariablesSorter, so this is not possible. On the contrary, by using
|
rlm@10
|
41 delegation, you can make LocalVariablesSorter delegate to AnalyzerAdapter,
|
rlm@10
|
42 itself delegating to MyAdapter. In this case AnalyzerAdapter computes
|
rlm@10
|
43 intermediate frames based on the output of LocalVariablesSorter, and MyAdapter
|
rlm@10
|
44 can add new locals by calling the newLocal method on LocalVariablesSorter, and
|
rlm@10
|
45 can get the stack map frame state before each instruction by reading the locals
|
rlm@10
|
46 and stack fields in AnalyzerAdapter (this requires references from MyAdapter
|
rlm@10
|
47 back to LocalVariablesSorter and AnalyzerAdapter).
|
rlm@10
|
48 </body> |