API change for IClass.getDeclaredMethods()
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@521 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
184cca27fb
commit
05fb718826
|
@ -11,8 +11,8 @@
|
||||||
package com.ibm.wala.classLoader;
|
package com.ibm.wala.classLoader;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
|
@ -22,7 +22,6 @@ import com.ibm.wala.types.Selector;
|
||||||
import com.ibm.wala.types.TypeName;
|
import com.ibm.wala.types.TypeName;
|
||||||
import com.ibm.wala.types.TypeReference;
|
import com.ibm.wala.types.TypeReference;
|
||||||
import com.ibm.wala.util.Atom;
|
import com.ibm.wala.util.Atom;
|
||||||
import com.ibm.wala.util.collections.EmptyIterator;
|
|
||||||
import com.ibm.wala.util.collections.HashSetFactory;
|
import com.ibm.wala.util.collections.HashSetFactory;
|
||||||
import com.ibm.wala.util.debug.Assertions;
|
import com.ibm.wala.util.debug.Assertions;
|
||||||
|
|
||||||
|
@ -161,8 +160,8 @@ public class ArrayClass implements IClass, Constants {
|
||||||
*
|
*
|
||||||
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
||||||
*/
|
*/
|
||||||
public Iterator<IMethod> getDeclaredMethods() {
|
public Collection<IMethod> getDeclaredMethods() {
|
||||||
return EmptyIterator.instance();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfDeclaredMethods() {
|
public int getNumberOfDeclaredMethods() {
|
||||||
|
|
|
@ -458,10 +458,7 @@ public class ClassLoaderImpl implements IClassLoader {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (Iterator<IClass> it = iterateAllClasses(); it.hasNext();) {
|
for (Iterator<IClass> it = iterateAllClasses(); it.hasNext();) {
|
||||||
IClass klass = it.next();
|
IClass klass = it.next();
|
||||||
for (Iterator i2 = klass.getDeclaredMethods(); i2.hasNext();) {
|
result += klass.getDeclaredMethods().size();
|
||||||
i2.next();
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package com.ibm.wala.classLoader;
|
package com.ibm.wala.classLoader;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
import com.ibm.wala.ipa.cha.IClassHierarchyDweller;
|
import com.ibm.wala.ipa.cha.IClassHierarchyDweller;
|
||||||
|
@ -118,7 +117,7 @@ public interface IClass extends IClassHierarchyDweller {
|
||||||
/**
|
/**
|
||||||
* @return an Iterator of the IMethods declared by this class.
|
* @return an Iterator of the IMethods declared by this class.
|
||||||
*/
|
*/
|
||||||
Iterator<IMethod> getDeclaredMethods();
|
Collection<IMethod> getDeclaredMethods();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the instance fields declared by this class or any of
|
* Compute the instance fields declared by this class or any of
|
||||||
|
|
|
@ -684,7 +684,7 @@ public final class ShrikeCTClassWrapper implements IClass {
|
||||||
*
|
*
|
||||||
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
||||||
*/
|
*/
|
||||||
public Iterator<IMethod> getDeclaredMethods() {
|
public Collection<IMethod> getDeclaredMethods() {
|
||||||
if (methodMap == null) {
|
if (methodMap == null) {
|
||||||
try {
|
try {
|
||||||
computeMethodMap();
|
computeMethodMap();
|
||||||
|
@ -693,7 +693,7 @@ public final class ShrikeCTClassWrapper implements IClass {
|
||||||
Assertions.UNREACHABLE();
|
Assertions.UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return methodMap.values().iterator();
|
return Collections.unmodifiableCollection(methodMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -755,7 +755,7 @@ public final class ShrikeCTClassWrapper implements IClass {
|
||||||
public void clearSoftCaches() {
|
public void clearSoftCaches() {
|
||||||
// toss optional information from each method.
|
// toss optional information from each method.
|
||||||
if (methodMap != null) {
|
if (methodMap != null) {
|
||||||
for (Iterator it = getDeclaredMethods(); it.hasNext();) {
|
for (Iterator it = getDeclaredMethods().iterator(); it.hasNext();) {
|
||||||
ShrikeCTMethodWrapper m = (ShrikeCTMethodWrapper) it.next();
|
ShrikeCTMethodWrapper m = (ShrikeCTMethodWrapper) it.next();
|
||||||
m.clearCaches();
|
m.clearCaches();
|
||||||
}
|
}
|
||||||
|
@ -807,13 +807,13 @@ public final class ShrikeCTClassWrapper implements IClass {
|
||||||
*/
|
*/
|
||||||
public Collection<IMethod> getAllMethods() throws ClassHierarchyException {
|
public Collection<IMethod> getAllMethods() throws ClassHierarchyException {
|
||||||
Collection<IMethod> result = new LinkedList<IMethod>();
|
Collection<IMethod> result = new LinkedList<IMethod>();
|
||||||
Iterator<IMethod> declaredMethods = getDeclaredMethods();
|
Iterator<IMethod> declaredMethods = getDeclaredMethods().iterator();
|
||||||
while (declaredMethods.hasNext()) {
|
while (declaredMethods.hasNext()) {
|
||||||
result.add(declaredMethods.next());
|
result.add(declaredMethods.next());
|
||||||
}
|
}
|
||||||
IClass s = getSuperclass();
|
IClass s = getSuperclass();
|
||||||
while (s != null) {
|
while (s != null) {
|
||||||
Iterator<IMethod> superDeclaredMethods = s.getDeclaredMethods();
|
Iterator<IMethod> superDeclaredMethods = s.getDeclaredMethods().iterator();
|
||||||
while (superDeclaredMethods.hasNext()) {
|
while (superDeclaredMethods.hasNext()) {
|
||||||
result.add(superDeclaredMethods.next());
|
result.add(superDeclaredMethods.next());
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class AllApplicationEntrypoints extends BasicEntrypoints {
|
||||||
IClass klass = classIt.next();
|
IClass klass = classIt.next();
|
||||||
if (!klass.isInterface()) {
|
if (!klass.isInterface()) {
|
||||||
if (isApplicationClass(scope, klass)) {
|
if (isApplicationClass(scope, klass)) {
|
||||||
for (Iterator methodIt = klass.getDeclaredMethods(); methodIt.hasNext();) {
|
for (Iterator methodIt = klass.getDeclaredMethods().iterator(); methodIt.hasNext();) {
|
||||||
IMethod method = (IMethod) methodIt.next();
|
IMethod method = (IMethod) methodIt.next();
|
||||||
if (!method.isAbstract()) {
|
if (!method.isAbstract()) {
|
||||||
add(new ArgumentTypeEntrypoint(method, cha));
|
add(new ArgumentTypeEntrypoint(method, cha));
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class FakeRootMethod extends SyntheticMethod {
|
||||||
*
|
*
|
||||||
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
||||||
*/
|
*/
|
||||||
public Iterator<IMethod> getDeclaredMethods() {
|
public Collection<IMethod> getDeclaredMethods() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
Assertions.UNREACHABLE();
|
Assertions.UNREACHABLE();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class BasicRTABuilder extends AbstractRTABuilder {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Trace.println("registerImplementedMethods: " + declarer + " " + iKey);
|
Trace.println("registerImplementedMethods: " + declarer + " " + iKey);
|
||||||
}
|
}
|
||||||
for (Iterator it = declarer.getDeclaredMethods(); it.hasNext();) {
|
for (Iterator it = declarer.getDeclaredMethods().iterator(); it.hasNext();) {
|
||||||
IMethod M = (IMethod) it.next();
|
IMethod M = (IMethod) it.next();
|
||||||
Selector selector = M.getReference().getSelector();
|
Selector selector = M.getReference().getSelector();
|
||||||
PointerKey sKey = getKeyForSelector(selector);
|
PointerKey sKey = getKeyForSelector(selector);
|
||||||
|
|
|
@ -12,7 +12,6 @@ package com.ibm.wala.ipa.summaries;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import com.ibm.wala.classLoader.IClass;
|
import com.ibm.wala.classLoader.IClass;
|
||||||
import com.ibm.wala.classLoader.IClassLoader;
|
import com.ibm.wala.classLoader.IClassLoader;
|
||||||
|
@ -155,7 +154,7 @@ public class BypassSyntheticClass extends SyntheticClass {
|
||||||
*
|
*
|
||||||
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
* @see com.ibm.wala.classLoader.IClass#getDeclaredMethods()
|
||||||
*/
|
*/
|
||||||
public Iterator<IMethod> getDeclaredMethods() {
|
public Collection<IMethod> getDeclaredMethods() {
|
||||||
return realType.getDeclaredMethods();
|
return realType.getDeclaredMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ public final class MethodReference extends MemberReference {
|
||||||
|
|
||||||
public final static Atom initAtom = Atom.findOrCreateUnicodeAtom("<init>");
|
public final static Atom initAtom = Atom.findOrCreateUnicodeAtom("<init>");
|
||||||
public final static Descriptor defaultInitDesc = Descriptor.findOrCreateUTF8("()V");
|
public final static Descriptor defaultInitDesc = Descriptor.findOrCreateUTF8("()V");
|
||||||
|
|
||||||
public final static Selector initSelector = new Selector(initAtom, defaultInitDesc);
|
public final static Selector initSelector = new Selector(initAtom, defaultInitDesc);
|
||||||
|
|
||||||
public final static Atom clinitName = Atom.findOrCreateUnicodeAtom("<clinit>");
|
public final static Atom clinitName = Atom.findOrCreateUnicodeAtom("<clinit>");
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ReferenceCleanser {
|
||||||
ShrikeCTClassWrapper c = (ShrikeCTClassWrapper) klass;
|
ShrikeCTClassWrapper c = (ShrikeCTClassWrapper) klass;
|
||||||
c.clearSoftCaches();
|
c.clearSoftCaches();
|
||||||
} else {
|
} else {
|
||||||
for (Iterator it2 = klass.getDeclaredMethods(); it2.hasNext(); ) {
|
for (Iterator it2 = klass.getDeclaredMethods().iterator(); it2.hasNext(); ) {
|
||||||
IMethod m = (IMethod)it2.next();
|
IMethod m = (IMethod)it2.next();
|
||||||
if (m instanceof ShrikeCTMethodWrapper) {
|
if (m instanceof ShrikeCTMethodWrapper) {
|
||||||
((ShrikeCTMethodWrapper)m).clearCaches();
|
((ShrikeCTMethodWrapper)m).clearCaches();
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class EclipseEntrypoints extends BasicEntrypoints {
|
||||||
}
|
}
|
||||||
if (!klass.isInterface()) {
|
if (!klass.isInterface()) {
|
||||||
if (isApplicationClass(scope, klass)) {
|
if (isApplicationClass(scope, klass)) {
|
||||||
for (Iterator methodIt = klass.getDeclaredMethods(); methodIt.hasNext();) {
|
for (Iterator methodIt = klass.getDeclaredMethods().iterator(); methodIt.hasNext();) {
|
||||||
IMethod method = (IMethod) methodIt.next();
|
IMethod method = (IMethod) methodIt.next();
|
||||||
if (!method.isAbstract() && method.isPublic() || method.isProtected()) {
|
if (!method.isAbstract() && method.isPublic() || method.isProtected()) {
|
||||||
add(new ArgumentTypeEntrypoint(method, cha));
|
add(new ArgumentTypeEntrypoint(method, cha));
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class JUnitEntryPoints {
|
||||||
Trace.println("found test class");
|
Trace.println("found test class");
|
||||||
}
|
}
|
||||||
// add entry point corresponding to the target method
|
// add entry point corresponding to the target method
|
||||||
for (Iterator methodsIt = klass.getDeclaredMethods(); methodsIt.hasNext();) {
|
for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) {
|
||||||
IMethod method = (IMethod) methodsIt.next();
|
IMethod method = (IMethod) methodsIt.next();
|
||||||
Atom methodAtom = method.getName();
|
Atom methodAtom = method.getName();
|
||||||
if (methodAtom.equals(targetMethodAtom)) {
|
if (methodAtom.equals(targetMethodAtom)) {
|
||||||
|
@ -181,7 +181,7 @@ public class JUnitEntryPoints {
|
||||||
IClass currClass = testClass;
|
IClass currClass = testClass;
|
||||||
while (currClass != null && !currClass.getName().equals(junitTestCaseType) && !currClass.getName().equals(junitTestSuiteType)) {
|
while (currClass != null && !currClass.getName().equals(junitTestCaseType) && !currClass.getName().equals(junitTestSuiteType)) {
|
||||||
|
|
||||||
for (Iterator methodsIt = currClass.getDeclaredMethods(); methodsIt.hasNext();) {
|
for (Iterator methodsIt = currClass.getDeclaredMethods().iterator(); methodsIt.hasNext();) {
|
||||||
|
|
||||||
IMethod method = (IMethod) methodsIt.next();
|
IMethod method = (IMethod) methodsIt.next();
|
||||||
final Atom methodAtom = method.getName();
|
final Atom methodAtom = method.getName();
|
||||||
|
|
Loading…
Reference in New Issue