//# 0 errors, 382 messages
//#
/*
    //#WeakList.java:1:1: class: com.dmdirc.util.WeakList
    //#WeakList.java:1:1: method: com.dmdirc.util.WeakList.com.dmdirc.util.WeakList__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.util;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * Implements a list of weak references. The weak references (and subsequent
 * garbage collection) are handled transparently.
 * 
 * @param <T> The type of object that this list will contain.
 * @author chris
 */
public class WeakList<T> implements List<T> {

    /** The items in this list. */
    private final List<WeakReference<T>> list = new ArrayList<WeakReference<T>>();

    /**
     * Creates a new instance of WeakList.
     */
    public WeakList() {
        super();
    //#WeakList.java:48: method: void com.dmdirc.util.WeakList.com.dmdirc.util.WeakList()
    //#input(void com.dmdirc.util.WeakList()): this
    //#output(void com.dmdirc.util.WeakList()): new ArrayList(WeakList#1) num objects
    //#output(void com.dmdirc.util.WeakList()): this.list
    //#new obj(void com.dmdirc.util.WeakList()): new ArrayList(WeakList#1)
    //#post(void com.dmdirc.util.WeakList()): this.list == &new ArrayList(WeakList#1)
    //#post(void com.dmdirc.util.WeakList()): new ArrayList(WeakList#1) num objects == 1
    }
    //#WeakList.java:49: end of method: void com.dmdirc.util.WeakList.com.dmdirc.util.WeakList()

    /**
     * Removes any entries from the list that have been GC'd.
     */
    private void cleanUp() {
        for (int i = 0; i < list.size(); i++) {
    //#WeakList.java:55: method: void com.dmdirc.util.WeakList.cleanUp()
    //#input(void cleanUp()): this
    //#input(void cleanUp()): this.list
    //#pre[2] (void cleanUp()): this.list != null
    //#presumption(void cleanUp()): java.util.List:get(...)@56 != null
    //#test_vector(void cleanUp()): java.lang.ref.WeakReference:get(...)@56: Inverse{null}, Addr_Set{null}
            if (list.get(i).get() == null) {
                list.remove(i--);
            }
        }
    }
    //#WeakList.java:60: end of method: void com.dmdirc.util.WeakList.cleanUp()

    /**
     * Dereferences the specified list of WeakReferences to get a plain List.
     * 
     * @param list The list to be dereferenced
     * @return A list containing the items referenced by the specified list
     */
    private List<T> dereferenceList(final List<WeakReference<T>> list) {
        final List<T> res = new ArrayList<T>();
    //#WeakList.java:69: method: List com.dmdirc.util.WeakList.dereferenceList(List)
    //#input(List dereferenceList(List)): list
    //#output(List dereferenceList(List)): new ArrayList(dereferenceList#1) num objects
    //#output(List dereferenceList(List)): return_value
    //#new obj(List dereferenceList(List)): new ArrayList(dereferenceList#1)
    //#pre[1] (List dereferenceList(List)): list != null
    //#presumption(List dereferenceList(List)): java.util.Iterator:next(...)@71 != null
    //#post(List dereferenceList(List)): return_value == &new ArrayList(dereferenceList#1)
    //#post(List dereferenceList(List)): new ArrayList(dereferenceList#1) num objects == 1
    //#test_vector(List dereferenceList(List)): java.lang.ref.WeakReference:get(...)@72: Addr_Set{null}, Inverse{null}
    //#test_vector(List dereferenceList(List)): java.util.Iterator:hasNext(...)@71: {0}, {1}

        for (WeakReference<T> item : list) {
            if (item.get() != null) {
                res.add(item.get());
            }
        }

        return res;
    //#WeakList.java:77: end of method: List com.dmdirc.util.WeakList.dereferenceList(List)
    }

