diff options
Diffstat (limited to 'libjava/classpath/external/jsr166/java')
26 files changed, 406 insertions, 406 deletions
diff --git a/libjava/classpath/external/jsr166/java/util/ArrayDeque.java b/libjava/classpath/external/jsr166/java/util/ArrayDeque.java index c0ee16e..a4bc75c 100644 --- a/libjava/classpath/external/jsr166/java/util/ArrayDeque.java +++ b/libjava/classpath/external/jsr166/java/util/ArrayDeque.java @@ -479,11 +479,11 @@ public class ArrayDeque<E> extends AbstractCollection<E> } private void checkInvariants() { - assert elements[tail] == null; - assert head == tail ? elements[head] == null : - (elements[head] != null && - elements[(tail - 1) & (elements.length - 1)] != null); - assert elements[(head - 1) & (elements.length - 1)] == null; + assert elements[tail] == null; + assert head == tail ? elements[head] == null : + (elements[head] != null && + elements[(tail - 1) & (elements.length - 1)] != null); + assert elements[(head - 1) & (elements.length - 1)] == null; } /** @@ -497,42 +497,42 @@ public class ArrayDeque<E> extends AbstractCollection<E> * @return true if elements moved backwards */ private boolean delete(int i) { - checkInvariants(); - final E[] elements = this.elements; - final int mask = elements.length - 1; - final int h = head; - final int t = tail; - final int front = (i - h) & mask; - final int back = (t - i) & mask; - - // Invariant: head <= i < tail mod circularity - if (front >= ((t - h) & mask)) - throw new ConcurrentModificationException(); - - // Optimize for least element motion - if (front < back) { - if (h <= i) { - System.arraycopy(elements, h, elements, h + 1, front); - } else { // Wrap around - System.arraycopy(elements, 0, elements, 1, i); - elements[0] = elements[mask]; - System.arraycopy(elements, h, elements, h + 1, mask - h); - } - elements[h] = null; - head = (h + 1) & mask; - return false; - } else { - if (i < t) { // Copy the null tail as well - System.arraycopy(elements, i + 1, elements, i, back); - tail = t - 1; - } else { // Wrap around - System.arraycopy(elements, i + 1, elements, i, mask - i); - elements[mask] = elements[0]; - System.arraycopy(elements, 1, elements, 0, t); - tail = (t - 1) & mask; - } - return true; - } + checkInvariants(); + final E[] elements = this.elements; + final int mask = elements.length - 1; + final int h = head; + final int t = tail; + final int front = (i - h) & mask; + final int back = (t - i) & mask; + + // Invariant: head <= i < tail mod circularity + if (front >= ((t - h) & mask)) + throw new ConcurrentModificationException(); + + // Optimize for least element motion + if (front < back) { + if (h <= i) { + System.arraycopy(elements, h, elements, h + 1, front); + } else { // Wrap around + System.arraycopy(elements, 0, elements, 1, i); + elements[0] = elements[mask]; + System.arraycopy(elements, h, elements, h + 1, mask - h); + } + elements[h] = null; + head = (h + 1) & mask; + return false; + } else { + if (i < t) { // Copy the null tail as well + System.arraycopy(elements, i + 1, elements, i, back); + tail = t - 1; + } else { // Wrap around + System.arraycopy(elements, i + 1, elements, i, mask - i); + elements[mask] = elements[0]; + System.arraycopy(elements, 1, elements, 0, t); + tail = (t - 1) & mask; + } + return true; + } } // *** Collection Methods *** @@ -611,8 +611,8 @@ public class ArrayDeque<E> extends AbstractCollection<E> throw new IllegalStateException(); if (delete(lastRet)) { // if left-shifted, undo increment in next() cursor = (cursor - 1) & (elements.length - 1); - fence = tail; - } + fence = tail; + } lastRet = -1; } } @@ -635,7 +635,7 @@ public class ArrayDeque<E> extends AbstractCollection<E> if (cursor == fence) throw new NoSuchElementException(); cursor = (cursor - 1) & (elements.length - 1); - E result = elements[cursor]; + E result = elements[cursor]; if (head != fence || result == null) throw new ConcurrentModificationException(); lastRet = cursor; @@ -647,8 +647,8 @@ public class ArrayDeque<E> extends AbstractCollection<E> throw new IllegalStateException(); if (!delete(lastRet)) { cursor = (cursor + 1) & (elements.length - 1); - fence = head; - } + fence = head; + } lastRet = -1; } } @@ -724,7 +724,7 @@ public class ArrayDeque<E> extends AbstractCollection<E> * @return an array containing all of the elements in this deque */ public Object[] toArray() { - return copyElements(new Object[size()]); + return copyElements(new Object[size()]); } /** @@ -769,7 +769,7 @@ public class ArrayDeque<E> extends AbstractCollection<E> if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), size); - copyElements(a); + copyElements(a); if (a.length > size) a[size] = null; return a; diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ArrayBlockingQueue.java b/libjava/classpath/external/jsr166/java/util/concurrent/ArrayBlockingQueue.java index bdf34d2..3ce9ed8 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ArrayBlockingQueue.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ArrayBlockingQueue.java @@ -205,7 +205,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> * @throws NullPointerException if the specified element is null */ public boolean add(E e) { - return super.add(e); + return super.add(e); } /** @@ -271,7 +271,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> throws InterruptedException { if (e == null) throw new NullPointerException(); - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { @@ -326,7 +326,7 @@ public class ArrayBlockingQueue<E> extends AbstractQueue<E> } public E poll(long timeout, TimeUnit unit) throws InterruptedException { - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentHashMap.java b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentHashMap.java index 7f6d449..9ad9ab2 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentHashMap.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentHashMap.java @@ -196,10 +196,10 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> this.value = value; } - @SuppressWarnings("unchecked") - static final <K,V> HashEntry<K,V>[] newArray(int i) { - return new HashEntry[i]; - } + @SuppressWarnings("unchecked") + static final <K,V> HashEntry<K,V>[] newArray(int i) { + return new HashEntry[i]; + } } /** @@ -287,9 +287,9 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> setTable(HashEntry.<K,V>newArray(initialCapacity)); } - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") static final <K,V> Segment<K,V>[] newArray(int i) { - return new Segment[i]; + return new Segment[i]; } /** @@ -775,7 +775,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> * @throws NullPointerException if the specified key is null */ public boolean containsKey(Object key) { - int hash = hash(key.hashCode()); + int hash = hash(key.hashCode()); return segmentFor(hash).containsKey(key, hash); } @@ -915,7 +915,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> * @throws NullPointerException if the specified key is null */ public V remove(Object key) { - int hash = hash(key.hashCode()); + int hash = hash(key.hashCode()); return segmentFor(hash).remove(key, hash, null); } @@ -1107,16 +1107,16 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> } final class KeyIterator - extends HashIterator - implements Iterator<K>, Enumeration<K> + extends HashIterator + implements Iterator<K>, Enumeration<K> { public K next() { return super.nextEntry().key; } public K nextElement() { return super.nextEntry().key; } } final class ValueIterator - extends HashIterator - implements Iterator<V>, Enumeration<V> + extends HashIterator + implements Iterator<V>, Enumeration<V> { public V next() { return super.nextEntry().value; } public V nextElement() { return super.nextEntry().value; } @@ -1127,7 +1127,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> * setValue changes to the underlying map. */ final class WriteThroughEntry - extends AbstractMap.SimpleEntry<K,V> + extends AbstractMap.SimpleEntry<K,V> { WriteThroughEntry(K k, V v) { super(k,v); @@ -1142,7 +1142,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> * removed in which case the put will re-establish). We do not * and cannot guarantee more. */ - public V setValue(V value) { + public V setValue(V value) { if (value == null) throw new NullPointerException(); V v = super.setValue(value); ConcurrentHashMap.this.put(getKey(), value); @@ -1151,8 +1151,8 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> } final class EntryIterator - extends HashIterator - implements Iterator<Entry<K,V>> + extends HashIterator + implements Iterator<Entry<K,V>> { public Map.Entry<K,V> next() { HashEntry<K,V> e = super.nextEntry(); diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListMap.java b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListMap.java index bbb00a0..1ad9244 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListMap.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListMap.java @@ -1175,7 +1175,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> findFirst(); // retry clearIndexToFirst(); return new AbstractMap.SimpleImmutableEntry<K,V>(n.key, (V)v); - } + } } /** @@ -1852,19 +1852,19 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> * @return <tt>true</tt> if the specified object is equal to this map */ public boolean equals(Object o) { - if (o == this) - return true; - if (!(o instanceof Map)) - return false; - Map<?,?> m = (Map<?,?>) o; + if (o == this) + return true; + if (!(o instanceof Map)) + return false; + Map<?,?> m = (Map<?,?>) o; try { - for (Map.Entry<K,V> e : this.entrySet()) - if (! e.getValue().equals(m.get(e.getKey()))) + for (Map.Entry<K,V> e : this.entrySet()) + if (! e.getValue().equals(m.get(e.getKey()))) return false; - for (Map.Entry<?,?> e : m.entrySet()) { + for (Map.Entry<?,?> e : m.entrySet()) { Object k = e.getKey(); Object v = e.getValue(); - if (k == null || v == null || !v.equals(get(k))) + if (k == null || v == null || !v.equals(get(k))) return false; } return true; @@ -2208,20 +2208,20 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> Node<K,V> lastReturned; /** the next node to return from next(); */ Node<K,V> next; - /** Cache of next value field to maintain weak consistency */ - V nextValue; + /** Cache of next value field to maintain weak consistency */ + V nextValue; /** Initializes ascending iterator for entire range. */ Iter() { for (;;) { - next = findFirst(); + next = findFirst(); if (next == null) break; Object x = next.value; if (x != null && x != next) { - nextValue = (V) x; + nextValue = (V) x; break; - } + } } } @@ -2234,14 +2234,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> if ((lastReturned = next) == null) throw new NoSuchElementException(); for (;;) { - next = next.next; + next = next.next; if (next == null) break; Object x = next.value; if (x != null && x != next) { - nextValue = (V) x; + nextValue = (V) x; break; - } + } } } @@ -2252,7 +2252,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> // It would not be worth all of the overhead to directly // unlink from here. Using remove is fast enough. ConcurrentSkipListMap.this.remove(l.key); - lastReturned = null; + lastReturned = null; } } @@ -2305,11 +2305,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> */ static final <E> List<E> toList(Collection<E> c) { - // Using size() here would be a pessimization. - List<E> list = new ArrayList<E>(); - for (E e : c) - list.add(e); - return list; + // Using size() here would be a pessimization. + List<E> list = new ArrayList<E>(); + for (E e : c) + list.add(e); + return list; } static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> { @@ -2355,8 +2355,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> return false; } } - public Object[] toArray() { return toList(this).toArray(); } - public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } + public Object[] toArray() { return toList(this).toArray(); } + public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } public Iterator<E> descendingIterator() { return descendingSet().iterator(); } @@ -2411,8 +2411,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> public void clear() { m.clear(); } - public Object[] toArray() { return toList(this).toArray(); } - public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } + public Object[] toArray() { return toList(this).toArray(); } + public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } } static final class EntrySet<K1,V1> extends AbstractSet<Map.Entry<K1,V1>> { @@ -2465,8 +2465,8 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> return false; } } - public Object[] toArray() { return toList(this).toArray(); } - public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } + public Object[] toArray() { return toList(this).toArray(); } + public <T> T[] toArray(T[] a) { return toList(this).toArray(a); } } /** @@ -2820,10 +2820,10 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> public Comparator<? super K> comparator() { Comparator<? super K> cmp = m.comparator(); - if (isDescending) - return Collections.reverseOrder(cmp); - else - return cmp; + if (isDescending) + return Collections.reverseOrder(cmp); + else + return cmp; } /** @@ -3020,12 +3020,12 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> next = isDescending ? hiNode() : loNode(); if (next == null) break; - Object x = next.value; + Object x = next.value; if (x != null && x != next) { - if (! inBounds(next.key)) + if (! inBounds(next.key)) next = null; - else - nextValue = (V) x; + else + nextValue = (V) x; break; } } @@ -3049,12 +3049,12 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> next = next.next; if (next == null) break; - Object x = next.value; + Object x = next.value; if (x != null && x != next) { if (tooHigh(next.key)) next = null; else - nextValue = (V) x; + nextValue = (V) x; break; } } @@ -3065,11 +3065,11 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> next = m.findNear(lastReturned.key, LT); if (next == null) break; - Object x = next.value; + Object x = next.value; if (x != null && x != next) { if (tooLow(next.key)) next = null; - else + else nextValue = (V) x; break; } @@ -3081,7 +3081,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> if (l == null) throw new IllegalStateException(); m.remove(l.key); - lastReturned = null; + lastReturned = null; } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListSet.java b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListSet.java index 7da50d5..7fd1c76 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListSet.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ConcurrentSkipListSet.java @@ -128,12 +128,12 @@ public class ConcurrentSkipListSet<E> */ public ConcurrentSkipListSet<E> clone() { ConcurrentSkipListSet<E> clone = null; - try { - clone = (ConcurrentSkipListSet<E>) super.clone(); + try { + clone = (ConcurrentSkipListSet<E>) super.clone(); clone.setMap(new ConcurrentSkipListMap(m)); - } catch (CloneNotSupportedException e) { - throw new InternalError(); - } + } catch (CloneNotSupportedException e) { + throw new InternalError(); + } return clone; } @@ -157,7 +157,7 @@ public class ConcurrentSkipListSet<E> * @return the number of elements in this set */ public int size() { - return m.size(); + return m.size(); } /** @@ -165,7 +165,7 @@ public class ConcurrentSkipListSet<E> * @return <tt>true</tt> if this set contains no elements */ public boolean isEmpty() { - return m.isEmpty(); + return m.isEmpty(); } /** @@ -180,7 +180,7 @@ public class ConcurrentSkipListSet<E> * @throws NullPointerException if the specified element is null */ public boolean contains(Object o) { - return m.containsKey(o); + return m.containsKey(o); } /** @@ -198,7 +198,7 @@ public class ConcurrentSkipListSet<E> * @throws NullPointerException if the specified element is null */ public boolean add(E e) { - return m.putIfAbsent(e, Boolean.TRUE) == null; + return m.putIfAbsent(e, Boolean.TRUE) == null; } /** @@ -216,14 +216,14 @@ public class ConcurrentSkipListSet<E> * @throws NullPointerException if the specified element is null */ public boolean remove(Object o) { - return m.remove(o, Boolean.TRUE); + return m.remove(o, Boolean.TRUE); } /** * Removes all of the elements from this set. */ public void clear() { - m.clear(); + m.clear(); } /** @@ -241,7 +241,7 @@ public class ConcurrentSkipListSet<E> * @return an iterator over the elements in this set in descending order */ public Iterator<E> descendingIterator() { - return m.descendingKeySet().iterator(); + return m.descendingKeySet().iterator(); } @@ -261,11 +261,11 @@ public class ConcurrentSkipListSet<E> */ public boolean equals(Object o) { // Override AbstractSet version to avoid calling size() - if (o == this) - return true; - if (!(o instanceof Set)) - return false; - Collection<?> c = (Collection<?>) o; + if (o == this) + return true; + if (!(o instanceof Set)) + return false; + Collection<?> c = (Collection<?>) o; try { return containsAll(c) && c.containsAll(this); } catch (ClassCastException unused) { @@ -373,7 +373,7 @@ public class ConcurrentSkipListSet<E> boolean fromInclusive, E toElement, boolean toInclusive) { - return new ConcurrentSkipListSet<E> + return new ConcurrentSkipListSet<E> (m.subMap(fromElement, fromInclusive, toElement, toInclusive)); } @@ -384,7 +384,7 @@ public class ConcurrentSkipListSet<E> * @throws IllegalArgumentException {@inheritDoc} */ public NavigableSet<E> headSet(E toElement, boolean inclusive) { - return new ConcurrentSkipListSet<E>(m.headMap(toElement, inclusive)); + return new ConcurrentSkipListSet<E>(m.headMap(toElement, inclusive)); } /** @@ -393,7 +393,7 @@ public class ConcurrentSkipListSet<E> * @throws IllegalArgumentException {@inheritDoc} */ public NavigableSet<E> tailSet(E fromElement, boolean inclusive) { - return new ConcurrentSkipListSet<E>(m.tailMap(fromElement, inclusive)); + return new ConcurrentSkipListSet<E>(m.tailMap(fromElement, inclusive)); } /** @@ -403,7 +403,7 @@ public class ConcurrentSkipListSet<E> * @throws IllegalArgumentException {@inheritDoc} */ public NavigableSet<E> subSet(E fromElement, E toElement) { - return subSet(fromElement, true, toElement, false); + return subSet(fromElement, true, toElement, false); } /** @@ -412,7 +412,7 @@ public class ConcurrentSkipListSet<E> * @throws IllegalArgumentException {@inheritDoc} */ public NavigableSet<E> headSet(E toElement) { - return headSet(toElement, false); + return headSet(toElement, false); } /** @@ -421,7 +421,7 @@ public class ConcurrentSkipListSet<E> * @throws IllegalArgumentException {@inheritDoc} */ public NavigableSet<E> tailSet(E fromElement) { - return tailSet(fromElement, true); + return tailSet(fromElement, true); } /** @@ -437,7 +437,7 @@ public class ConcurrentSkipListSet<E> * @return a reverse order view of this set */ public NavigableSet<E> descendingSet() { - return new ConcurrentSkipListSet(m.descendingMap()); + return new ConcurrentSkipListSet(m.descendingMap()); } // Support for resetting map in clone diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/CopyOnWriteArraySet.java b/libjava/classpath/external/jsr166/java/util/concurrent/CopyOnWriteArraySet.java index 39c0e58..063636b 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/CopyOnWriteArraySet.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/CopyOnWriteArraySet.java @@ -89,7 +89,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return the number of elements in this set */ public int size() { - return al.size(); + return al.size(); } /** @@ -98,7 +98,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return <tt>true</tt> if this set contains no elements */ public boolean isEmpty() { - return al.isEmpty(); + return al.isEmpty(); } /** @@ -111,7 +111,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return <tt>true</tt> if this set contains the specified element */ public boolean contains(Object o) { - return al.contains(o); + return al.contains(o); } /** @@ -131,7 +131,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return an array containing all the elements in this set */ public Object[] toArray() { - return al.toArray(); + return al.toArray(); } /** @@ -177,7 +177,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @throws NullPointerException if the specified array is null */ public <T> T[] toArray(T[] a) { - return al.toArray(a); + return al.toArray(a); } /** @@ -201,7 +201,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return <tt>true</tt> if this set contained the specified element */ public boolean remove(Object o) { - return al.remove(o); + return al.remove(o); } /** @@ -217,7 +217,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * element */ public boolean add(E e) { - return al.addIfAbsent(e); + return al.addIfAbsent(e); } /** @@ -227,12 +227,12 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * * @param c collection to be checked for containment in this set * @return <tt>true</tt> if this set contains all of the elements of the - * specified collection + * specified collection * @throws NullPointerException if the specified collection is null * @see #contains(Object) */ public boolean containsAll(Collection<?> c) { - return al.containsAll(c); + return al.containsAll(c); } /** @@ -249,7 +249,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @see #add(Object) */ public boolean addAll(Collection<? extends E> c) { - return al.addAllAbsent(c) > 0; + return al.addAllAbsent(c) > 0; } /** @@ -268,7 +268,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @see #remove(Object) */ public boolean removeAll(Collection<?> c) { - return al.removeAll(c); + return al.removeAll(c); } /** @@ -289,7 +289,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @see #remove(Object) */ public boolean retainAll(Collection<?> c) { - return al.retainAll(c); + return al.retainAll(c); } /** @@ -304,7 +304,7 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> * @return an iterator over the elements in this set */ public Iterator<E> iterator() { - return al.iterator(); + return al.iterator(); } /** @@ -329,14 +329,14 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> if (!(o instanceof Set)) return false; Set<?> set = (Set<?>)(o); - Iterator<?> it = set.iterator(); + Iterator<?> it = set.iterator(); // Uses O(n^2) algorithm that is only appropriate // for small sets, which CopyOnWriteArraySets should be. // Use a single snapshot of underlying array - Object[] elements = al.getArray(); - int len = elements.length; + Object[] elements = al.getArray(); + int len = elements.length; // Mark matched elements to avoid re-checking boolean[] matched = new boolean[len]; int k = 0; @@ -347,10 +347,10 @@ public class CopyOnWriteArraySet<E> extends AbstractSet<E> for (int i = 0; i < len; ++i) { if (!matched[i] && eq(x, elements[i])) { matched[i] = true; - continue outer; + continue outer; } } - return false; + return false; } return k == len; } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/CyclicBarrier.java b/libjava/classpath/external/jsr166/java/util/concurrent/CyclicBarrier.java index e725775..d5738c5 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/CyclicBarrier.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/CyclicBarrier.java @@ -152,7 +152,7 @@ public class CyclicBarrier { */ private void breakBarrier() { generation.broken = true; - count = parties; + count = parties; trip.signalAll(); } @@ -179,7 +179,7 @@ public class CyclicBarrier { if (index == 0) { // tripped boolean ranAction = false; try { - final Runnable command = barrierCommand; + final Runnable command = barrierCommand; if (command != null) command.run(); ranAction = true; @@ -201,13 +201,13 @@ public class CyclicBarrier { } catch (InterruptedException ie) { if (g == generation && ! g.broken) { breakBarrier(); - throw ie; - } else { - // We're about to finish waiting even if we had not - // been interrupted, so this interrupt is deemed to - // "belong" to subsequent execution. - Thread.currentThread().interrupt(); - } + throw ie; + } else { + // We're about to finish waiting even if we had not + // been interrupted, so this interrupt is deemed to + // "belong" to subsequent execution. + Thread.currentThread().interrupt(); + } } if (g.broken) diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/DelayQueue.java b/libjava/classpath/external/jsr166/java/util/concurrent/DelayQueue.java index 8b83987..4ce7bc6 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/DelayQueue.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/DelayQueue.java @@ -444,8 +444,8 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E> */ private class Itr implements Iterator<E> { final Object[] array; // Array of all elements - int cursor; // index of next element to return; - int lastRet; // index of last element, or -1 if no such + int cursor; // index of next element to return; + int lastRet; // index of last element, or -1 if no such Itr(Object[] array) { lastRet = -1; @@ -465,7 +465,7 @@ public class DelayQueue<E extends Delayed> extends AbstractQueue<E> public void remove() { if (lastRet < 0) - throw new IllegalStateException(); + throw new IllegalStateException(); Object x = array[lastRet]; lastRet = -1; // Traverse underlying queue to find == element, diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/Executors.java b/libjava/classpath/external/jsr166/java/util/concurrent/Executors.java index f44e661..18e6b33 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/Executors.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/Executors.java @@ -362,7 +362,7 @@ public class Executors { if (action == null) throw new NullPointerException(); return new Callable<Object>() { - public Object call() { return action.run(); }}; + public Object call() { return action.run(); }}; } /** @@ -376,8 +376,8 @@ public class Executors { public static Callable<Object> callable(final PrivilegedExceptionAction<?> action) { if (action == null) throw new NullPointerException(); - return new Callable<Object>() { - public Object call() throws Exception { return action.run(); }}; + return new Callable<Object>() { + public Object call() throws Exception { return action.run(); }}; } /** @@ -625,13 +625,13 @@ public class Executors { } static class FinalizableDelegatedExecutorService - extends DelegatedExecutorService { - FinalizableDelegatedExecutorService(ExecutorService executor) { - super(executor); - } - protected void finalize() { - super.shutdown(); - } + extends DelegatedExecutorService { + FinalizableDelegatedExecutorService(ExecutorService executor) { + super(executor); + } + protected void finalize() { + super.shutdown(); + } } /** diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/FutureTask.java b/libjava/classpath/external/jsr166/java/util/concurrent/FutureTask.java index bbe49d7..9474240 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/FutureTask.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/FutureTask.java @@ -233,59 +233,59 @@ public class FutureTask<V> implements RunnableFuture<V> { } void innerSet(V v) { - for (;;) { - int s = getState(); - if (s == RAN) - return; + for (;;) { + int s = getState(); + if (s == RAN) + return; if (s == CANCELLED) { - // aggressively release to set runner to null, - // in case we are racing with a cancel request - // that will try to interrupt runner + // aggressively release to set runner to null, + // in case we are racing with a cancel request + // that will try to interrupt runner releaseShared(0); return; } - if (compareAndSetState(s, RAN)) { + if (compareAndSetState(s, RAN)) { result = v; releaseShared(0); done(); - return; + return; } } } void innerSetException(Throwable t) { - for (;;) { - int s = getState(); - if (s == RAN) - return; + for (;;) { + int s = getState(); + if (s == RAN) + return; if (s == CANCELLED) { - // aggressively release to set runner to null, - // in case we are racing with a cancel request - // that will try to interrupt runner + // aggressively release to set runner to null, + // in case we are racing with a cancel request + // that will try to interrupt runner releaseShared(0); return; } - if (compareAndSetState(s, RAN)) { + if (compareAndSetState(s, RAN)) { exception = t; result = null; releaseShared(0); done(); - return; + return; } - } + } } boolean innerCancel(boolean mayInterruptIfRunning) { - for (;;) { - int s = getState(); - if (ranOrCancelled(s)) - return false; - if (compareAndSetState(s, CANCELLED)) - break; - } + for (;;) { + int s = getState(); + if (ranOrCancelled(s)) + return false; + if (compareAndSetState(s, CANCELLED)) + break; + } if (mayInterruptIfRunning) { Thread r = runner; - if (r != null) + if (r != null) r.interrupt(); } releaseShared(0); diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingDeque.java b/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingDeque.java index 91acccf..2dc8fa8 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingDeque.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingDeque.java @@ -57,7 +57,7 @@ public class LinkedBlockingDeque<E> /** Doubly-linked list node class */ static final class Node<E> { - E item; + E item; Node<E> prev; Node<E> next; Node(E x, Node<E> p, Node<E> n) { @@ -299,7 +299,7 @@ public class LinkedBlockingDeque<E> public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) throw new NullPointerException(); - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); lock.lockInterruptibly(); try { for (;;) { @@ -321,7 +321,7 @@ public class LinkedBlockingDeque<E> public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) throw new NullPointerException(); - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); lock.lockInterruptibly(); try { for (;;) { @@ -398,7 +398,7 @@ public class LinkedBlockingDeque<E> public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException { - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); lock.lockInterruptibly(); try { for (;;) { @@ -416,7 +416,7 @@ public class LinkedBlockingDeque<E> public E pollLast(long timeout, TimeUnit unit) throws InterruptedException { - long nanos = unit.toNanos(timeout); + long nanos = unit.toNanos(timeout); lock.lockInterruptibly(); try { for (;;) { @@ -514,15 +514,15 @@ public class LinkedBlockingDeque<E> * @throws NullPointerException if the specified element is null */ public boolean add(E e) { - addLast(e); - return true; + addLast(e); + return true; } /** * @throws NullPointerException if the specified element is null */ public boolean offer(E e) { - return offerLast(e); + return offerLast(e); } /** @@ -530,7 +530,7 @@ public class LinkedBlockingDeque<E> * @throws InterruptedException {@inheritDoc} */ public void put(E e) throws InterruptedException { - putLast(e); + putLast(e); } /** @@ -539,7 +539,7 @@ public class LinkedBlockingDeque<E> */ public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { - return offerLast(e, timeout, unit); + return offerLast(e, timeout, unit); } /** @@ -553,19 +553,19 @@ public class LinkedBlockingDeque<E> * @throws NoSuchElementException if this deque is empty */ public E remove() { - return removeFirst(); + return removeFirst(); } public E poll() { - return pollFirst(); + return pollFirst(); } public E take() throws InterruptedException { - return takeFirst(); + return takeFirst(); } public E poll(long timeout, TimeUnit unit) throws InterruptedException { - return pollFirst(timeout, unit); + return pollFirst(timeout, unit); } /** @@ -579,11 +579,11 @@ public class LinkedBlockingDeque<E> * @throws NoSuchElementException if this deque is empty */ public E element() { - return getFirst(); + return getFirst(); } public E peek() { - return peekFirst(); + return peekFirst(); } /** @@ -668,14 +668,14 @@ public class LinkedBlockingDeque<E> * @throws NullPointerException {@inheritDoc} */ public void push(E e) { - addFirst(e); + addFirst(e); } /** * @throws NoSuchElementException {@inheritDoc} */ public E pop() { - return removeFirst(); + return removeFirst(); } // Collection methods @@ -695,7 +695,7 @@ public class LinkedBlockingDeque<E> * @return <tt>true</tt> if this deque changed as a result of the call */ public boolean remove(Object o) { - return removeFirstOccurrence(o); + return removeFirstOccurrence(o); } /** diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingQueue.java b/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingQueue.java index 3dedee5..6201809 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingQueue.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/LinkedBlockingQueue.java @@ -584,8 +584,8 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E> fullyLock(); try { head.next = null; - assert head.item == null; - last = head; + assert head.item == null; + last = head; if (count.getAndSet(0) == capacity) notFull.signalAll(); } finally { @@ -609,8 +609,8 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E> try { first = head.next; head.next = null; - assert head.item == null; - last = head; + assert head.item == null; + last = head; if (count.getAndSet(0) == capacity) notFull.signalAll(); } finally { @@ -649,9 +649,9 @@ public class LinkedBlockingQueue<E> extends AbstractQueue<E> } if (n != 0) { head.next = p; - assert head.item == null; - if (p == null) - last = head; + assert head.item == null; + if (p == null) + last = head; if (count.getAndAdd(-n) == capacity) notFull.signalAll(); } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/PriorityBlockingQueue.java b/libjava/classpath/external/jsr166/java/util/concurrent/PriorityBlockingQueue.java index 91ae61b..9466aa4 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/PriorityBlockingQueue.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/PriorityBlockingQueue.java @@ -503,8 +503,8 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E> */ private class Itr implements Iterator<E> { final Object[] array; // Array of all elements - int cursor; // index of next element to return; - int lastRet; // index of last element, or -1 if no such + int cursor; // index of next element to return; + int lastRet; // index of last element, or -1 if no such Itr(Object[] array) { lastRet = -1; @@ -524,7 +524,7 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E> public void remove() { if (lastRet < 0) - throw new IllegalStateException(); + throw new IllegalStateException(); Object x = array[lastRet]; lastRet = -1; // Traverse underlying queue to find == element, diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledExecutorService.java b/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledExecutorService.java index 976537e..c170c4a 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledExecutorService.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledExecutorService.java @@ -82,7 +82,7 @@ public interface ScheduledExecutorService extends ExecutorService { * @throws NullPointerException if command is null */ public ScheduledFuture<?> schedule(Runnable command, - long delay, TimeUnit unit); + long delay, TimeUnit unit); /** * Creates and executes a ScheduledFuture that becomes enabled after the @@ -97,7 +97,7 @@ public interface ScheduledExecutorService extends ExecutorService { * @throws NullPointerException if callable is null */ public <V> ScheduledFuture<V> schedule(Callable<V> callable, - long delay, TimeUnit unit); + long delay, TimeUnit unit); /** * Creates and executes a periodic action that becomes enabled first @@ -125,9 +125,9 @@ public interface ScheduledExecutorService extends ExecutorService { * @throws IllegalArgumentException if period less than or equal to zero */ public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, - long initialDelay, - long period, - TimeUnit unit); + long initialDelay, + long period, + TimeUnit unit); /** * Creates and executes a periodic action that becomes enabled first @@ -152,8 +152,8 @@ public interface ScheduledExecutorService extends ExecutorService { * @throws IllegalArgumentException if delay less than or equal to zero */ public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, - long initialDelay, - long delay, - TimeUnit unit); + long initialDelay, + long delay, + TimeUnit unit); } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledThreadPoolExecutor.java b/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledThreadPoolExecutor.java index d4da334..f08b9ac 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledThreadPoolExecutor.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ScheduledThreadPoolExecutor.java @@ -587,11 +587,11 @@ public class ScheduledThreadPoolExecutor } public boolean add(Runnable x) { - return dq.add((RunnableScheduledFuture)x); - } + return dq.add((RunnableScheduledFuture)x); + } public boolean offer(Runnable x) { - return dq.offer((RunnableScheduledFuture)x); - } + return dq.offer((RunnableScheduledFuture)x); + } public void put(Runnable x) { dq.put((RunnableScheduledFuture)x); } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/Semaphore.java b/libjava/classpath/external/jsr166/java/util/concurrent/Semaphore.java index 94e9746..1052364 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/Semaphore.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/Semaphore.java @@ -614,7 +614,7 @@ public class Semaphore implements java.io.Serializable { * @throws IllegalArgumentException if {@code reduction} is negative */ protected void reducePermits(int reduction) { - if (reduction < 0) throw new IllegalArgumentException(); + if (reduction < 0) throw new IllegalArgumentException(); sync.reducePermits(reduction); } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/SynchronousQueue.java b/libjava/classpath/external/jsr166/java/util/concurrent/SynchronousQueue.java index e47e040..92f586c 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/SynchronousQueue.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/SynchronousQueue.java @@ -737,11 +737,11 @@ public class SynchronousQueue<E> extends AbstractQueue<E> advanceHead(h, hn); continue; } - QNode t = tail; // Ensure consistent read for tail + QNode t = tail; // Ensure consistent read for tail if (t == h) return; - QNode tn = t.next; - if (t != tail) + QNode tn = t.next; + if (t != tail) continue; if (tn != null) { advanceTail(t, tn); @@ -808,9 +808,9 @@ public class SynchronousQueue<E> extends AbstractQueue<E> public void put(E o) throws InterruptedException { if (o == null) throw new NullPointerException(); if (transferer.transfer(o, false, 0) == null) { - Thread.interrupted(); + Thread.interrupted(); throw new InterruptedException(); - } + } } /** @@ -857,7 +857,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E> Object e = transferer.transfer(null, false, 0); if (e != null) return (E)e; - Thread.interrupted(); + Thread.interrupted(); throw new InterruptedException(); } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/ThreadPoolExecutor.java b/libjava/classpath/external/jsr166/java/util/concurrent/ThreadPoolExecutor.java index ea89a2c..e303f14 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/ThreadPoolExecutor.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/ThreadPoolExecutor.java @@ -669,8 +669,8 @@ public class ThreadPoolExecutor extends AbstractExecutorService { runLock.lock(); try { // If not shutting down then clear an outstanding interrupt. - if (runState != STOP && - Thread.interrupted() && + if (runState != STOP && + Thread.interrupted() && runState == STOP) // Re-interrupt if stopped after clearing thread.interrupt(); boolean ran = false; @@ -911,8 +911,8 @@ public class ThreadPoolExecutor extends AbstractExecutorService { */ public void shutdown() { // Fail if caller doesn't have modifyThread permission. - SecurityManager security = System.getSecurityManager(); - if (security != null) + SecurityManager security = System.getSecurityManager(); + if (security != null) security.checkPermission(shutdownPerm); boolean fullyTerminated = false; @@ -978,8 +978,8 @@ public class ThreadPoolExecutor extends AbstractExecutorService { */ public List<Runnable> shutdownNow() { // Almost the same code as shutdown() - SecurityManager security = System.getSecurityManager(); - if (security != null) + SecurityManager security = System.getSecurityManager(); + if (security != null) security.checkPermission(shutdownPerm); boolean fullyTerminated = false; diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicInteger.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicInteger.java index dc4d470c..0f723f6 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicInteger.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicInteger.java @@ -103,7 +103,7 @@ public class AtomicInteger extends Number implements java.io.Serializable { * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int expect, int update) { - return unsafe.compareAndSwapInt(this, valueOffset, expect, update); + return unsafe.compareAndSwapInt(this, valueOffset, expect, update); } /** @@ -117,7 +117,7 @@ public class AtomicInteger extends Number implements java.io.Serializable { * @return true if successful. */ public final boolean weakCompareAndSet(int expect, int update) { - return unsafe.compareAndSwapInt(this, valueOffset, expect, update); + return unsafe.compareAndSwapInt(this, valueOffset, expect, update); } /** @@ -216,19 +216,19 @@ public class AtomicInteger extends Number implements java.io.Serializable { public int intValue() { - return get(); + return get(); } public long longValue() { - return (long)get(); + return (long)get(); } public float floatValue() { - return (float)get(); + return (float)get(); } public double doubleValue() { - return (double)get(); + return (double)get(); } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index 102c2a7..c957bbf 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -240,15 +240,15 @@ public abstract class AtomicIntegerFieldUpdater<T> { AtomicIntegerFieldUpdaterImpl(Class<T> tclass, String fieldName) { Field field = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); } catch(Exception ex) { throw new RuntimeException(ex); } @@ -256,12 +256,12 @@ public abstract class AtomicIntegerFieldUpdater<T> { Class fieldt = field.getType(); if (fieldt != int.class) throw new IllegalArgumentException("Must be integer type"); - + if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; offset = unsafe.objectFieldOffset(field); } @@ -269,8 +269,8 @@ public abstract class AtomicIntegerFieldUpdater<T> { private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); + if (cclass != null) + ensureProtectedAccess(obj); } public boolean compareAndSet(T obj, int expect, int update) { @@ -298,19 +298,19 @@ public abstract class AtomicIntegerFieldUpdater<T> { return unsafe.getIntVolatile(obj, offset); } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLong.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLong.java index 136dc60..fa254ba 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLong.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLong.java @@ -117,7 +117,7 @@ public class AtomicLong extends Number implements java.io.Serializable { * the actual value was not equal to the expected value. */ public final boolean compareAndSet(long expect, long update) { - return unsafe.compareAndSwapLong(this, valueOffset, expect, update); + return unsafe.compareAndSwapLong(this, valueOffset, expect, update); } /** @@ -131,7 +131,7 @@ public class AtomicLong extends Number implements java.io.Serializable { * @return true if successful. */ public final boolean weakCompareAndSet(long expect, long update) { - return unsafe.compareAndSwapLong(this, valueOffset, expect, update); + return unsafe.compareAndSwapLong(this, valueOffset, expect, update); } /** @@ -230,19 +230,19 @@ public class AtomicLong extends Number implements java.io.Serializable { public int intValue() { - return (int)get(); + return (int)get(); } public long longValue() { - return (long)get(); + return (long)get(); } public float floatValue() { - return (float)get(); + return (float)get(); } public double doubleValue() { - return (double)get(); + return (double)get(); } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index dafd089..f6135d1 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -239,15 +239,15 @@ public abstract class AtomicLongFieldUpdater<T> { CASUpdater(Class<T> tclass, String fieldName) { Field field = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); } catch(Exception ex) { throw new RuntimeException(ex); } @@ -259,8 +259,8 @@ public abstract class AtomicLongFieldUpdater<T> { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; offset = unsafe.objectFieldOffset(field); } @@ -268,9 +268,9 @@ public abstract class AtomicLongFieldUpdater<T> { private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); - } + if (cclass != null) + ensureProtectedAccess(obj); + } public boolean compareAndSet(T obj, long expect, long update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); @@ -297,20 +297,20 @@ public abstract class AtomicLongFieldUpdater<T> { return unsafe.getLongVolatile(obj, offset); } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException ( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException ( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } @@ -322,15 +322,15 @@ public abstract class AtomicLongFieldUpdater<T> { LockedUpdater(Class<T> tclass, String fieldName) { Field field = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); } catch(Exception ex) { throw new RuntimeException(ex); } @@ -342,8 +342,8 @@ public abstract class AtomicLongFieldUpdater<T> { if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; offset = unsafe.objectFieldOffset(field); } @@ -351,9 +351,9 @@ public abstract class AtomicLongFieldUpdater<T> { private void fullCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); - } + if (cclass != null) + ensureProtectedAccess(obj); + } public boolean compareAndSet(T obj, long expect, long update) { if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj); @@ -378,7 +378,7 @@ public abstract class AtomicLongFieldUpdater<T> { } public void lazySet(T obj, long newValue) { - set(obj, newValue); + set(obj, newValue); } public long get(T obj) { @@ -388,19 +388,19 @@ public abstract class AtomicLongFieldUpdater<T> { } } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException ( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException ( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index 5c18eca..24014a9 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -149,7 +149,7 @@ public abstract class AtomicReferenceFieldUpdater<T, V> { } private static final class AtomicReferenceFieldUpdaterImpl<T,V> - extends AtomicReferenceFieldUpdater<T,V> { + extends AtomicReferenceFieldUpdater<T,V> { private static final Unsafe unsafe = Unsafe.getUnsafe(); private final long offset; private final Class<T> tclass; @@ -169,19 +169,19 @@ public abstract class AtomicReferenceFieldUpdater<T, V> { */ AtomicReferenceFieldUpdaterImpl(Class<T> tclass, - Class<V> vclass, - String fieldName) { + Class<V> vclass, + String fieldName) { Field field = null; Class fieldClass = null; - Class caller = null; - int modifiers = 0; + Class caller = null; + int modifiers = 0; try { field = tclass.getDeclaredField(fieldName); - caller = sun.reflect.Reflection.getCallerClass(3); - modifiers = field.getModifiers(); + caller = sun.reflect.Reflection.getCallerClass(3); + modifiers = field.getModifiers(); sun.reflect.misc.ReflectUtil.ensureMemberAccess( - caller, tclass, null, modifiers); - sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); + caller, tclass, null, modifiers); + sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass); fieldClass = field.getType(); } catch (Exception ex) { throw new RuntimeException(ex); @@ -189,12 +189,12 @@ public abstract class AtomicReferenceFieldUpdater<T, V> { if (vclass != fieldClass) throw new ClassCastException(); - + if (!Modifier.isVolatile(modifiers)) throw new IllegalArgumentException("Must be volatile type"); - this.cclass = (Modifier.isProtected(modifiers) && - caller != tclass) ? caller : null; + this.cclass = (Modifier.isProtected(modifiers) && + caller != tclass) ? caller : null; this.tclass = tclass; if (vclass == Object.class) this.vclass = null; @@ -206,16 +206,16 @@ public abstract class AtomicReferenceFieldUpdater<T, V> { void targetCheck(T obj) { if (!tclass.isInstance(obj)) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); + if (cclass != null) + ensureProtectedAccess(obj); } void updateCheck(T obj, V update) { if (!tclass.isInstance(obj) || (update != null && vclass != null && !vclass.isInstance(update))) throw new ClassCastException(); - if (cclass != null) - ensureProtectedAccess(obj); + if (cclass != null) + ensureProtectedAccess(obj); } public boolean compareAndSet(T obj, V expect, V update) { @@ -257,19 +257,19 @@ public abstract class AtomicReferenceFieldUpdater<T, V> { return (V)unsafe.getObjectVolatile(obj, offset); } - private void ensureProtectedAccess(T obj) { - if (cclass.isInstance(obj)) { - return; - } - throw new RuntimeException ( + private void ensureProtectedAccess(T obj) { + if (cclass.isInstance(obj)) { + return; + } + throw new RuntimeException ( new IllegalAccessException("Class " + - cclass.getName() + + cclass.getName() + " can not access a protected member of class " + tclass.getName() + - " using an instance of " + + " using an instance of " + obj.getClass().getName() - ) - ); - } + ) + ); + } } } diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java b/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java index 88a4354..45d744b 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java @@ -892,10 +892,10 @@ public abstract class AbstractQueuedLongSynchronizer * @throws InterruptedException if the current thread is interrupted */ public final boolean tryAcquireNanos(long arg, long nanosTimeout) throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - return tryAcquire(arg) || - doAcquireNanos(arg, nanosTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + return tryAcquire(arg) || + doAcquireNanos(arg, nanosTimeout); } /** @@ -971,10 +971,10 @@ public abstract class AbstractQueuedLongSynchronizer * @throws InterruptedException if the current thread is interrupted */ public final boolean tryAcquireSharedNanos(long arg, long nanosTimeout) throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - return tryAcquireShared(arg) >= 0 || - doAcquireSharedNanos(arg, nanosTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + return tryAcquireShared(arg) >= 0 || + doAcquireSharedNanos(arg, nanosTimeout); } /** diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedSynchronizer.java b/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedSynchronizer.java index a3abb2c..647f4fc 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedSynchronizer.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/locks/AbstractQueuedSynchronizer.java @@ -1119,10 +1119,10 @@ public abstract class AbstractQueuedSynchronizer * @throws InterruptedException if the current thread is interrupted */ public final boolean tryAcquireNanos(int arg, long nanosTimeout) throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - return tryAcquire(arg) || - doAcquireNanos(arg, nanosTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + return tryAcquire(arg) || + doAcquireNanos(arg, nanosTimeout); } /** @@ -1198,10 +1198,10 @@ public abstract class AbstractQueuedSynchronizer * @throws InterruptedException if the current thread is interrupted */ public final boolean tryAcquireSharedNanos(int arg, long nanosTimeout) throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - return tryAcquireShared(arg) >= 0 || - doAcquireSharedNanos(arg, nanosTimeout); + if (Thread.interrupted()) + throw new InterruptedException(); + return tryAcquireShared(arg) >= 0 || + doAcquireSharedNanos(arg, nanosTimeout); } /** diff --git a/libjava/classpath/external/jsr166/java/util/concurrent/locks/ReentrantReadWriteLock.java b/libjava/classpath/external/jsr166/java/util/concurrent/locks/ReentrantReadWriteLock.java index df18a7c..a6eadff 100644 --- a/libjava/classpath/external/jsr166/java/util/concurrent/locks/ReentrantReadWriteLock.java +++ b/libjava/classpath/external/jsr166/java/util/concurrent/locks/ReentrantReadWriteLock.java @@ -746,7 +746,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab /** * Throws {@code UnsupportedOperationException} because - * {@code ReadLocks} do not support conditions. + * {@code ReadLocks} do not support conditions. * * @throws UnsupportedOperationException always */ @@ -773,7 +773,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab */ public static class WriteLock implements Lock, java.io.Serializable { private static final long serialVersionUID = -4992448646407690164L; - private final Sync sync; + private final Sync sync; /** * Constructor for use by subclasses @@ -789,7 +789,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab * Acquires the write lock. * * <p>Acquires the write lock if neither the read nor write lock - * are held by another thread + * are held by another thread * and returns immediately, setting the write lock hold count to * one. * @@ -811,7 +811,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab * {@linkplain Thread#interrupt interrupted}. * * <p>Acquires the write lock if neither the read nor write lock - * are held by another thread + * are held by another thread * and returns immediately, setting the write lock hold count to * one. * @@ -866,7 +866,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab * at the time of invocation. * * <p>Acquires the write lock if neither the read nor write lock - * are held by another thread + * are held by another thread * and returns immediately with the value {@code true}, * setting the write lock hold count to one. Even when this lock has * been set to use a fair ordering policy, a call to @@ -900,7 +900,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab * not been {@linkplain Thread#interrupt interrupted}. * * <p>Acquires the write lock if neither the read nor write lock - * are held by another thread + * are held by another thread * and returns immediately with the value {@code true}, * setting the write lock hold count to one. If this lock has been * set to use a fair ordering policy then an available lock @@ -1053,32 +1053,32 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab "[Locked by thread " + o.getName() + "]"); } - /** - * Queries if this write lock is held by the current thread. - * Identical in effect to {@link - * ReentrantReadWriteLock#isWriteLockedByCurrentThread}. - * - * @return {@code true} if the current thread holds this lock and - * {@code false} otherwise - * @since 1.6 - */ - public boolean isHeldByCurrentThread() { - return sync.isHeldExclusively(); - } - - /** - * Queries the number of holds on this write lock by the current - * thread. A thread has a hold on a lock for each lock action - * that is not matched by an unlock action. Identical in effect - * to {@link ReentrantReadWriteLock#getWriteHoldCount}. - * - * @return the number of holds on this lock by the current thread, - * or zero if this lock is not held by the current thread - * @since 1.6 - */ - public int getHoldCount() { - return sync.getWriteHoldCount(); - } + /** + * Queries if this write lock is held by the current thread. + * Identical in effect to {@link + * ReentrantReadWriteLock#isWriteLockedByCurrentThread}. + * + * @return {@code true} if the current thread holds this lock and + * {@code false} otherwise + * @since 1.6 + */ + public boolean isHeldByCurrentThread() { + return sync.isHeldExclusively(); + } + + /** + * Queries the number of holds on this write lock by the current + * thread. A thread has a hold on a lock for each lock action + * that is not matched by an unlock action. Identical in effect + * to {@link ReentrantReadWriteLock#getWriteHoldCount}. + * + * @return the number of holds on this lock by the current thread, + * or zero if this lock is not held by the current thread + * @since 1.6 + */ + public int getHoldCount() { + return sync.getWriteHoldCount(); + } } // Instrumentation and status |