01: /*
02: * FindBugs - Find Bugs in Java programs
03: * Copyright (C) 2005, University of Maryland
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 Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19:
20: package edu.umd.cs.findbugs.ba;
21:
22: import org.apache.bcel.classfile.JavaClass;
23: import org.apache.bcel.classfile.Method;
24:
25: import edu.umd.cs.findbugs.classfile.MethodDescriptor;
26:
27: /**
28: * Used to signal a method not analyzed because it seemed unprofitable to do so
29: * @author pugh
30: */
31: public class MethodUnprofitableException extends CFGBuilderException {
32: private static final long serialVersionUID = 1L;
33: private final XMethod method;
34:
35: /**
36: * Constructor.
37: *
38: * @param method the method that is unprofitable to analyze
39: */
40: public MethodUnprofitableException(JavaClassAndMethod method) {
41: super ("Appears unprofitable to analyze " + method);
42: this .method = XFactory.createXMethod(method.getJavaClass(),
43: method.getMethod());
44: }
45:
46: /**
47: * Constructor.
48: *
49: * @param jClass the class containing the method that is unprofitable to analyze
50: * @param method the method that is unprofitable to analyze
51: */
52: public MethodUnprofitableException(JavaClass jClass, Method method) {
53: super ("Appears unprofitable to analyze " + method);
54: this .method = XFactory.createXMethod(jClass, method);
55: }
56:
57: /**
58: * Constructor.
59: *
60: * @param methodDescriptor the MethodDescriptor indicating the method it is unprofitable to analyze
61: */
62: public MethodUnprofitableException(MethodDescriptor methodDescriptor) {
63: super ("Appears unprofitable to analyze "
64: + methodDescriptor.toString());
65: this .method = XFactory.createXMethod(methodDescriptor
66: .getClassDescriptor().toDottedClassName(),
67: methodDescriptor.getName(), methodDescriptor
68: .getSignature(), methodDescriptor.isStatic());
69: }
70:
71: /**
72: * @return the method that is unprofitable to analyze
73: */
74: public XMethod getMethod() {
75: return method;
76: }
77:
78: }
|