    /**
     * Creates a new collection of weak references to elements in the specified
     * collection.
     * 
     * @param c The collection whose elements should be referenced
     * @return A copy of the specified collection, with each item wrapped in
     * a weak reference.
     */
    @SuppressWarnings(value = "unchecked")
    private Collection<WeakReference<T>> referenceCollection(final Collection<?> c) {
        final Collection<WeakReference<T>> res = new ArrayList<WeakReference<T>>();
    //#WeakList.java:90: method: Collection com.dmdirc.util.WeakList.referenceCollection(Collection)
    //#input(Collection referenceCollection(Collection)): c
    //#output(Collection referenceCollection(Collection)): new ArrayList(referenceCollection#1) num objects
    //#output(Collection referenceCollection(Collection)): return_value
    //#new obj(Collection referenceCollection(Collection)): new ArrayList(referenceCollection#1)
    //#pre[1] (Collection referenceCollection(Collection)): c != null
    //#post(Collection referenceCollection(Collection)): return_value == &new ArrayList(referenceCollection#1)
    //#post(Collection referenceCollection(Collection)): new ArrayList(referenceCollection#1) num objects == 1
    //#unanalyzed(Collection referenceCollection(Collection)): Effects-of-calling:java.lang.ref.WeakReference
    //#test_vector(Collection referenceCollection(Collection)): java.util.Iterator:hasNext(...)@92: {0}, {1}

        for (Object item : c) {
            res.add(new EquatableWeakReference(item));
        }

        return res;
    //#WeakList.java:96: end of method: Collection com.dmdirc.util.WeakList.referenceCollection(Collection)
    }

    /** {@inheritDoc} */
    @Override
    public int size() {
        cleanUp();
    //#WeakList.java:102: method: int com.dmdirc.util.WeakList.size()
    //#input(int size()): this
    //#input(int size()): this.list
    //#output(int size()): return_value
    //#pre[2] (int size()): this.list != null
    //#post(int size()): init'ed(return_value)
    //#unanalyzed(int size()): Effects-of-calling:java.util.List:size
    //#unanalyzed(int size()): Effects-of-calling:java.util.List:get
    //#unanalyzed(int size()): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(int size()): Effects-of-calling:java.util.List:remove

        return list.size();
    //#WeakList.java:104: end of method: int com.dmdirc.util.WeakList.size()
    }

    /** {@inheritDoc} */
    @Override
    public boolean isEmpty() {
        cleanUp();
    //#WeakList.java:110: method: bool com.dmdirc.util.WeakList.isEmpty()
    //#input(bool isEmpty()): this
    //#input(bool isEmpty()): this.list
    //#output(bool isEmpty()): return_value
    //#pre[2] (bool isEmpty()): this.list != null
    //#post(bool isEmpty()): init'ed(return_value)
    //#unanalyzed(bool isEmpty()): Effects-of-calling:java.util.List:size
    //#unanalyzed(bool isEmpty()): Effects-of-calling:java.util.List:get
    //#unanalyzed(bool isEmpty()): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(bool isEmpty()): Effects-of-calling:java.util.List:remove

        return list.isEmpty();
    //#WeakList.java:112: end of method: bool com.dmdirc.util.WeakList.isEmpty()
    }

    /** {@inheritDoc} */
    @Override @SuppressWarnings("unchecked")
    public boolean contains(final Object o) {
        return list.contains(new EquatableWeakReference(o));
    //#WeakList.java:118: method: bool com.dmdirc.util.WeakList.contains(Object)
    //#input(bool contains(Object)): o
    //#input(bool contains(Object)): this
    //#input(bool contains(Object)): this.list
    //#output(bool contains(Object)): return_value
    //#pre[3] (bool contains(Object)): this.list != null
    //#post(bool contains(Object)): init'ed(return_value)
    //#unanalyzed(bool contains(Object)): Effects-of-calling:java.lang.ref.WeakReference
    //#WeakList.java:118: end of method: bool com.dmdirc.util.WeakList.contains(Object)
    }

