add IClass.isPrivate

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3597 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-05-15 19:04:19 +00:00
parent 2e8da872c0
commit 42bcf0010d
8 changed files with 55 additions and 39 deletions

View File

@ -306,6 +306,10 @@ public class ArrayClass implements IClass, Constants {
public boolean isPublic() {
return true;
}
public boolean isPrivate() {
return false;
}
public InputStream getSource() {
return null;

View File

@ -47,6 +47,11 @@ public interface IClass extends IClassHierarchyDweller {
* @return true iff this class is public
*/
boolean isPublic();
/**
* @return true iff this class is private
*/
boolean isPrivate();
/**
* Return the integer that encodes the class's modifiers, as defined by the JVM specification

View File

@ -35,6 +35,11 @@ public abstract class JVMClass<T extends IClassLoader> extends BytecodeClass<T>
boolean result = ((modifiers & Constants.ACC_PUBLIC) != 0);
return result;
}
public boolean isPrivate() {
boolean result = ((modifiers & Constants.ACC_PRIVATE) != 0);
return result;
}
public boolean isInterface() {
boolean result = ((modifiers & Constants.ACC_INTERFACE) != 0);

View File

@ -236,6 +236,10 @@ public class FakeRootClass extends SyntheticClass {
public boolean isPublic() {
return false;
}
public boolean isPrivate() {
return false;
}
@Override
public InputStream getSource() {

View File

@ -234,6 +234,10 @@ public class BypassSyntheticClass extends SyntheticClass {
public boolean isPublic() {
return realType.isPublic();
}
public boolean isPrivate() {
return realType.isPrivate();
}
@Override
public InputStream getSource() {

View File

@ -14,9 +14,8 @@ import java.util.Iterator;
import com.ibm.wala.util.debug.Assertions;
/**
* A bit set is a set of elements, each of which corresponds to a unique
* integer from [0,MAX].
/**
* A bit set is a set of elements, each of which corresponds to a unique integer from [0,MAX].
*/
public final class BitSet<T> {
@ -26,13 +25,14 @@ public final class BitSet<T> {
final private BitVector vector;
/**
* The bijection between integer to object.
* The bijection between integer to object.
*/
private OrdinalSetMapping<T> map;
/**
* Constructor: create an empty set corresponding to a given mapping
* @throws IllegalArgumentException if map is null
*
* @throws IllegalArgumentException if map is null
*/
public BitSet(OrdinalSetMapping<T> map) {
if (map == null) {
@ -43,22 +43,22 @@ public final class BitSet<T> {
this.map = map;
}
public static <T> BitSet<T> createBitSet(BitSet<T> B) {
if (B == null) {
throw new IllegalArgumentException("null B");
}
return new BitSet<T>(B);
}
private BitSet(BitSet<T> B){
private BitSet(BitSet<T> B) {
this(B.map);
addAll(B);
}
/**
* Add all elements in bitset B to this bit set
* @throws IllegalArgumentException if B is null
*
* @throws IllegalArgumentException if B is null
*/
public void addAll(BitSet<?> B) {
if (B == null) {
@ -84,6 +84,7 @@ public final class BitSet<T> {
/**
* Remove an object from this bit set.
*
* @param o the object to remove
*/
public void clear(T o) {
@ -114,9 +115,10 @@ public final class BitSet<T> {
}
/**
* Method copy. Copies the bits in the bit vector, but only assigns the object map. No need to create
* a new object/bit bijection object.
* @throws IllegalArgumentException if other is null
* Method copy. Copies the bits in the bit vector, but only assigns the object map. No need to create a new object/bit bijection
* object.
*
* @throws IllegalArgumentException if other is null
*/
public void copyBits(BitSet<T> other) {
if (other == null) {
@ -128,7 +130,8 @@ public final class BitSet<T> {
/**
* Does this object hold the same bits as other?
* @throws IllegalArgumentException if other is null
*
* @throws IllegalArgumentException if other is null
*/
public boolean sameBits(BitSet<?> other) {
if (other == null) {
@ -151,9 +154,11 @@ public final class BitSet<T> {
}
}
}
public boolean hasNext() {
return (next != -1);
}
public Object next() {
Object result = map.getMappedObject(next);
int start = next + 1;
@ -166,16 +171,13 @@ public final class BitSet<T> {
}
return result;
}
public void remove() {
Assertions.UNREACHABLE();
}
};
}
/**
* Method size.
* @return int
*/
public int size() {
return vector.populationCount();
}
@ -200,8 +202,9 @@ public final class BitSet<T> {
/**
* Perform intersection of two bitsets
*
* @param other the other bitset in the operation
* @throws IllegalArgumentException if other is null
* @throws IllegalArgumentException if other is null
*/
public void intersect(BitSet<?> other) {
if (other == null) {
@ -212,8 +215,9 @@ public final class BitSet<T> {
/**
* Perform the difference of two bit sets
* @param other
* @throws IllegalArgumentException if other is null
*
* @param other the other bitset in the operation
* @throws IllegalArgumentException if other is null
*/
public void difference(BitSet<T> other) {
if (other == null) {

View File

@ -132,13 +132,17 @@ public class ActionFormFactoryMethod extends SummarizedMethod {
}
public boolean isPublic() {
assert false;
return false;
}
public boolean isPrivate() {
// TODO Auto-generated method stub
assert false;
return false;
}
public boolean isReferenceType() {
// TODO Auto-generated method stub
assert false;
return false;
}

View File

@ -226,8 +226,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getDeclaredStaticFields()
*/
public Collection<IField> getDeclaredStaticFields() {
@ -304,8 +302,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object arg0) {
@ -313,8 +309,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
@ -322,8 +316,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getModifiers()
*/
public int getModifiers() {
@ -333,8 +325,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getAllImplementedInterfaces()
*/
public Collection<IClass> getAllImplementedInterfaces() {
@ -342,8 +332,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getAllAncestorInterfaces()
*/
public Collection<IClass> getAllAncestorInterfaces() {
@ -353,8 +341,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getName()
*/
public TypeName getName() {
@ -362,8 +348,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#isReferenceType()
*/
public boolean isReferenceType() {
@ -371,8 +355,6 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.classLoader.IClass#getDirectInterfaces()
*/
public Collection<IClass> getDirectInterfaces() {
@ -396,5 +378,9 @@ class J2EEContainerModel extends SyntheticClass implements BytecodeConstants, EJ
public boolean isPublic() {
return false;
}
public boolean isPrivate() {
return false;
}
}