Exemplo n.º 1
0
 /*
  * @see com.ibm.wala.classLoader.IClass#getAllStaticFields()
  */
 @Override
 public Collection<IField> getAllStaticFields() {
   Collection<IField> result = new LinkedList<IField>(getDeclaredStaticFields());
   IClass s = getSuperclass();
   while (s != null) {
     result.addAll(s.getDeclaredStaticFields());
     s = s.getSuperclass();
   }
   return result;
 }
Exemplo n.º 2
0
  /*
   * @see com.ibm.wala.classLoader.IClass#getSuperclass()
   */
  @Override
  public IClass getSuperclass() {
    IClass elt = getElementClass();
    assert getReference().getArrayElementType().isPrimitiveType() || elt != null;

    // super is Ljava/lang/Object in two cases:
    // 1) [Ljava/lang/Object
    // 2) [? for primitive arrays (null from getElementClass)
    if (elt == null || elt.getReference() == getClassLoader().getLanguage().getRootType()) {
      return loader.lookupClass(getClassLoader().getLanguage().getRootType().getName());
    }

    // else it is array of super of element type (yuck)
    else {
      TypeReference eltSuperRef = elt.getSuperclass().getReference();
      TypeReference superRef = TypeReference.findOrCreateArrayOf(eltSuperRef);
      return elt.getSuperclass().getClassLoader().lookupClass(superRef.getName());
    }
  }
Exemplo n.º 3
0
 /*
  * @see com.ibm.wala.classLoader.IClass#getAllMethods()
  */
 @Override
 public Collection<IMethod> getAllMethods() {
   Collection<IMethod> result = new LinkedList<IMethod>();
   Iterator<IMethod> declaredMethods = getDeclaredMethods().iterator();
   while (declaredMethods.hasNext()) {
     result.add(declaredMethods.next());
   }
   if (isInterface()) {
     for (IClass i : getDirectInterfaces()) {
       result.addAll(i.getAllMethods());
     }
   }
   IClass s = getSuperclass();
   while (s != null) {
     Iterator<IMethod> superDeclaredMethods = s.getDeclaredMethods().iterator();
     while (superDeclaredMethods.hasNext()) {
       result.add(superDeclaredMethods.next());
     }
     s = s.getSuperclass();
   }
   return result;
 }