    /** {@inheritDoc} */
    @Override
    public Iterator<T> iterator() {
        return dereferenceList(list).iterator();
    //#WeakList.java:124: method: Iterator com.dmdirc.util.WeakList.iterator()
    //#input(Iterator iterator()): this
    //#input(Iterator iterator()): this.list
    //#output(Iterator iterator()): return_value
    //#pre[2] (Iterator iterator()): this.list != null
    //#post(Iterator iterator()): return_value != null
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(Iterator iterator()): Effects-of-calling:java.util.List:add
    //#WeakList.java:124: end of method: Iterator com.dmdirc.util.WeakList.iterator()
    }

    /** {@inheritDoc} */
    @Override
    public Object[] toArray() {
        return dereferenceList(list).toArray();
    //#WeakList.java:130: method: Object[] com.dmdirc.util.WeakList.toArray()
    //#input(Object[] toArray()): this
    //#input(Object[] toArray()): this.list
    //#output(Object[] toArray()): return_value
    //#pre[2] (Object[] toArray()): this.list != null
    //#post(Object[] toArray()): init'ed(return_value)
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(Object[] toArray()): Effects-of-calling:java.util.List:add
    //#WeakList.java:130: end of method: Object[] com.dmdirc.util.WeakList.toArray()
    }

    /** {@inheritDoc} */
    @Override
    public <T> T[] toArray(final T[] a) {
        return dereferenceList(list).toArray(a);
    //#WeakList.java:136: method: Object[] com.dmdirc.util.WeakList.toArray(Object[])
    //#input(Object[] toArray(Object[])): a
    //#input(Object[] toArray(Object[])): this
    //#input(Object[] toArray(Object[])): this.list
    //#output(Object[] toArray(Object[])): return_value
    //#pre[3] (Object[] toArray(Object[])): this.list != null
    //#post(Object[] toArray(Object[])): init'ed(return_value)
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(Object[] toArray(Object[])): Effects-of-calling:java.util.List:add
    //#WeakList.java:136: end of method: Object[] com.dmdirc.util.WeakList.toArray(Object[])
    }

    /** {@inheritDoc} */
    @Override
    public boolean add(final T e) {
        return list.add(new EquatableWeakReference<T>(e));
    //#WeakList.java:142: method: bool com.dmdirc.util.WeakList.add(Object)
    //#input(bool add(Object)): e
    //#input(bool add(Object)): this
    //#input(bool add(Object)): this.list
    //#output(bool add(Object)): return_value
    //#pre[3] (bool add(Object)): this.list != null
    //#post(bool add(Object)): init'ed(return_value)
    //#unanalyzed(bool add(Object)): Effects-of-calling:java.lang.ref.WeakReference
    //#WeakList.java:142: end of method: bool com.dmdirc.util.WeakList.add(Object)
    }

    /** {@inheritDoc} */
    @Override @SuppressWarnings(value = "unchecked")
    public boolean remove(final Object o) {
        return list.remove(new EquatableWeakReference(o));
    //#WeakList.java:148: method: bool com.dmdirc.util.WeakList.remove(Object)
    //#input(bool remove(Object)): o
    //#input(bool remove(Object)): this
    //#input(bool remove(Object)): this.list
    //#output(bool remove(Object)): return_value
    //#pre[3] (bool remove(Object)): this.list != null
    //#post(bool remove(Object)): init'ed(return_value)
    //#unanalyzed(bool remove(Object)): Effects-of-calling:java.lang.ref.WeakReference
    //#WeakList.java:148: end of method: bool com.dmdirc.util.WeakList.remove(Object)
    }

