01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 1999 Patrick Lam
03: * Copyright (C) 2004 Ondrej Lhotak
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the
17: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18: * Boston, MA 02111-1307, USA.
19: */
20:
21: /*
22: * Modified by the Sable Research Group and others 1997-1999.
23: * See the 'credits' file distributed with Soot for the complete list of
24: * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
25: */
26:
27: package soot.jimple.internal;
28:
29: import soot.*;
30: import soot.jimple.*;
31: import java.util.*;
32:
33: public class JInterfaceInvokeExpr extends AbstractInterfaceInvokeExpr {
34: public JInterfaceInvokeExpr(Value base, SootMethodRef methodRef,
35: List args) {
36: super (Jimple.v().newLocalBox(base), methodRef,
37: new ValueBox[args.size()]);
38:
39: if (!methodRef.declaringClass().isInterface()) {
40: throw new RuntimeException(
41: "Trying to create interface invoke expression for non-interface type. "
42: + "Use JVirtualInvokeExpr or JSpecialInvokeExpr instead!");
43: }
44:
45: for (int i = 0; i < args.size(); i++)
46: this .argBoxes[i] = Jimple.v().newImmediateBox(
47: (Value) args.get(i));
48: }
49:
50: public Object clone() {
51: List argList = new ArrayList(getArgCount());
52:
53: for (int i = 0; i < getArgCount(); i++) {
54: argList.add(i, Jimple.cloneIfNecessary(getArg(i)));
55: }
56:
57: return new JInterfaceInvokeExpr(Jimple
58: .cloneIfNecessary(getBase()), methodRef, argList);
59: }
60:
61: }
|