2006-11-22 17:38:46 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*******************************************************************************/
|
|
|
|
package com.ibm.wala.classLoader;
|
|
|
|
|
|
|
|
import com.ibm.wala.ipa.callgraph.ContextItem;
|
2007-03-22 15:48:54 +00:00
|
|
|
import com.ibm.wala.shrikeCT.InvalidClassFileException;
|
2006-11-22 17:38:46 +00:00
|
|
|
import com.ibm.wala.types.Descriptor;
|
|
|
|
import com.ibm.wala.types.MethodReference;
|
|
|
|
import com.ibm.wala.types.Selector;
|
|
|
|
import com.ibm.wala.types.TypeReference;
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* Basic interface for an object that represents a single Java method for analysis purposes.
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
public interface IMethod extends IMember, ContextItem {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method synchronized?
|
|
|
|
*/
|
|
|
|
boolean isSynchronized();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method a class initializer?
|
|
|
|
*/
|
|
|
|
boolean isClinit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method an object initializer?
|
|
|
|
*/
|
|
|
|
boolean isInit();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method native?
|
|
|
|
*/
|
|
|
|
boolean isNative();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* Did someone synthesize this method? (As opposed to reading it from a class file)
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
boolean isSynthetic();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method abstract?
|
|
|
|
*/
|
|
|
|
boolean isAbstract();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method private?
|
|
|
|
*/
|
|
|
|
boolean isPrivate();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method protected?
|
|
|
|
*/
|
|
|
|
boolean isProtected();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method public?
|
|
|
|
*/
|
|
|
|
boolean isPublic();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this method final?
|
|
|
|
*/
|
|
|
|
boolean isFinal();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return canonical MethodReference corresponding to this method
|
|
|
|
*/
|
|
|
|
MethodReference getReference();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return maximum number of JVM locals used by this method
|
|
|
|
*/
|
|
|
|
int getMaxLocals();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return maximum height of JVM stack used by this method
|
|
|
|
*/
|
|
|
|
int getMaxStackHeight();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return true iff this method has at least one exception handler
|
|
|
|
*/
|
|
|
|
boolean hasExceptionHandler();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* By convention, for a non-static method, getParameterType(0) is the this pointer
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
TypeReference getParameterType(int i);
|
2008-03-20 17:56:50 +00:00
|
|
|
|
2006-11-22 17:38:46 +00:00
|
|
|
/**
|
|
|
|
* @return the name of the return type for this method
|
|
|
|
*/
|
|
|
|
TypeReference getReturnType();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* Method getNumberOfParameters. This result includes the "this" pointer if applicable
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
int getNumberOfParameters();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* @return an array of the exception types declared by the throws clause for this method, or null if there are none
|
|
|
|
* @throws InvalidClassFileException
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
2009-02-02 19:57:22 +00:00
|
|
|
TypeReference[] getDeclaredExceptions() throws InvalidClassFileException, UnsupportedOperationException;
|
2006-11-22 17:38:46 +00:00
|
|
|
|
|
|
|
/**
|
2009-03-31 18:56:06 +00:00
|
|
|
* @return the source line number corresponding to a particular bytecode index, or -1 if the information is not available.
|
2008-03-20 17:56:50 +00:00
|
|
|
* @throws InvalidClassFileException
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
2007-03-22 15:48:54 +00:00
|
|
|
int getLineNumber(int bcIndex) throws InvalidClassFileException;
|
2006-11-22 17:38:46 +00:00
|
|
|
|
|
|
|
/**
|
2009-03-31 18:56:06 +00:00
|
|
|
* @return the (source code) name of the local variable of a given number at the specified program counter, or null if the
|
|
|
|
* information is not available.
|
2008-03-20 17:56:50 +00:00
|
|
|
* @throws InvalidClassFileException
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
2007-03-22 15:48:54 +00:00
|
|
|
String getLocalVariableName(int bcIndex, int localNumber) throws InvalidClassFileException;
|
2006-11-22 17:38:46 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* something like: com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
public String getSignature();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* something like: foo(Ljava/langString;)Ljava/lang/Class;
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
public Selector getSelector();
|
|
|
|
|
|
|
|
/**
|
2009-03-31 18:56:06 +00:00
|
|
|
* something like: (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
Descriptor getDescriptor();
|
|
|
|
|
|
|
|
/**
|
2008-03-20 17:56:50 +00:00
|
|
|
* @return true iff the local variable table information for this method is available
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
boolean hasLocalVariableTable();
|
|
|
|
}
|