    /** {@inheritDoc} */
    @Override
    public boolean containsAll(final Collection<?> c) {
        return dereferenceList(list).containsAll(c);
    //#WeakList.java:154: method: bool com.dmdirc.util.WeakList.containsAll(Collection)
    //#input(bool containsAll(Collection)): c
    //#input(bool containsAll(Collection)): this
    //#input(bool containsAll(Collection)): this.list
    //#output(bool containsAll(Collection)): return_value
    //#pre[3] (bool containsAll(Collection)): this.list != null
    //#post(bool containsAll(Collection)): init'ed(return_value)
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool containsAll(Collection)): Effects-of-calling:java.util.List:add
    //#WeakList.java:154: end of method: bool com.dmdirc.util.WeakList.containsAll(Collection)
    }

    /** {@inheritDoc} */
    @Override
    public boolean addAll(final Collection<? extends T> c) {
        return list.addAll(referenceCollection(c));
    //#WeakList.java:160: method: bool com.dmdirc.util.WeakList.addAll(Collection)
    //#input(bool addAll(Collection)): c
    //#input(bool addAll(Collection)): this
    //#input(bool addAll(Collection)): this.list
    //#output(bool addAll(Collection)): return_value
    //#pre[1] (bool addAll(Collection)): c != null
    //#pre[3] (bool addAll(Collection)): this.list != null
    //#post(bool addAll(Collection)): init'ed(return_value)
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.lang.ref.WeakReference
    //#unanalyzed(bool addAll(Collection)): Effects-of-calling:java.util.Collection:add
    //#WeakList.java:160: end of method: bool com.dmdirc.util.WeakList.addAll(Collection)
    }

    /** {@inheritDoc} */
    @Override
    public boolean addAll(final int index, final Collection<? extends T> c) {
        return list.addAll(index, referenceCollection(c));
    //#WeakList.java:166: method: bool com.dmdirc.util.WeakList.addAll(int, Collection)
    //#input(bool addAll(int, Collection)): c
    //#input(bool addAll(int, Collection)): index
    //#input(bool addAll(int, Collection)): this
    //#input(bool addAll(int, Collection)): this.list
    //#output(bool addAll(int, Collection)): return_value
    //#pre[1] (bool addAll(int, Collection)): c != null
    //#pre[4] (bool addAll(int, Collection)): this.list != null
    //#post(bool addAll(int, Collection)): init'ed(return_value)
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.lang.ref.WeakReference
    //#unanalyzed(bool addAll(int, Collection)): Effects-of-calling:java.util.Collection:add
    //#WeakList.java:166: end of method: bool com.dmdirc.util.WeakList.addAll(int, Collection)
    }

    /** {@inheritDoc} */
    @Override
    public boolean removeAll(final Collection<?> c) {
        return list.removeAll(referenceCollection(c));
    //#WeakList.java:172: method: bool com.dmdirc.util.WeakList.removeAll(Collection)
    //#input(bool removeAll(Collection)): c
    //#input(bool removeAll(Collection)): this
    //#input(bool removeAll(Collection)): this.list
    //#output(bool removeAll(Collection)): return_value
    //#pre[1] (bool removeAll(Collection)): c != null
    //#pre[3] (bool removeAll(Collection)): this.list != null
    //#post(bool removeAll(Collection)): init'ed(return_value)
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.lang.ref.WeakReference
    //#unanalyzed(bool removeAll(Collection)): Effects-of-calling:java.util.Collection:add
    //#WeakList.java:172: end of method: bool com.dmdirc.util.WeakList.removeAll(Collection)
    }

    /** {@inheritDoc} */
    @Override
    public boolean retainAll(final Collection<?> c) {
        return list.retainAll(referenceCollection(c));
    //#WeakList.java:178: method: bool com.dmdirc.util.WeakList.retainAll(Collection)
    //#input(bool retainAll(Collection)): c
    //#input(bool retainAll(Collection)): this
    //#input(bool retainAll(Collection)): this.list
    //#output(bool retainAll(Collection)): return_value
    //#pre[1] (bool retainAll(Collection)): c != null
    //#pre[3] (bool retainAll(Collection)): this.list != null
    //#post(bool retainAll(Collection)): init'ed(return_value)
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.util.Collection:iterator
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.lang.ref.WeakReference
    //#unanalyzed(bool retainAll(Collection)): Effects-of-calling:java.util.Collection:add
    //#WeakList.java:178: end of method: bool com.dmdirc.util.WeakList.retainAll(Collection)
    }

    /** {@inheritDoc} */
    @Override
    public void clear() {
        list.clear();
    //#WeakList.java:184: method: void com.dmdirc.util.WeakList.clear()
    //#input(void clear()): this
    //#input(void clear()): this.list
    //#pre[2] (void clear()): this.list != null
    }
    //#WeakList.java:185: end of method: void com.dmdirc.util.WeakList.clear()

    /** {@inheritDoc} */
    @Override
    public T get(final int index) {
        cleanUp();
    //#WeakList.java:190: method: Object com.dmdirc.util.WeakList.get(int)
    //#input(Object get(int)): index
    //#input(Object get(int)): this
    //#input(Object get(int)): this.list
    //#output(Object get(int)): return_value
    //#pre[3] (Object get(int)): this.list != null
    //#presumption(Object get(int)): java.util.List:get(...)@192 != null
    //#post(Object get(int)): init'ed(return_value)
    //#unanalyzed(Object get(int)): Effects-of-calling:java.util.List:size
    //#unanalyzed(Object get(int)): Effects-of-calling:java.util.List:get
    //#unanalyzed(Object get(int)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(Object get(int)): Effects-of-calling:java.util.List:remove

        return list.get(index).get();
    //#WeakList.java:192: end of method: Object com.dmdirc.util.WeakList.get(int)
    }

    /** {@inheritDoc} */
    @Override
    public T set(final int index, final T element) {
        list.set(index, new EquatableWeakReference<T>(element));
    //#WeakList.java:198: method: Object com.dmdirc.util.WeakList.set(int, Object)
    //#input(Object set(int, Object)): element
    //#input(Object set(int, Object)): index
    //#input(Object set(int, Object)): this
    //#input(Object set(int, Object)): this.list
    //#output(Object set(int, Object)): return_value
    //#pre[4] (Object set(int, Object)): this.list != null
    //#post(Object set(int, Object)): return_value == element
    //#post(Object set(int, Object)): init'ed(return_value)
    //#unanalyzed(Object set(int, Object)): Effects-of-calling:java.lang.ref.WeakReference

        return element;
    //#WeakList.java:200: end of method: Object com.dmdirc.util.WeakList.set(int, Object)
    }

    /** {@inheritDoc} */
    @Override
    public void add(final int index, final T element) {
        list.add(index, new EquatableWeakReference<T>(element));
    //#WeakList.java:206: method: void com.dmdirc.util.WeakList.add(int, Object)
    //#input(void add(int, Object)): element
    //#input(void add(int, Object)): index
    //#input(void add(int, Object)): this
    //#input(void add(int, Object)): this.list
    //#pre[4] (void add(int, Object)): this.list != null
    //#unanalyzed(void add(int, Object)): Effects-of-calling:java.lang.ref.WeakReference
    }
    //#WeakList.java:207: end of method: void com.dmdirc.util.WeakList.add(int, Object)

    /** {@inheritDoc} */
    @Override
    public T remove(final int index) {
        return list.remove(index).get();
    //#WeakList.java:212: method: Object com.dmdirc.util.WeakList.remove(int)
    //#input(Object remove(int)): index
    //#input(Object remove(int)): this
    //#input(Object remove(int)): this.list
    //#output(Object remove(int)): return_value
    //#pre[3] (Object remove(int)): this.list != null
    //#presumption(Object remove(int)): java.util.List:remove(...)@212 != null
    //#post(Object remove(int)): init'ed(return_value)
    //#WeakList.java:212: end of method: Object com.dmdirc.util.WeakList.remove(int)
    }

    /** {@inheritDoc} */
    @Override @SuppressWarnings(value = "unchecked")
    public int indexOf(final Object o) {
        cleanUp();
    //#WeakList.java:218: method: int com.dmdirc.util.WeakList.indexOf(Object)
    //#input(int indexOf(Object)): o
    //#input(int indexOf(Object)): this
    //#input(int indexOf(Object)): this.list
    //#output(int indexOf(Object)): return_value
    //#pre[3] (int indexOf(Object)): this.list != null
    //#post(int indexOf(Object)): init'ed(return_value)
    //#unanalyzed(int indexOf(Object)): Effects-of-calling:java.util.List:size
    //#unanalyzed(int indexOf(Object)): Effects-of-calling:java.util.List:get
    //#unanalyzed(int indexOf(Object)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(int indexOf(Object)): Effects-of-calling:java.util.List:remove

        return list.indexOf(o);
    //#WeakList.java:220: end of method: int com.dmdirc.util.WeakList.indexOf(Object)
    }

    /** {@inheritDoc} */
    @Override @SuppressWarnings(value = "unchecked")
    public int lastIndexOf(final Object o) {
        cleanUp();
    //#WeakList.java:226: method: int com.dmdirc.util.WeakList.lastIndexOf(Object)
    //#input(int lastIndexOf(Object)): o
    //#input(int lastIndexOf(Object)): this
    //#input(int lastIndexOf(Object)): this.list
    //#output(int lastIndexOf(Object)): return_value
    //#pre[3] (int lastIndexOf(Object)): this.list != null
    //#post(int lastIndexOf(Object)): init'ed(return_value)
    //#unanalyzed(int lastIndexOf(Object)): Effects-of-calling:java.util.List:size
    //#unanalyzed(int lastIndexOf(Object)): Effects-of-calling:java.util.List:get
    //#unanalyzed(int lastIndexOf(Object)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(int lastIndexOf(Object)): Effects-of-calling:java.util.List:remove

        return list.lastIndexOf(o);
    //#WeakList.java:228: end of method: int com.dmdirc.util.WeakList.lastIndexOf(Object)
    }

    /** {@inheritDoc} */
    @Override
    public ListIterator<T> listIterator() {
        cleanUp();
    //#WeakList.java:234: method: ListIterator com.dmdirc.util.WeakList.listIterator()
    //#input(ListIterator listIterator()): this
    //#input(ListIterator listIterator()): this.list
    //#output(ListIterator listIterator()): return_value
    //#pre[2] (ListIterator listIterator()): this.list != null
    //#post(ListIterator listIterator()): return_value != null
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.List:size
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.List:get
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.List:remove
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(ListIterator listIterator()): Effects-of-calling:java.util.List:add

        return dereferenceList(list).listIterator();
    //#WeakList.java:236: end of method: ListIterator com.dmdirc.util.WeakList.listIterator()
    }

    /** {@inheritDoc} */
    @Override
    public ListIterator<T> listIterator(final int index) {
        cleanUp();
    //#WeakList.java:242: method: ListIterator com.dmdirc.util.WeakList.listIterator(int)
    //#input(ListIterator listIterator(int)): index
    //#input(ListIterator listIterator(int)): this
    //#input(ListIterator listIterator(int)): this.list
    //#output(ListIterator listIterator(int)): return_value
    //#pre[3] (ListIterator listIterator(int)): this.list != null
    //#post(ListIterator listIterator(int)): return_value != null
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.List:size
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.List:get
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.List:remove
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(ListIterator listIterator(int)): Effects-of-calling:java.util.List:add

        return dereferenceList(list).listIterator(index);
    //#WeakList.java:244: end of method: ListIterator com.dmdirc.util.WeakList.listIterator(int)
    }

    /** {@inheritDoc} */
    @Override
    public List<T> subList(final int fromIndex, final int toIndex) {
        return dereferenceList(list.subList(fromIndex, toIndex));
    //#WeakList.java:250: method: List com.dmdirc.util.WeakList.subList(int, int)
    //#input(List subList(int, int)): fromIndex
    //#input(List subList(int, int)): this
    //#input(List subList(int, int)): this.list
    //#input(List subList(int, int)): toIndex
    //#output(List subList(int, int)): new ArrayList(dereferenceList#1) num objects
    //#output(List subList(int, int)): return_value
    //#new obj(List subList(int, int)): new ArrayList(dereferenceList#1)
    //#pre[3] (List subList(int, int)): this.list != null
    //#presumption(List subList(int, int)): java.util.List:subList(...)@250 != null
    //#post(List subList(int, int)): return_value == &new ArrayList(dereferenceList#1)
    //#post(List subList(int, int)): new ArrayList(dereferenceList#1) num objects == 1
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.lang.ref.WeakReference:get
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(List subList(int, int)): Effects-of-calling:java.util.List:add
    //#WeakList.java:250: end of method: List com.dmdirc.util.WeakList.subList(int, int)
    }
}    //#output(com.dmdirc.util.WeakList__static_init): __Descendant_Table[com/dmdirc/util/WeakList]
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.add(ILjava/lang/Object;)V
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.add(Ljava/lang/Object;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.addAll(ILjava/util/Collection;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.addAll(Ljava/util/Collection;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.cleanUp()V
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.clear()V
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.contains(Ljava/lang/Object;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.containsAll(Ljava/util/Collection;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.dereferenceList(Ljava/util/List;)Ljava/util/List;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.get(I)Ljava/lang/Object;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.indexOf(Ljava/lang/Object;)I
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.isEmpty()Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.iterator()Ljava/util/Iterator;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.lastIndexOf(Ljava/lang/Object;)I
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.listIterator()Ljava/util/ListIterator;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.listIterator(I)Ljava/util/ListIterator;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.referenceCollection(Ljava/util/Collection;)Ljava/util/Collection;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.remove(I)Ljava/lang/Object;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.remove(Ljava/lang/Object;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.removeAll(Ljava/util/Collection;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.retainAll(Ljava/util/Collection;)Z
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.set(ILjava/lang/Object;)Ljava/lang/Object;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.size()I
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.subList(II)Ljava/util/List;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.toArray()[Ljava/lang/Object;
    //#output(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.toArray([Ljava/lang/Object;)[Ljava/lang/Object;
    //#post(com.dmdirc.util.WeakList__static_init): __Descendant_Table[com/dmdirc/util/WeakList] == &__Dispatch_Table
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.add(ILjava/lang/Object;)V == &add
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.add(Ljava/lang/Object;)Z == &add
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.addAll(ILjava/util/Collection;)Z == &addAll
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.addAll(Ljava/util/Collection;)Z == &addAll
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.cleanUp()V == &cleanUp
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.clear()V == &clear
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.contains(Ljava/lang/Object;)Z == &contains
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.containsAll(Ljava/util/Collection;)Z == &containsAll
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.dereferenceList(Ljava/util/List;)Ljava/util/List; == &dereferenceList
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.get(I)Ljava/lang/Object; == &get
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.indexOf(Ljava/lang/Object;)I == &indexOf
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.isEmpty()Z == &isEmpty
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.iterator()Ljava/util/Iterator; == &iterator
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.lastIndexOf(Ljava/lang/Object;)I == &lastIndexOf
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.listIterator()Ljava/util/ListIterator; == &listIterator
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.listIterator(I)Ljava/util/ListIterator; == &listIterator
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.referenceCollection(Ljava/util/Collection;)Ljava/util/Collection; == &referenceCollection
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.remove(I)Ljava/lang/Object; == &remove
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.remove(Ljava/lang/Object;)Z == &remove
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.removeAll(Ljava/util/Collection;)Z == &removeAll
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.retainAll(Ljava/util/Collection;)Z == &retainAll
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.set(ILjava/lang/Object;)Ljava/lang/Object; == &set
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.size()I == &size
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.subList(II)Ljava/util/List; == &subList
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.toArray()[Ljava/lang/Object; == &toArray
    //#post(com.dmdirc.util.WeakList__static_init): __Dispatch_Table.toArray([Ljava/lang/Object;)[Ljava/lang/Object; == &toArray
    //#WeakList.java:: end of method: com.dmdirc.util.WeakList.com.dmdirc.util.WeakList__static_init
    //#WeakList.java:: end of class: com.dmdirc.util.WeakList
