01: /* ===========================================================================
02: * $RCSfile: MdRef.java,v $
03: * ===========================================================================
04: *
05: * RetroGuard -- an obfuscation package for Java classfiles.
06: *
07: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
08: *
09: * This program can be redistributed and/or modified under the terms of the
10: * Version 2 of the GNU General Public License as published by the Free
11: * Software Foundation.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: */
19:
20: package COM.rl.obf;
21:
22: import java.io.*;
23: import java.util.*;
24: import COM.rl.util.*;
25:
26: /**
27: * Reference to a method that may or may not currently exist in ClassTree.
28: *
29: * @author Mark Welsh
30: */
31: public class MdRef extends TreeItemRef {
32: // Constants -------------------------------------------------------------
33:
34: // Fields ----------------------------------------------------------------
35:
36: // Class Methods ---------------------------------------------------------
37:
38: // Instance Methods ------------------------------------------------------
39: /** Ctor. */
40: public MdRef(String className, String name, String descriptor) {
41: super (className, name, descriptor);
42: }
43:
44: /** Convert ref to item using ClassTree, or null if not present. */
45: public TreeItem toTreeItem(ClassTree classTree) throws Exception {
46: Md md;
47: Cl cl = classTree.getCl(className);
48: while (cl != null) {
49: md = cl.getMethod(name, descriptor);
50: if (md != null) {
51: return md;
52: } else {
53: cl = cl.getSuperCl();
54: }
55: }
56: return null;
57: }
58: }
|