rlm@10: rlm@10: rlm@10:
rlm@10: Provides some useful class and method adapters. The preferred way of using rlm@10: these adapters is by chaining them together and to custom adapters (instead of rlm@10: inheriting from them). Indeed this approach provides more combination rlm@10: possibilities than inheritance. For instance, suppose you want to implement an rlm@10: adapter MyAdapter than needs sorted local variables and intermediate stack map rlm@10: frame values taking into account the local variables sort. By using inheritance, rlm@10: this would require MyAdapter to extend AnalyzerAdapter, itself extending rlm@10: LocalVariablesSorter. But AnalyzerAdapter is not a subclass of rlm@10: LocalVariablesSorter, so this is not possible. On the contrary, by using rlm@10: delegation, you can make LocalVariablesSorter delegate to AnalyzerAdapter, rlm@10: itself delegating to MyAdapter. In this case AnalyzerAdapter computes rlm@10: intermediate frames based on the output of LocalVariablesSorter, and MyAdapter rlm@10: can add new locals by calling the newLocal method on LocalVariablesSorter, and rlm@10: can get the stack map frame state before each instruction by reading the locals rlm@10: and stack fields in AnalyzerAdapter (this requires references from MyAdapter rlm@10: back to LocalVariablesSorter and AnalyzerAdapter). rlm@10: