--- a/jdk/src/share/classes/java/util/AbstractCollection.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/AbstractCollection.java Wed Dec 01 21:46:52 2010 +0000
@@ -96,14 +96,14 @@
* @throws NullPointerException {@inheritDoc}
*/
public boolean contains(Object o) {
- Iterator<E> e = iterator();
+ Iterator<E> it = iterator();
if (o==null) {
- while (e.hasNext())
- if (e.next()==null)
+ while (it.hasNext())
+ if (it.next()==null)
return true;
} else {
- while (e.hasNext())
- if (o.equals(e.next()))
+ while (it.hasNext())
+ if (o.equals(it.next()))
return true;
}
return false;
@@ -269,18 +269,18 @@
* @throws NullPointerException {@inheritDoc}
*/
public boolean remove(Object o) {
- Iterator<E> e = iterator();
+ Iterator<E> it = iterator();
if (o==null) {
- while (e.hasNext()) {
- if (e.next()==null) {
- e.remove();
+ while (it.hasNext()) {
+ if (it.next()==null) {
+ it.remove();
return true;
}
}
} else {
- while (e.hasNext()) {
- if (o.equals(e.next())) {
- e.remove();
+ while (it.hasNext()) {
+ if (o.equals(it.next())) {
+ it.remove();
return true;
}
}
@@ -304,9 +304,8 @@
* @see #contains(Object)
*/
public boolean containsAll(Collection<?> c) {
- Iterator<?> e = c.iterator();
- while (e.hasNext())
- if (!contains(e.next()))
+ for (Object e : c)
+ if (!contains(e))
return false;
return true;
}
@@ -331,11 +330,9 @@
*/
public boolean addAll(Collection<? extends E> c) {
boolean modified = false;
- Iterator<? extends E> e = c.iterator();
- while (e.hasNext()) {
- if (add(e.next()))
+ for (E e : c)
+ if (add(e))
modified = true;
- }
return modified;
}
@@ -362,10 +359,10 @@
*/
public boolean removeAll(Collection<?> c) {
boolean modified = false;
- Iterator<?> e = iterator();
- while (e.hasNext()) {
- if (c.contains(e.next())) {
- e.remove();
+ Iterator<?> it = iterator();
+ while (it.hasNext()) {
+ if (c.contains(it.next())) {
+ it.remove();
modified = true;
}
}
@@ -395,10 +392,10 @@
*/
public boolean retainAll(Collection<?> c) {
boolean modified = false;
- Iterator<E> e = iterator();
- while (e.hasNext()) {
- if (!c.contains(e.next())) {
- e.remove();
+ Iterator<E> it = iterator();
+ while (it.hasNext()) {
+ if (!c.contains(it.next())) {
+ it.remove();
modified = true;
}
}
@@ -421,10 +418,10 @@
* @throws UnsupportedOperationException {@inheritDoc}
*/
public void clear() {
- Iterator<E> e = iterator();
- while (e.hasNext()) {
- e.next();
- e.remove();
+ Iterator<E> it = iterator();
+ while (it.hasNext()) {
+ it.next();
+ it.remove();
}
}
@@ -442,18 +439,18 @@
* @return a string representation of this collection
*/
public String toString() {
- Iterator<E> i = iterator();
- if (! i.hasNext())
+ Iterator<E> it = iterator();
+ if (! it.hasNext())
return "[]";
StringBuilder sb = new StringBuilder();
sb.append('[');
for (;;) {
- E e = i.next();
+ E e = it.next();
sb.append(e == this ? "(this Collection)" : e);
- if (! i.hasNext())
+ if (! it.hasNext())
return sb.append(']').toString();
- sb.append(", ");
+ sb.append(',').append(' ');
}
}
--- a/jdk/src/share/classes/java/util/AbstractList.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/AbstractList.java Wed Dec 01 21:46:52 2010 +0000
@@ -175,15 +175,15 @@
* @throws NullPointerException {@inheritDoc}
*/
public int indexOf(Object o) {
- ListIterator<E> e = listIterator();
+ ListIterator<E> it = listIterator();
if (o==null) {
- while (e.hasNext())
- if (e.next()==null)
- return e.previousIndex();
+ while (it.hasNext())
+ if (it.next()==null)
+ return it.previousIndex();
} else {
- while (e.hasNext())
- if (o.equals(e.next()))
- return e.previousIndex();
+ while (it.hasNext())
+ if (o.equals(it.next()))
+ return it.previousIndex();
}
return -1;
}
@@ -200,15 +200,15 @@
* @throws NullPointerException {@inheritDoc}
*/
public int lastIndexOf(Object o) {
- ListIterator<E> e = listIterator(size());
+ ListIterator<E> it = listIterator(size());
if (o==null) {
- while (e.hasPrevious())
- if (e.previous()==null)
- return e.nextIndex();
+ while (it.hasPrevious())
+ if (it.previous()==null)
+ return it.nextIndex();
} else {
- while (e.hasPrevious())
- if (o.equals(e.previous()))
- return e.nextIndex();
+ while (it.hasPrevious())
+ if (o.equals(it.previous()))
+ return it.nextIndex();
}
return -1;
}
@@ -517,7 +517,7 @@
ListIterator<E> e1 = listIterator();
ListIterator e2 = ((List) o).listIterator();
- while(e1.hasNext() && e2.hasNext()) {
+ while (e1.hasNext() && e2.hasNext()) {
E o1 = e1.next();
Object o2 = e2.next();
if (!(o1==null ? o2==null : o1.equals(o2)))
--- a/jdk/src/share/classes/java/util/AbstractMap.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/AbstractMap.java Wed Dec 01 21:46:52 2010 +0000
@@ -523,7 +523,7 @@
sb.append(value == this ? "(this Map)" : value);
if (! i.hasNext())
return sb.append('}').toString();
- sb.append(", ");
+ sb.append(',').append(' ');
}
}
--- a/jdk/src/share/classes/java/util/ArrayList.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/ArrayList.java Wed Dec 01 21:46:52 2010 +0000
@@ -120,9 +120,9 @@
/**
* Constructs an empty list with the specified initial capacity.
*
- * @param initialCapacity the initial capacity of the list
- * @exception IllegalArgumentException if the specified initial capacity
- * is negative
+ * @param initialCapacity the initial capacity of the list
+ * @throws IllegalArgumentException if the specified initial capacity
+ * is negative
*/
public ArrayList(int initialCapacity) {
super();
@@ -173,7 +173,7 @@
* necessary, to ensure that it can hold at least the number of elements
* specified by the minimum capacity argument.
*
- * @param minCapacity the desired minimum capacity
+ * @param minCapacity the desired minimum capacity
*/
public void ensureCapacity(int minCapacity) {
if (minCapacity > 0)
--- a/jdk/src/share/classes/java/util/Collections.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/Collections.java Wed Dec 01 21:46:52 2010 +0000
@@ -124,7 +124,7 @@
*
* <p>The implementation takes equal advantage of ascending and
* descending order in its input array, and can take advantage of
- * ascending and descending order in different parts of the the same
+ * ascending and descending order in different parts of the same
* input array. It is well-suited to merging two or more sorted arrays:
* simply concatenate the arrays and sort the resulting array.
*
@@ -184,7 +184,7 @@
*
* <p>The implementation takes equal advantage of ascending and
* descending order in its input array, and can take advantage of
- * ascending and descending order in different parts of the the same
+ * ascending and descending order in different parts of the same
* input array. It is well-suited to merging two or more sorted arrays:
* simply concatenate the arrays and sort the resulting array.
*
@@ -823,7 +823,7 @@
i -= size;
displaced = list.set(i, displaced);
nMoved ++;
- } while(i != cycleStart);
+ } while (i != cycleStart);
}
}
@@ -1452,9 +1452,9 @@
* when o is a Map.Entry, and calls o.setValue.
*/
public boolean containsAll(Collection<?> coll) {
- Iterator<?> e = coll.iterator();
- while (e.hasNext())
- if (!contains(e.next())) // Invokes safe contains() above
+ Iterator<?> it = coll.iterator();
+ while (it.hasNext())
+ if (!contains(it.next())) // Invokes safe contains() above
return false;
return true;
}
@@ -1482,12 +1482,12 @@
UnmodifiableEntry(Map.Entry<? extends K, ? extends V> e) {this.e = e;}
- public K getKey() {return e.getKey();}
- public V getValue() {return e.getValue();}
+ public K getKey() {return e.getKey();}
+ public V getValue() {return e.getValue();}
public V setValue(V value) {
throw new UnsupportedOperationException();
}
- public int hashCode() {return e.hashCode();}
+ public int hashCode() {return e.hashCode();}
public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
return false;
@@ -1495,7 +1495,7 @@
return eq(e.getKey(), t.getKey()) &&
eq(e.getValue(), t.getValue());
}
- public String toString() {return e.toString();}
+ public String toString() {return e.toString();}
}
}
}
@@ -1562,7 +1562,7 @@
* <pre>
* Collection c = Collections.synchronizedCollection(myCollection);
* ...
- * synchronized(c) {
+ * synchronized (c) {
* Iterator i = c.iterator(); // Must be in the synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -1611,19 +1611,19 @@
}
public int size() {
- synchronized(mutex) {return c.size();}
+ synchronized (mutex) {return c.size();}
}
public boolean isEmpty() {
- synchronized(mutex) {return c.isEmpty();}
+ synchronized (mutex) {return c.isEmpty();}
}
public boolean contains(Object o) {
- synchronized(mutex) {return c.contains(o);}
+ synchronized (mutex) {return c.contains(o);}
}
public Object[] toArray() {
- synchronized(mutex) {return c.toArray();}
+ synchronized (mutex) {return c.toArray();}
}
public <T> T[] toArray(T[] a) {
- synchronized(mutex) {return c.toArray(a);}
+ synchronized (mutex) {return c.toArray(a);}
}
public Iterator<E> iterator() {
@@ -1631,32 +1631,32 @@
}
public boolean add(E e) {
- synchronized(mutex) {return c.add(e);}
+ synchronized (mutex) {return c.add(e);}
}
public boolean remove(Object o) {
- synchronized(mutex) {return c.remove(o);}
+ synchronized (mutex) {return c.remove(o);}
}
public boolean containsAll(Collection<?> coll) {
- synchronized(mutex) {return c.containsAll(coll);}
+ synchronized (mutex) {return c.containsAll(coll);}
}
public boolean addAll(Collection<? extends E> coll) {
- synchronized(mutex) {return c.addAll(coll);}
+ synchronized (mutex) {return c.addAll(coll);}
}
public boolean removeAll(Collection<?> coll) {
- synchronized(mutex) {return c.removeAll(coll);}
+ synchronized (mutex) {return c.removeAll(coll);}
}
public boolean retainAll(Collection<?> coll) {
- synchronized(mutex) {return c.retainAll(coll);}
+ synchronized (mutex) {return c.retainAll(coll);}
}
public void clear() {
- synchronized(mutex) {c.clear();}
+ synchronized (mutex) {c.clear();}
}
public String toString() {
- synchronized(mutex) {return c.toString();}
+ synchronized (mutex) {return c.toString();}
}
private void writeObject(ObjectOutputStream s) throws IOException {
- synchronized(mutex) {s.defaultWriteObject();}
+ synchronized (mutex) {s.defaultWriteObject();}
}
}
@@ -1671,7 +1671,7 @@
* <pre>
* Set s = Collections.synchronizedSet(new HashSet());
* ...
- * synchronized(s) {
+ * synchronized (s) {
* Iterator i = s.iterator(); // Must be in the synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -1709,10 +1709,10 @@
}
public boolean equals(Object o) {
- synchronized(mutex) {return c.equals(o);}
+ synchronized (mutex) {return c.equals(o);}
}
public int hashCode() {
- synchronized(mutex) {return c.hashCode();}
+ synchronized (mutex) {return c.hashCode();}
}
}
@@ -1728,7 +1728,7 @@
* <pre>
* SortedSet s = Collections.synchronizedSortedSet(new TreeSet());
* ...
- * synchronized(s) {
+ * synchronized (s) {
* Iterator i = s.iterator(); // Must be in the synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -1739,7 +1739,7 @@
* SortedSet s = Collections.synchronizedSortedSet(new TreeSet());
* SortedSet s2 = s.headSet(foo);
* ...
- * synchronized(s) { // Note: s, not s2!!!
+ * synchronized (s) { // Note: s, not s2!!!
* Iterator i = s2.iterator(); // Must be in the synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -1766,7 +1766,7 @@
{
private static final long serialVersionUID = 8695801310862127406L;
- final private SortedSet<E> ss;
+ private final SortedSet<E> ss;
SynchronizedSortedSet(SortedSet<E> s) {
super(s);
@@ -1778,31 +1778,31 @@
}
public Comparator<? super E> comparator() {
- synchronized(mutex) {return ss.comparator();}
+ synchronized (mutex) {return ss.comparator();}
}
public SortedSet<E> subSet(E fromElement, E toElement) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedSet<E>(
ss.subSet(fromElement, toElement), mutex);
}
}
public SortedSet<E> headSet(E toElement) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedSet<E>(ss.headSet(toElement), mutex);
}
}
public SortedSet<E> tailSet(E fromElement) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedSet<E>(ss.tailSet(fromElement),mutex);
}
}
public E first() {
- synchronized(mutex) {return ss.first();}
+ synchronized (mutex) {return ss.first();}
}
public E last() {
- synchronized(mutex) {return ss.last();}
+ synchronized (mutex) {return ss.last();}
}
}
@@ -1817,7 +1817,7 @@
* <pre>
* List list = Collections.synchronizedList(new ArrayList());
* ...
- * synchronized(list) {
+ * synchronized (list) {
* Iterator i = list.iterator(); // Must be in synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -1863,34 +1863,34 @@
}
public boolean equals(Object o) {
- synchronized(mutex) {return list.equals(o);}
+ synchronized (mutex) {return list.equals(o);}
}
public int hashCode() {
- synchronized(mutex) {return list.hashCode();}
+ synchronized (mutex) {return list.hashCode();}
}
public E get(int index) {
- synchronized(mutex) {return list.get(index);}
+ synchronized (mutex) {return list.get(index);}
}
public E set(int index, E element) {
- synchronized(mutex) {return list.set(index, element);}
+ synchronized (mutex) {return list.set(index, element);}
}
public void add(int index, E element) {
- synchronized(mutex) {list.add(index, element);}
+ synchronized (mutex) {list.add(index, element);}
}
public E remove(int index) {
- synchronized(mutex) {return list.remove(index);}
+ synchronized (mutex) {return list.remove(index);}
}
public int indexOf(Object o) {
- synchronized(mutex) {return list.indexOf(o);}
+ synchronized (mutex) {return list.indexOf(o);}
}
public int lastIndexOf(Object o) {
- synchronized(mutex) {return list.lastIndexOf(o);}
+ synchronized (mutex) {return list.lastIndexOf(o);}
}
public boolean addAll(int index, Collection<? extends E> c) {
- synchronized(mutex) {return list.addAll(index, c);}
+ synchronized (mutex) {return list.addAll(index, c);}
}
public ListIterator<E> listIterator() {
@@ -1902,7 +1902,7 @@
}
public List<E> subList(int fromIndex, int toIndex) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedList<E>(list.subList(fromIndex, toIndex),
mutex);
}
@@ -1943,7 +1943,7 @@
}
public List<E> subList(int fromIndex, int toIndex) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedRandomAccessList<E>(
list.subList(fromIndex, toIndex), mutex);
}
@@ -1975,7 +1975,7 @@
* ...
* Set s = m.keySet(); // Needn't be in synchronized block
* ...
- * synchronized(m) { // Synchronizing on m, not s!
+ * synchronized (m) { // Synchronizing on m, not s!
* Iterator i = s.iterator(); // Must be in synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -2016,32 +2016,32 @@
}
public int size() {
- synchronized(mutex) {return m.size();}
+ synchronized (mutex) {return m.size();}
}
public boolean isEmpty() {
- synchronized(mutex) {return m.isEmpty();}
+ synchronized (mutex) {return m.isEmpty();}
}
public boolean containsKey(Object key) {
- synchronized(mutex) {return m.containsKey(key);}
+ synchronized (mutex) {return m.containsKey(key);}
}
public boolean containsValue(Object value) {
- synchronized(mutex) {return m.containsValue(value);}
+ synchronized (mutex) {return m.containsValue(value);}
}
public V get(Object key) {
- synchronized(mutex) {return m.get(key);}
+ synchronized (mutex) {return m.get(key);}
}
public V put(K key, V value) {
- synchronized(mutex) {return m.put(key, value);}
+ synchronized (mutex) {return m.put(key, value);}
}
public V remove(Object key) {
- synchronized(mutex) {return m.remove(key);}
+ synchronized (mutex) {return m.remove(key);}
}
public void putAll(Map<? extends K, ? extends V> map) {
- synchronized(mutex) {m.putAll(map);}
+ synchronized (mutex) {m.putAll(map);}
}
public void clear() {
- synchronized(mutex) {m.clear();}
+ synchronized (mutex) {m.clear();}
}
private transient Set<K> keySet = null;
@@ -2049,7 +2049,7 @@
private transient Collection<V> values = null;
public Set<K> keySet() {
- synchronized(mutex) {
+ synchronized (mutex) {
if (keySet==null)
keySet = new SynchronizedSet<K>(m.keySet(), mutex);
return keySet;
@@ -2057,7 +2057,7 @@
}
public Set<Map.Entry<K,V>> entrySet() {
- synchronized(mutex) {
+ synchronized (mutex) {
if (entrySet==null)
entrySet = new SynchronizedSet<Map.Entry<K,V>>(m.entrySet(), mutex);
return entrySet;
@@ -2065,7 +2065,7 @@
}
public Collection<V> values() {
- synchronized(mutex) {
+ synchronized (mutex) {
if (values==null)
values = new SynchronizedCollection<V>(m.values(), mutex);
return values;
@@ -2073,16 +2073,16 @@
}
public boolean equals(Object o) {
- synchronized(mutex) {return m.equals(o);}
+ synchronized (mutex) {return m.equals(o);}
}
public int hashCode() {
- synchronized(mutex) {return m.hashCode();}
+ synchronized (mutex) {return m.hashCode();}
}
public String toString() {
- synchronized(mutex) {return m.toString();}
+ synchronized (mutex) {return m.toString();}
}
private void writeObject(ObjectOutputStream s) throws IOException {
- synchronized(mutex) {s.defaultWriteObject();}
+ synchronized (mutex) {s.defaultWriteObject();}
}
}
@@ -2101,7 +2101,7 @@
* ...
* Set s = m.keySet(); // Needn't be in synchronized block
* ...
- * synchronized(m) { // Synchronizing on m, not s!
+ * synchronized (m) { // Synchronizing on m, not s!
* Iterator i = s.iterator(); // Must be in synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -2114,7 +2114,7 @@
* ...
* Set s2 = m2.keySet(); // Needn't be in synchronized block
* ...
- * synchronized(m) { // Synchronizing on m, not m2 or s2!
+ * synchronized (m) { // Synchronizing on m, not m2 or s2!
* Iterator i = s.iterator(); // Must be in synchronized block
* while (i.hasNext())
* foo(i.next());
@@ -2154,31 +2154,31 @@
}
public Comparator<? super K> comparator() {
- synchronized(mutex) {return sm.comparator();}
+ synchronized (mutex) {return sm.comparator();}
}
public SortedMap<K,V> subMap(K fromKey, K toKey) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedMap<K,V>(
sm.subMap(fromKey, toKey), mutex);
}
}
public SortedMap<K,V> headMap(K toKey) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedMap<K,V>(sm.headMap(toKey), mutex);
}
}
public SortedMap<K,V> tailMap(K fromKey) {
- synchronized(mutex) {
+ synchronized (mutex) {
return new SynchronizedSortedMap<K,V>(sm.tailMap(fromKey),mutex);
}
}
public K firstKey() {
- synchronized(mutex) {return sm.firstKey();}
+ synchronized (mutex) {return sm.firstKey();}
}
public K lastKey() {
- synchronized(mutex) {return sm.lastKey();}
+ synchronized (mutex) {return sm.lastKey();}
}
}
@@ -3317,7 +3317,7 @@
{
private static final long serialVersionUID = 3193687207550431679L;
- final private E element;
+ private final E element;
SingletonSet(E e) {element = e;}
@@ -3448,7 +3448,7 @@
* @param o the element to appear repeatedly in the returned list.
* @return an immutable list consisting of <tt>n</tt> copies of the
* specified object.
- * @throws IllegalArgumentException if n < 0.
+ * @throws IllegalArgumentException if {@code n < 0}
* @see List#addAll(Collection)
* @see List#addAll(int, Collection)
*/
--- a/jdk/src/share/classes/java/util/ComparableTimSort.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/ComparableTimSort.java Wed Dec 01 21:46:52 2010 +0000
@@ -207,7 +207,7 @@
* @param lo the index of the first element in the range to be sorted
* @param hi the index after the last element in the range to be sorted
* @param start the index of the first element in the range that is
- * not already known to be sorted (@code lo <= start <= hi}
+ * not already known to be sorted ({@code lo <= start <= hi})
*/
@SuppressWarnings("fallthrough")
private static void binarySort(Object[] a, int lo, int hi, int start) {
@@ -245,7 +245,7 @@
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
- switch(n) {
+ switch (n) {
case 2: a[left + 2] = a[left + 1];
case 1: a[left + 1] = a[left];
break;
@@ -275,7 +275,7 @@
* @param a the array in which a run is to be counted and possibly reversed
* @param lo index of the first element in the run
* @param hi index after the last element that may be contained in the run.
- It is required that @code{lo < hi}.
+ It is required that {@code lo < hi}.
* @return the length of the run beginning at the specified position in
* the specified array
*/
@@ -288,7 +288,7 @@
// Find end of run, and reverse range if descending
if (((Comparable) a[runHi++]).compareTo(a[lo]) < 0) { // Descending
- while(runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
+ while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi);
} else { // Ascending
--- a/jdk/src/share/classes/java/util/Random.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/Random.java Wed Dec 01 21:46:52 2010 +0000
@@ -77,9 +77,9 @@
*/
private final AtomicLong seed;
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
/**
* Creates a new random number generator. This constructor sets
@@ -285,7 +285,7 @@
* @return the next pseudorandom, uniformly distributed {@code int}
* value between {@code 0} (inclusive) and {@code n} (exclusive)
* from this random number generator's sequence
- * @exception IllegalArgumentException if n is not positive
+ * @throws IllegalArgumentException if n is not positive
* @since 1.2
*/
--- a/jdk/src/share/classes/java/util/Stack.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/Stack.java Wed Dec 01 21:46:52 2010 +0000
@@ -73,9 +73,9 @@
* Removes the object at the top of this stack and returns that
* object as the value of this function.
*
- * @return The object at the top of this stack (the last item
- * of the <tt>Vector</tt> object).
- * @exception EmptyStackException if this stack is empty.
+ * @return The object at the top of this stack (the last item
+ * of the <tt>Vector</tt> object).
+ * @throws EmptyStackException if this stack is empty.
*/
public synchronized E pop() {
E obj;
@@ -91,9 +91,9 @@
* Looks at the object at the top of this stack without removing it
* from the stack.
*
- * @return the object at the top of this stack (the last item
- * of the <tt>Vector</tt> object).
- * @exception EmptyStackException if this stack is empty.
+ * @return the object at the top of this stack (the last item
+ * of the <tt>Vector</tt> object).
+ * @throws EmptyStackException if this stack is empty.
*/
public synchronized E peek() {
int len = size();
--- a/jdk/src/share/classes/java/util/TimSort.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/TimSort.java Wed Dec 01 21:46:52 2010 +0000
@@ -239,7 +239,7 @@
* @param lo the index of the first element in the range to be sorted
* @param hi the index after the last element in the range to be sorted
* @param start the index of the first element in the range that is
- * not already known to be sorted (@code lo <= start <= hi}
+ * not already known to be sorted ({@code lo <= start <= hi})
* @param c comparator to used for the sort
*/
@SuppressWarnings("fallthrough")
@@ -278,7 +278,7 @@
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
- switch(n) {
+ switch (n) {
case 2: a[left + 2] = a[left + 1];
case 1: a[left + 1] = a[left];
break;
@@ -308,7 +308,7 @@
* @param a the array in which a run is to be counted and possibly reversed
* @param lo index of the first element in the run
* @param hi index after the last element that may be contained in the run.
- It is required that @code{lo < hi}.
+ It is required that {@code lo < hi}.
* @param c the comparator to used for the sort
* @return the length of the run beginning at the specified position in
* the specified array
@@ -322,7 +322,7 @@
// Find end of run, and reverse range if descending
if (c.compare(a[runHi++], a[lo]) < 0) { // Descending
- while(runHi < hi && c.compare(a[runHi], a[runHi - 1]) < 0)
+ while (runHi < hi && c.compare(a[runHi], a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi);
} else { // Ascending
--- a/jdk/src/share/classes/java/util/TreeMap.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/TreeMap.java Wed Dec 01 21:46:52 2010 +0000
@@ -1056,11 +1056,11 @@
public Comparator<? super E> comparator() { return m.comparator(); }
public E pollFirst() {
Map.Entry<E,Object> e = m.pollFirstEntry();
- return e == null? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
public E pollLast() {
Map.Entry<E,Object> e = m.pollLastEntry();
- return e == null? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
public boolean remove(Object o) {
int oldSize = size();
@@ -1196,7 +1196,7 @@
* Test two values for equality. Differs from o1.equals(o2) only in
* that it copes with {@code null} o1 properly.
*/
- final static boolean valEquals(Object o1, Object o2) {
+ static final boolean valEquals(Object o1, Object o2) {
return (o1==null ? o2==null : o1.equals(o2));
}
@@ -1204,7 +1204,7 @@
* Return SimpleImmutableEntry for entry, or null if null
*/
static <K,V> Map.Entry<K,V> exportEntry(TreeMap.Entry<K,V> e) {
- return e == null? null :
+ return (e == null) ? null :
new AbstractMap.SimpleImmutableEntry<K,V>(e);
}
@@ -1212,7 +1212,7 @@
* Return key for entry, or null if null
*/
static <K,V> K keyOrNull(TreeMap.Entry<K,V> e) {
- return e == null? null : e.key;
+ return (e == null) ? null : e.key;
}
/**
@@ -1237,7 +1237,7 @@
/**
* @serial include
*/
- static abstract class NavigableSubMap<K,V> extends AbstractMap<K,V>
+ abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
implements NavigableMap<K,V>, java.io.Serializable {
/**
* The backing map.
@@ -1412,11 +1412,11 @@
}
public final V get(Object key) {
- return !inRange(key)? null : m.get(key);
+ return !inRange(key) ? null : m.get(key);
}
public final V remove(Object key) {
- return !inRange(key)? null : m.remove(key);
+ return !inRange(key) ? null : m.remove(key);
}
public final Map.Entry<K,V> ceilingEntry(K key) {
@@ -1559,7 +1559,8 @@
if (!inRange(key))
return false;
TreeMap.Entry<K,V> node = m.getEntry(key);
- if (node!=null && valEquals(node.getValue(),entry.getValue())){
+ if (node!=null && valEquals(node.getValue(),
+ entry.getValue())) {
m.deleteEntry(node);
return true;
}
@@ -1724,7 +1725,7 @@
false, toKey, inclusive);
}
- public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive){
+ public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
if (!inRange(fromKey, inclusive))
throw new IllegalArgumentException("fromKey out of range");
return new AscendingSubMap(m,
@@ -1805,7 +1806,7 @@
toEnd, hi, hiInclusive);
}
- public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive){
+ public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
if (!inRange(fromKey, inclusive))
throw new IllegalArgumentException("fromKey out of range");
return new DescendingSubMap(m,
@@ -2143,7 +2144,7 @@
// If strictly internal, copy successor's element to p and then make p
// point to successor.
if (p.left != null && p.right != null) {
- Entry<K,V> s = successor (p);
+ Entry<K,V> s = successor(p);
p.key = s.key;
p.value = s.value;
p = s;
--- a/jdk/src/share/classes/java/util/TreeSet.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/TreeSet.java Wed Dec 01 21:46:52 2010 +0000
@@ -452,7 +452,7 @@
*/
public E pollFirst() {
Map.Entry<E,?> e = m.pollFirstEntry();
- return (e == null)? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
/**
@@ -460,7 +460,7 @@
*/
public E pollLast() {
Map.Entry<E,?> e = m.pollLastEntry();
- return (e == null)? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
/**
--- a/jdk/src/share/classes/java/util/Vector.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/Vector.java Wed Dec 01 21:46:52 2010 +0000
@@ -919,7 +919,7 @@
* elements (optional), or if the specified collection is null
* @since 1.2
*/
- public synchronized boolean retainAll(Collection<?> c) {
+ public synchronized boolean retainAll(Collection<?> c) {
return super.retainAll(c);
}
--- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java Wed Dec 01 21:46:52 2010 +0000
@@ -51,20 +51,20 @@
* <p> <b>Extension example</b>. Here is a sketch of a class
* that customizes {@link ThreadPoolExecutor} to use
* a <tt>CustomTask</tt> class instead of the default <tt>FutureTask</tt>:
- * <pre>
+ * <pre> {@code
* public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
*
- * static class CustomTask<V> implements RunnableFuture<V> {...}
+ * static class CustomTask<V> implements RunnableFuture<V> {...}
*
- * protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
- * return new CustomTask<V>(c);
+ * protected <V> RunnableFuture<V> newTaskFor(Callable<V> c) {
+ * return new CustomTask<V>(c);
* }
- * protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
- * return new CustomTask<V>(r, v);
+ * protected <V> RunnableFuture<V> newTaskFor(Runnable r, V v) {
+ * return new CustomTask<V>(r, v);
* }
* // ... add constructors, etc.
- * }
- * </pre>
+ * }}</pre>
+ *
* @since 1.5
* @author Doug Lea
*/
@@ -106,7 +106,7 @@
*/
public Future<?> submit(Runnable task) {
if (task == null) throw new NullPointerException();
- RunnableFuture<Object> ftask = newTaskFor(task, null);
+ RunnableFuture<Void> ftask = newTaskFor(task, null);
execute(ftask);
return ftask;
}
@@ -158,7 +158,7 @@
// Record exceptions so that if we fail to obtain any
// result, we can throw the last exception we got.
ExecutionException ee = null;
- long lastTime = (timed)? System.nanoTime() : 0;
+ long lastTime = timed ? System.nanoTime() : 0;
Iterator<? extends Callable<T>> it = tasks.iterator();
// Start one task for sure; the rest incrementally
@@ -191,8 +191,6 @@
--active;
try {
return f.get();
- } catch (InterruptedException ie) {
- throw ie;
} catch (ExecutionException eex) {
ee = eex;
} catch (RuntimeException rex) {
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java Wed Dec 01 21:46:52 2010 +0000
@@ -1270,7 +1270,7 @@
* for each key-value mapping, followed by a null pair.
* The key-value mappings are emitted in no particular order.
*/
- private void writeObject(java.io.ObjectOutputStream s) throws IOException {
+ private void writeObject(java.io.ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
for (int k = 0; k < segments.length; ++k) {
@@ -1298,7 +1298,7 @@
* @param s the stream
*/
private void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException {
s.defaultReadObject();
// Initialize each segment to be minimally sized, and let grow.
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Wed Dec 01 21:46:52 2010 +0000
@@ -38,7 +38,6 @@
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.ConcurrentModificationException;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -212,7 +211,7 @@
* The actual representation we use is that p.next == p means to
* goto the first node (which in turn is reached by following prev
* pointers from head), and p.next == null && p.prev == p means
- * that the iteration is at an end and that p is a (final static)
+ * that the iteration is at an end and that p is a (static final)
* dummy node, NEXT_TERMINATOR, and not the last active node.
* Finishing the iteration when encountering such a TERMINATOR is
* good enough for read-only traversals, so such traversals can use
@@ -271,7 +270,7 @@
*/
private transient volatile Node<E> tail;
- private final static Node<Object> PREV_TERMINATOR, NEXT_TERMINATOR;
+ private static final Node<Object> PREV_TERMINATOR, NEXT_TERMINATOR;
static {
PREV_TERMINATOR = new Node<Object>(null);
@@ -401,7 +400,7 @@
}
}
- private final static int HOPS = 2;
+ private static final int HOPS = 2;
/**
* Unlinks non-null node x.
@@ -871,7 +870,7 @@
/**
* Inserts the specified element at the front of this deque.
*
- * @throws NullPointerException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
*/
public void addFirst(E e) {
linkFirst(e);
@@ -882,7 +881,7 @@
*
* <p>This method is equivalent to {@link #add}.
*
- * @throws NullPointerException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
*/
public void addLast(E e) {
linkLast(e);
@@ -892,7 +891,7 @@
* Inserts the specified element at the front of this deque.
*
* @return {@code true} always
- * @throws NullPointerException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
*/
public boolean offerFirst(E e) {
linkFirst(e);
@@ -905,7 +904,7 @@
* <p>This method is equivalent to {@link #add}.
*
* @return {@code true} always
- * @throws NullPointerException {@inheritDoc}
+ * @throws NullPointerException if the specified element is null
*/
public boolean offerLast(E e) {
linkLast(e);
@@ -940,7 +939,7 @@
/**
* @throws NoSuchElementException {@inheritDoc}
*/
- public E getLast() {
+ public E getLast() {
return screenNullResult(peekLast());
}
@@ -1016,7 +1015,7 @@
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
- * @throws NullPointerException if the specified element is {@code null}
+ * @throws NullPointerException if the specified element is null
*/
public boolean removeFirstOccurrence(Object o) {
checkNotNull(o);
@@ -1037,7 +1036,7 @@
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
- * @throws NullPointerException if the specified element is {@code null}
+ * @throws NullPointerException if the specified element is null
*/
public boolean removeLastOccurrence(Object o) {
checkNotNull(o);
@@ -1110,7 +1109,7 @@
*
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
- * @throws NullPointerException if the specified element is {@code null}
+ * @throws NullPointerException if the specified element is null
*/
public boolean remove(Object o) {
return removeFirstOccurrence(o);
@@ -1165,7 +1164,7 @@
beginningOfTheEnd.lazySetPrev(p); // CAS piggyback
if (p.casNext(null, beginningOfTheEnd)) {
// Successful CAS is the linearization point
- // for all elements to be added to this queue.
+ // for all elements to be added to this deque.
if (!casTail(t, last)) {
// Try a little harder to update tail,
// since we may be adding many elements.
@@ -1251,12 +1250,12 @@
* Returns an iterator over the elements in this deque in proper sequence.
* The elements will be returned in order from first (head) to last (tail).
*
- * <p>The returned {@code Iterator} is a "weakly consistent" iterator that
+ * <p>The returned iterator is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException
- * ConcurrentModificationException},
- * and guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed to)
- * reflect any modifications subsequent to construction.
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*
* @return an iterator over the elements in this deque in proper sequence
*/
@@ -1269,12 +1268,12 @@
* sequential order. The elements will be returned in order from
* last (tail) to first (head).
*
- * <p>The returned {@code Iterator} is a "weakly consistent" iterator that
+ * <p>The returned iterator is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException
- * ConcurrentModificationException},
- * and guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed to)
- * reflect any modifications subsequent to construction.
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*
* @return an iterator over the elements in this deque in reverse order
*/
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Wed Dec 01 21:46:52 2010 +0000
@@ -65,8 +65,8 @@
* <p>Iterators are <i>weakly consistent</i>, returning elements
* reflecting the state of the queue at some point at or since the
* creation of the iterator. They do <em>not</em> throw {@link
- * ConcurrentModificationException}, and may proceed concurrently with
- * other operations. Elements contained in the queue since the creation
+ * java.util.ConcurrentModificationException}, and may proceed concurrently
+ * with other operations. Elements contained in the queue since the creation
* of the iterator will be returned exactly once.
*
* <p>Beware that, unlike in most collections, the {@code size} method
@@ -634,12 +634,12 @@
* Returns an iterator over the elements in this queue in proper sequence.
* The elements will be returned in order from first (head) to last (tail).
*
- * <p>The returned {@code Iterator} is a "weakly consistent" iterator that
+ * <p>The returned iterator is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException
- * ConcurrentModificationException},
- * and guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed to)
- * reflect any modifications subsequent to construction.
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*
* @return an iterator over the elements in this queue in proper sequence
*/
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java Wed Dec 01 21:46:52 2010 +0000
@@ -362,12 +362,12 @@
public E pollFirst() {
Map.Entry<E,Object> e = m.pollFirstEntry();
- return e == null? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
public E pollLast() {
Map.Entry<E,Object> e = m.pollLastEntry();
- return e == null? null : e.getKey();
+ return (e == null) ? null : e.getKey();
}
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java Wed Dec 01 21:46:52 2010 +0000
@@ -547,7 +547,7 @@
* @param fromIndex index of first element to be removed
* @param toIndex index after last element to be removed
* @throws IndexOutOfBoundsException if fromIndex or toIndex out of range
- * (@code{fromIndex < 0 || toIndex > size() || toIndex < fromIndex})
+ * ({@code{fromIndex < 0 || toIndex > size() || toIndex < fromIndex})
*/
private void removeRange(int fromIndex, int toIndex) {
final ReentrantLock lock = this.lock;
@@ -989,7 +989,7 @@
}
private static class COWIterator<E> implements ListIterator<E> {
- /** Snapshot of the array **/
+ /** Snapshot of the array */
private final Object[] snapshot;
/** Index of element to be returned by subsequent call to next. */
private int cursor;
--- a/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/CopyOnWriteArraySet.java Wed Dec 01 21:46:52 2010 +0000
@@ -59,24 +59,23 @@
* copy-on-write set to maintain a set of Handler objects that
* perform some action upon state updates.
*
- * <pre>
+ * <pre> {@code
* class Handler { void handle(); ... }
*
* class X {
- * private final CopyOnWriteArraySet<Handler> handlers
- * = new CopyOnWriteArraySet<Handler>();
- * public void addHandler(Handler h) { handlers.add(h); }
+ * private final CopyOnWriteArraySet<Handler> handlers
+ * = new CopyOnWriteArraySet<Handler>();
+ * public void addHandler(Handler h) { handlers.add(h); }
*
- * private long internalState;
- * private synchronized void changeState() { internalState = ...; }
+ * private long internalState;
+ * private synchronized void changeState() { internalState = ...; }
*
- * public void update() {
- * changeState();
- * for (Handler handler : handlers)
- * handler.handle();
- * }
- * }
- * </pre>
+ * public void update() {
+ * changeState();
+ * for (Handler handler : handlers)
+ * handler.handle();
+ * }
+ * }}</pre>
*
* <p>This class is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
--- a/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Wed Dec 01 21:46:52 2010 +0000
@@ -175,7 +175,7 @@
}
protected int tryAcquireShared(int acquires) {
- return getState() == 0? 1 : -1;
+ return (getState() == 0) ? 1 : -1;
}
protected boolean tryReleaseShared(int releases) {
--- a/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/DelayQueue.java Wed Dec 01 21:46:52 2010 +0000
@@ -482,12 +482,14 @@
/**
* Returns an iterator over all the elements (both expired and
* unexpired) in this queue. The iterator does not return the
- * elements in any particular order. The returned
- * <tt>Iterator</tt> is a "weakly consistent" iterator that will
- * never throw {@link ConcurrentModificationException}, and
- * guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed
- * to) reflect any modifications subsequent to construction.
+ * elements in any particular order.
+ *
+ * <p>The returned iterator is a "weakly consistent" iterator that
+ * will never throw {@link java.util.ConcurrentModificationException
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*
* @return an iterator over the elements in this queue
*/
--- a/jdk/src/share/classes/java/util/concurrent/Exchanger.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Exchanger.java Wed Dec 01 21:46:52 2010 +0000
@@ -355,7 +355,9 @@
else if (y == null && // Try to occupy
slot.compareAndSet(null, me)) {
if (index == 0) // Blocking wait for slot 0
- return timed? awaitNanos(me, slot, nanos): await(me, slot);
+ return timed ?
+ awaitNanos(me, slot, nanos) :
+ await(me, slot);
Object v = spinWait(me, slot); // Spin wait for non-0
if (v != CANCEL)
return v;
@@ -597,8 +599,8 @@
* dormant until one of two things happens:
* <ul>
* <li>Some other thread enters the exchange; or
- * <li>Some other thread {@linkplain Thread#interrupt interrupts} the current
- * thread.
+ * <li>Some other thread {@linkplain Thread#interrupt interrupts}
+ * the current thread.
* </ul>
* <p>If the current thread:
* <ul>
@@ -616,7 +618,7 @@
*/
public V exchange(V x) throws InterruptedException {
if (!Thread.interrupted()) {
- Object v = doExchange(x == null? NULL_ITEM : x, false, 0);
+ Object v = doExchange((x == null) ? NULL_ITEM : x, false, 0);
if (v == NULL_ITEM)
return null;
if (v != CANCEL)
@@ -671,7 +673,7 @@
public V exchange(V x, long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
if (!Thread.interrupted()) {
- Object v = doExchange(x == null? NULL_ITEM : x,
+ Object v = doExchange((x == null) ? NULL_ITEM : x,
true, unit.toNanos(timeout));
if (v == NULL_ITEM)
return null;
--- a/jdk/src/share/classes/java/util/concurrent/Executor.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Executor.java Wed Dec 01 21:46:52 2010 +0000
@@ -79,37 +79,37 @@
* serializes the submission of tasks to a second executor,
* illustrating a composite executor.
*
- * <pre>
+ * <pre> {@code
* class SerialExecutor implements Executor {
- * final Queue<Runnable> tasks = new ArrayDeque<Runnable>();
- * final Executor executor;
- * Runnable active;
+ * final Queue<Runnable> tasks = new ArrayDeque<Runnable>();
+ * final Executor executor;
+ * Runnable active;
*
- * SerialExecutor(Executor executor) {
- * this.executor = executor;
- * }
+ * SerialExecutor(Executor executor) {
+ * this.executor = executor;
+ * }
*
- * public synchronized void execute(final Runnable r) {
- * tasks.offer(new Runnable() {
- * public void run() {
- * try {
- * r.run();
- * } finally {
- * scheduleNext();
- * }
- * }
- * });
- * if (active == null) {
- * scheduleNext();
+ * public synchronized void execute(final Runnable r) {
+ * tasks.offer(new Runnable() {
+ * public void run() {
+ * try {
+ * r.run();
+ * } finally {
+ * scheduleNext();
* }
+ * }
+ * });
+ * if (active == null) {
+ * scheduleNext();
* }
+ * }
*
- * protected synchronized void scheduleNext() {
- * if ((active = tasks.poll()) != null) {
- * executor.execute(active);
- * }
+ * protected synchronized void scheduleNext() {
+ * if ((active = tasks.poll()) != null) {
+ * executor.execute(active);
* }
- * }</pre>
+ * }
+ * }}</pre>
*
* The <tt>Executor</tt> implementations provided in this package
* implement {@link ExecutorService}, which is a more extensive
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorCompletionService.java Wed Dec 01 21:46:52 2010 +0000
@@ -197,7 +197,8 @@
return completionQueue.poll();
}
- public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException {
+ public Future<V> poll(long timeout, TimeUnit unit)
+ throws InterruptedException {
return completionQueue.poll(timeout, unit);
}
--- a/jdk/src/share/classes/java/util/concurrent/Executors.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java Wed Dec 01 21:46:52 2010 +0000
@@ -83,7 +83,7 @@
*
* @param nThreads the number of threads in the pool
* @return the newly created thread pool
- * @throws IllegalArgumentException if <tt>nThreads <= 0</tt>
+ * @throws IllegalArgumentException if {@code nThreads <= 0}
*/
public static ExecutorService newFixedThreadPool(int nThreads) {
return new ThreadPoolExecutor(nThreads, nThreads,
@@ -108,7 +108,7 @@
* @param threadFactory the factory to use when creating new threads
* @return the newly created thread pool
* @throws NullPointerException if threadFactory is null
- * @throws IllegalArgumentException if <tt>nThreads <= 0</tt>
+ * @throws IllegalArgumentException if {@code nThreads <= 0}
*/
public static ExecutorService newFixedThreadPool(int nThreads, ThreadFactory threadFactory) {
return new ThreadPoolExecutor(nThreads, nThreads,
@@ -242,7 +242,7 @@
* @param corePoolSize the number of threads to keep in the pool,
* even if they are idle.
* @return a newly created scheduled thread pool
- * @throws IllegalArgumentException if <tt>corePoolSize < 0</tt>
+ * @throws IllegalArgumentException if {@code corePoolSize < 0}
*/
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize) {
return new ScheduledThreadPoolExecutor(corePoolSize);
@@ -256,7 +256,7 @@
* @param threadFactory the factory to use when the executor
* creates a new thread.
* @return a newly created scheduled thread pool
- * @throws IllegalArgumentException if <tt>corePoolSize < 0</tt>
+ * @throws IllegalArgumentException if {@code corePoolSize < 0}
* @throws NullPointerException if threadFactory is null
*/
public static ScheduledExecutorService newScheduledThreadPool(
@@ -562,8 +562,8 @@
DefaultThreadFactory() {
SecurityManager s = System.getSecurityManager();
- group = (s != null)? s.getThreadGroup() :
- Thread.currentThread().getThreadGroup();
+ group = (s != null) ? s.getThreadGroup() :
+ Thread.currentThread().getThreadGroup();
namePrefix = "pool-" +
poolNumber.getAndIncrement() +
"-thread-";
@@ -669,7 +669,7 @@
FinalizableDelegatedExecutorService(ExecutorService executor) {
super(executor);
}
- protected void finalize() {
+ protected void finalize() {
super.shutdown();
}
}
--- a/jdk/src/share/classes/java/util/concurrent/Future.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Future.java Wed Dec 01 21:46:52 2010 +0000
@@ -47,21 +47,21 @@
* computation has completed, the computation cannot be cancelled.
* If you would like to use a <tt>Future</tt> for the sake
* of cancellability but not provide a usable result, you can
- * declare types of the form <tt>Future<?></tt> and
+ * declare types of the form {@code Future<?>} and
* return <tt>null</tt> as a result of the underlying task.
*
* <p>
* <b>Sample Usage</b> (Note that the following classes are all
* made-up.) <p>
- * <pre>
+ * <pre> {@code
* interface ArchiveSearcher { String search(String target); }
* class App {
* ExecutorService executor = ...
* ArchiveSearcher searcher = ...
* void showSearch(final String target)
* throws InterruptedException {
- * Future<String> future
- * = executor.submit(new Callable<String>() {
+ * Future<String> future
+ * = executor.submit(new Callable<String>() {
* public String call() {
* return searcher.search(target);
* }});
@@ -70,20 +70,18 @@
* displayText(future.get()); // use future
* } catch (ExecutionException ex) { cleanup(); return; }
* }
- * }
- * </pre>
+ * }}</pre>
*
* The {@link FutureTask} class is an implementation of <tt>Future</tt> that
* implements <tt>Runnable</tt>, and so may be executed by an <tt>Executor</tt>.
* For example, the above construction with <tt>submit</tt> could be replaced by:
- * <pre>
- * FutureTask<String> future =
- * new FutureTask<String>(new Callable<String>() {
+ * <pre> {@code
+ * FutureTask<String> future =
+ * new FutureTask<String>(new Callable<String>() {
* public String call() {
* return searcher.search(target);
* }});
- * executor.execute(future);
- * </pre>
+ * executor.execute(future);}</pre>
*
* <p>Memory consistency effects: Actions taken by the asynchronous computation
* <a href="package-summary.html#MemoryVisibility"> <i>happen-before</i></a>
--- a/jdk/src/share/classes/java/util/concurrent/FutureTask.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/FutureTask.java Wed Dec 01 21:46:52 2010 +0000
@@ -85,7 +85,7 @@
* @param result the result to return on successful completion. If
* you don't need a particular result, consider using
* constructions of the form:
- * <tt>Future<?> f = new FutureTask<Object>(runnable, null)</tt>
+ * {@code Future<?> f = new FutureTask<Void>(runnable, null)}
* @throws NullPointerException if runnable is null
*/
public FutureTask(Runnable runnable, V result) {
--- a/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/LinkedBlockingDeque.java Wed Dec 01 21:46:52 2010 +0000
@@ -1004,12 +1004,13 @@
/**
* Returns an iterator over the elements in this deque in proper sequence.
* The elements will be returned in order from first (head) to last (tail).
- * The returned {@code Iterator} is a "weakly consistent" iterator that
+ *
+ * <p>The returned iterator is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException
- * ConcurrentModificationException},
- * and guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed to)
- * reflect any modifications subsequent to construction.
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*
* @return an iterator over the elements in this deque in proper sequence
*/
@@ -1021,12 +1022,13 @@
* Returns an iterator over the elements in this deque in reverse
* sequential order. The elements will be returned in order from
* last (tail) to first (head).
- * The returned {@code Iterator} is a "weakly consistent" iterator that
+ *
+ * <p>The returned iterator is a "weakly consistent" iterator that
* will never throw {@link java.util.ConcurrentModificationException
- * ConcurrentModificationException},
- * and guarantees to traverse elements as they existed upon
- * construction of the iterator, and may (but is not guaranteed to)
- * reflect any modifications subsequent to construction.
+ * ConcurrentModificationException}, and guarantees to traverse
+ * elements as they existed upon construction of the iterator, and
+ * may (but is not guaranteed to) reflect any modifications
+ * subsequent to construction.
*/
public Iterator<E> descendingIterator() {
return new DescendingItr();
--- a/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/RecursiveAction.java Wed Dec 01 21:46:52 2010 +0000
@@ -159,7 +159,9 @@
protected abstract void compute();
/**
- * Always returns null.
+ * Always returns {@code null}.
+ *
+ * @return {@code null} always
*/
public final Void getRawResult() { return null; }
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java Wed Dec 01 21:46:52 2010 +0000
@@ -72,24 +72,23 @@
* Here is a class with a method that sets up a ScheduledExecutorService
* to beep every ten seconds for an hour:
*
- * <pre>
+ * <pre> {@code
* import static java.util.concurrent.TimeUnit.*;
* class BeeperControl {
- * private final ScheduledExecutorService scheduler =
- * Executors.newScheduledThreadPool(1);
+ * private final ScheduledExecutorService scheduler =
+ * Executors.newScheduledThreadPool(1);
*
- * public void beepForAnHour() {
- * final Runnable beeper = new Runnable() {
- * public void run() { System.out.println("beep"); }
- * };
- * final ScheduledFuture<?> beeperHandle =
- * scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS);
- * scheduler.schedule(new Runnable() {
- * public void run() { beeperHandle.cancel(true); }
- * }, 60 * 60, SECONDS);
- * }
- * }
- * </pre>
+ * public void beepForAnHour() {
+ * final Runnable beeper = new Runnable() {
+ * public void run() { System.out.println("beep"); }
+ * };
+ * final ScheduledFuture<?> beeperHandle =
+ * scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS);
+ * scheduler.schedule(new Runnable() {
+ * public void run() { beeperHandle.cancel(true); }
+ * }, 60 * 60, SECONDS);
+ * }
+ * }}</pre>
*
* @since 1.5
* @author Doug Lea
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java Wed Dec 01 21:46:52 2010 +0000
@@ -62,8 +62,8 @@
* time of cancellation.
*
* <p>Successive executions of a task scheduled via
- * <code>scheduleAtFixedRate</code> or
- * <code>scheduleWithFixedDelay</code> do not overlap. While different
+ * {@code scheduleAtFixedRate} or
+ * {@code scheduleWithFixedDelay} do not overlap. While different
* executions may be performed by different threads, the effects of
* prior executions <a
* href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
@@ -436,7 +436,7 @@
* @throws NullPointerException if {@code threadFactory} is null
*/
public ScheduledThreadPoolExecutor(int corePoolSize,
- ThreadFactory threadFactory) {
+ ThreadFactory threadFactory) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
new DelayedWorkQueue(), threadFactory);
}
@@ -453,7 +453,7 @@
* @throws NullPointerException if {@code handler} is null
*/
public ScheduledThreadPoolExecutor(int corePoolSize,
- RejectedExecutionHandler handler) {
+ RejectedExecutionHandler handler) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
new DelayedWorkQueue(), handler);
}
@@ -473,8 +473,8 @@
* {@code handler} is null
*/
public ScheduledThreadPoolExecutor(int corePoolSize,
- ThreadFactory threadFactory,
- RejectedExecutionHandler handler) {
+ ThreadFactory threadFactory,
+ RejectedExecutionHandler handler) {
super(corePoolSize, Integer.MAX_VALUE, 0, TimeUnit.NANOSECONDS,
new DelayedWorkQueue(), threadFactory, handler);
}
--- a/jdk/src/share/classes/java/util/concurrent/Semaphore.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/Semaphore.java Wed Dec 01 21:46:52 2010 +0000
@@ -223,7 +223,7 @@
/**
* NonFair version
*/
- final static class NonfairSync extends Sync {
+ static final class NonfairSync extends Sync {
private static final long serialVersionUID = -2694183684443567898L;
NonfairSync(int permits) {
@@ -238,7 +238,7 @@
/**
* Fair version
*/
- final static class FairSync extends Sync {
+ static final class FairSync extends Sync {
private static final long serialVersionUID = 2014338818796000944L;
FairSync(int permits) {
@@ -282,7 +282,7 @@
* else {@code false}
*/
public Semaphore(int permits, boolean fair) {
- sync = (fair)? new FairSync(permits) : new NonfairSync(permits);
+ sync = fair ? new FairSync(permits) : new NonfairSync(permits);
}
/**
--- a/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadLocalRandom.java Wed Dec 01 21:46:52 2010 +0000
@@ -63,9 +63,9 @@
*/
public class ThreadLocalRandom extends Random {
// same constants as Random, but must be redeclared because private
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
/**
* The random seed. We can't use super.seed.
--- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java Wed Dec 01 21:46:52 2010 +0000
@@ -53,12 +53,12 @@
* java.util.concurrent.locks.Lock lock} is not available:
*
* <pre> Lock lock = ...;
- * if ( lock.tryLock(50L, TimeUnit.MILLISECONDS) ) ...
+ * if (lock.tryLock(50L, TimeUnit.MILLISECONDS)) ...
* </pre>
* while this code will timeout in 50 seconds:
* <pre>
* Lock lock = ...;
- * if ( lock.tryLock(50L, TimeUnit.SECONDS) ) ...
+ * if (lock.tryLock(50L, TimeUnit.SECONDS)) ...
* </pre>
*
* Note however, that there is no guarantee that a particular timeout
@@ -291,7 +291,8 @@
abstract int excessNanos(long d, long m);
/**
- * Performs a timed <tt>Object.wait</tt> using this time unit.
+ * Performs a timed {@link Object#wait(long, int) Object.wait}
+ * using this time unit.
* This is a convenience method that converts timeout arguments
* into the form required by the <tt>Object.wait</tt> method.
*
@@ -299,21 +300,22 @@
* method (see {@link BlockingQueue#poll BlockingQueue.poll})
* using:
*
- * <pre> public synchronized Object poll(long timeout, TimeUnit unit) throws InterruptedException {
- * while (empty) {
- * unit.timedWait(this, timeout);
- * ...
- * }
- * }</pre>
+ * <pre> {@code
+ * public synchronized Object poll(long timeout, TimeUnit unit)
+ * throws InterruptedException {
+ * while (empty) {
+ * unit.timedWait(this, timeout);
+ * ...
+ * }
+ * }}</pre>
*
* @param obj the object to wait on
* @param timeout the maximum time to wait. If less than
* or equal to zero, do not wait at all.
- * @throws InterruptedException if interrupted while waiting.
- * @see Object#wait(long, int)
+ * @throws InterruptedException if interrupted while waiting
*/
public void timedWait(Object obj, long timeout)
- throws InterruptedException {
+ throws InterruptedException {
if (timeout > 0) {
long ms = toMillis(timeout);
int ns = excessNanos(timeout, ms);
@@ -322,17 +324,18 @@
}
/**
- * Performs a timed <tt>Thread.join</tt> using this time unit.
+ * Performs a timed {@link Thread#join(long, int) Thread.join}
+ * using this time unit.
* This is a convenience method that converts time arguments into the
* form required by the <tt>Thread.join</tt> method.
+ *
* @param thread the thread to wait for
* @param timeout the maximum time to wait. If less than
* or equal to zero, do not wait at all.
- * @throws InterruptedException if interrupted while waiting.
- * @see Thread#join(long, int)
+ * @throws InterruptedException if interrupted while waiting
*/
public void timedJoin(Thread thread, long timeout)
- throws InterruptedException {
+ throws InterruptedException {
if (timeout > 0) {
long ms = toMillis(timeout);
int ns = excessNanos(timeout, ms);
@@ -341,13 +344,14 @@
}
/**
- * Performs a <tt>Thread.sleep</tt> using this unit.
+ * Performs a {@link Thread#sleep(long, int) Thread.sleep} using
+ * this time unit.
* This is a convenience method that converts time arguments into the
* form required by the <tt>Thread.sleep</tt> method.
+ *
* @param timeout the minimum time to sleep. If less than
* or equal to zero, do not sleep at all.
- * @throws InterruptedException if interrupted while sleeping.
- * @see Thread#sleep
+ * @throws InterruptedException if interrupted while sleeping
*/
public void sleep(long timeout) throws InterruptedException {
if (timeout > 0) {
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Wed Dec 01 21:46:52 2010 +0000
@@ -55,7 +55,7 @@
* @author Doug Lea
* @param <T> The type of the object holding the updatable field
*/
-public abstract class AtomicIntegerFieldUpdater<T> {
+public abstract class AtomicIntegerFieldUpdater<T> {
/**
* Creates and returns an updater for objects with the given field.
* The Class argument is needed to check that reflective types and
@@ -279,7 +279,7 @@
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
- } catch(Exception ex) {
+ } catch (Exception ex) {
throw new RuntimeException(ex);
}
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Wed Dec 01 21:46:52 2010 +0000
@@ -55,7 +55,7 @@
* @author Doug Lea
* @param <T> The type of the object holding the updatable field
*/
-public abstract class AtomicLongFieldUpdater<T> {
+public abstract class AtomicLongFieldUpdater<T> {
/**
* Creates and returns an updater for objects with the given field.
* The Class argument is needed to check that reflective types and
@@ -278,7 +278,7 @@
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
- } catch(Exception ex) {
+ } catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -331,7 +331,7 @@
if (cclass.isInstance(obj)) {
return;
}
- throw new RuntimeException (
+ throw new RuntimeException(
new IllegalAccessException("Class " +
cclass.getName() +
" can not access a protected member of class " +
@@ -361,7 +361,7 @@
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
- } catch(Exception ex) {
+ } catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -387,7 +387,7 @@
public boolean compareAndSet(T obj, long expect, long update) {
if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj);
- synchronized(this) {
+ synchronized (this) {
long v = unsafe.getLong(obj, offset);
if (v != expect)
return false;
@@ -402,7 +402,7 @@
public void set(T obj, long newValue) {
if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj);
- synchronized(this) {
+ synchronized (this) {
unsafe.putLong(obj, offset, newValue);
}
}
@@ -413,7 +413,7 @@
public long get(T obj) {
if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj);
- synchronized(this) {
+ synchronized (this) {
return unsafe.getLong(obj, offset);
}
}
@@ -422,7 +422,7 @@
if (cclass.isInstance(obj)) {
return;
}
- throw new RuntimeException (
+ throw new RuntimeException(
new IllegalAccessException("Class " +
cclass.getName() +
" can not access a protected member of class " +
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Wed Dec 01 21:46:52 2010 +0000
@@ -45,13 +45,13 @@
* independently subject to atomic updates. For example, a tree node
* might be declared as
*
- * <pre>
+ * <pre> {@code
* class Node {
* private volatile Node left, right;
*
- * private static final AtomicReferenceFieldUpdater<Node, Node> leftUpdater =
+ * private static final AtomicReferenceFieldUpdater<Node, Node> leftUpdater =
* AtomicReferenceFieldUpdater.newUpdater(Node.class, Node.class, "left");
- * private static AtomicReferenceFieldUpdater<Node, Node> rightUpdater =
+ * private static AtomicReferenceFieldUpdater<Node, Node> rightUpdater =
* AtomicReferenceFieldUpdater.newUpdater(Node.class, Node.class, "right");
*
* Node getLeft() { return left; }
@@ -59,8 +59,7 @@
* return leftUpdater.compareAndSet(this, expect, update);
* }
* // ... and so on
- * }
- * </pre>
+ * }}</pre>
*
* <p>Note that the guarantees of the {@code compareAndSet}
* method in this class are weaker than in other atomic classes.
@@ -74,7 +73,7 @@
* @param <T> The type of the object holding the updatable field
* @param <V> The type of the field
*/
-public abstract class AtomicReferenceFieldUpdater<T, V> {
+public abstract class AtomicReferenceFieldUpdater<T, V> {
/**
* Creates and returns an updater for objects with the given field.
@@ -291,7 +290,7 @@
if (cclass.isInstance(obj)) {
return;
}
- throw new RuntimeException (
+ throw new RuntimeException(
new IllegalAccessException("Class " +
cclass.getName() +
" can not access a protected member of class " +
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Wed Dec 01 21:46:52 2010 +0000
@@ -990,7 +990,8 @@
* can represent anything you like.
* @throws InterruptedException if the current thread is interrupted
*/
- public final void acquireInterruptibly(long arg) throws InterruptedException {
+ public final void acquireInterruptibly(long arg)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (!tryAcquire(arg))
@@ -1014,7 +1015,8 @@
* @return {@code true} if acquired; {@code false} if timed out
* @throws InterruptedException if the current thread is interrupted
*/
- public final boolean tryAcquireNanos(long arg, long nanosTimeout) throws InterruptedException {
+ public final boolean tryAcquireNanos(long arg, long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
return tryAcquire(arg) ||
@@ -1070,7 +1072,8 @@
* you like.
* @throws InterruptedException if the current thread is interrupted
*/
- public final void acquireSharedInterruptibly(long arg) throws InterruptedException {
+ public final void acquireSharedInterruptibly(long arg)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (tryAcquireShared(arg) < 0)
@@ -1093,7 +1096,8 @@
* @return {@code true} if acquired; {@code false} if timed out
* @throws InterruptedException if the current thread is interrupted
*/
- public final boolean tryAcquireSharedNanos(long arg, long nanosTimeout) throws InterruptedException {
+ public final boolean tryAcquireSharedNanos(long arg, long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
return tryAcquireShared(arg) >= 0 ||
@@ -1841,7 +1845,8 @@
* <li> If interrupted while blocked in step 4, throw InterruptedException.
* </ol>
*/
- public final long awaitNanos(long nanosTimeout) throws InterruptedException {
+ public final long awaitNanos(long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
Node node = addConditionWaiter();
@@ -1885,7 +1890,8 @@
* <li> If timed out while blocked in step 4, return false, else true.
* </ol>
*/
- public final boolean awaitUntil(Date deadline) throws InterruptedException {
+ public final boolean awaitUntil(Date deadline)
+ throws InterruptedException {
if (deadline == null)
throw new NullPointerException();
long abstime = deadline.getTime();
@@ -1928,7 +1934,8 @@
* <li> If timed out while blocked in step 4, return false, else true.
* </ol>
*/
- public final boolean await(long time, TimeUnit unit) throws InterruptedException {
+ public final boolean await(long time, TimeUnit unit)
+ throws InterruptedException {
if (unit == null)
throw new NullPointerException();
long nanosTimeout = unit.toNanos(time);
@@ -2084,7 +2091,7 @@
/**
* CAS waitStatus field of a node.
*/
- private final static boolean compareAndSetWaitStatus(Node node,
+ private static final boolean compareAndSetWaitStatus(Node node,
int expect,
int update) {
return unsafe.compareAndSwapInt(node, waitStatusOffset,
@@ -2094,7 +2101,7 @@
/**
* CAS next field of a node.
*/
- private final static boolean compareAndSetNext(Node node,
+ private static final boolean compareAndSetNext(Node node,
Node expect,
Node update) {
return unsafe.compareAndSwapObject(node, nextOffset, expect, update);
--- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Wed Dec 01 21:46:52 2010 +0000
@@ -265,7 +265,7 @@
* boolean isSignalled() { return getState() != 0; }
*
* protected int tryAcquireShared(int ignore) {
- * return isSignalled()? 1 : -1;
+ * return isSignalled() ? 1 : -1;
* }
*
* protected boolean tryReleaseShared(int ignore) {
@@ -1213,7 +1213,8 @@
* can represent anything you like.
* @throws InterruptedException if the current thread is interrupted
*/
- public final void acquireInterruptibly(int arg) throws InterruptedException {
+ public final void acquireInterruptibly(int arg)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (!tryAcquire(arg))
@@ -1237,7 +1238,8 @@
* @return {@code true} if acquired; {@code false} if timed out
* @throws InterruptedException if the current thread is interrupted
*/
- public final boolean tryAcquireNanos(int arg, long nanosTimeout) throws InterruptedException {
+ public final boolean tryAcquireNanos(int arg, long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
return tryAcquire(arg) ||
@@ -1293,7 +1295,8 @@
* you like.
* @throws InterruptedException if the current thread is interrupted
*/
- public final void acquireSharedInterruptibly(int arg) throws InterruptedException {
+ public final void acquireSharedInterruptibly(int arg)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (tryAcquireShared(arg) < 0)
@@ -1316,7 +1319,8 @@
* @return {@code true} if acquired; {@code false} if timed out
* @throws InterruptedException if the current thread is interrupted
*/
- public final boolean tryAcquireSharedNanos(int arg, long nanosTimeout) throws InterruptedException {
+ public final boolean tryAcquireSharedNanos(int arg, long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
return tryAcquireShared(arg) >= 0 ||
@@ -2062,7 +2066,8 @@
* <li> If interrupted while blocked in step 4, throw InterruptedException.
* </ol>
*/
- public final long awaitNanos(long nanosTimeout) throws InterruptedException {
+ public final long awaitNanos(long nanosTimeout)
+ throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
Node node = addConditionWaiter();
@@ -2106,7 +2111,8 @@
* <li> If timed out while blocked in step 4, return false, else true.
* </ol>
*/
- public final boolean awaitUntil(Date deadline) throws InterruptedException {
+ public final boolean awaitUntil(Date deadline)
+ throws InterruptedException {
if (deadline == null)
throw new NullPointerException();
long abstime = deadline.getTime();
@@ -2149,7 +2155,8 @@
* <li> If timed out while blocked in step 4, return false, else true.
* </ol>
*/
- public final boolean await(long time, TimeUnit unit) throws InterruptedException {
+ public final boolean await(long time, TimeUnit unit)
+ throws InterruptedException {
if (unit == null)
throw new NullPointerException();
long nanosTimeout = unit.toNanos(time);
@@ -2305,7 +2312,7 @@
/**
* CAS waitStatus field of a node.
*/
- private final static boolean compareAndSetWaitStatus(Node node,
+ private static final boolean compareAndSetWaitStatus(Node node,
int expect,
int update) {
return unsafe.compareAndSwapInt(node, waitStatusOffset,
@@ -2315,7 +2322,7 @@
/**
* CAS next field of a node.
*/
- private final static boolean compareAndSetNext(Node node,
+ private static final boolean compareAndSetNext(Node node,
Node expect,
Node update) {
return unsafe.compareAndSwapObject(node, nextOffset, expect, update);
--- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Wed Dec 01 21:46:52 2010 +0000
@@ -200,8 +200,8 @@
* <li>Some other thread invokes {@link #unpark unpark} with the
* current thread as the target; or
*
- * <li>Some other thread {@linkplain Thread#interrupt interrupts} the current
- * thread; or
+ * <li>Some other thread {@linkplain Thread#interrupt interrupts}
+ * the current thread; or
*
* <li>The specified waiting time elapses; or
*
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Wed Dec 01 21:46:52 2010 +0000
@@ -116,7 +116,7 @@
* into fair and nonfair versions below. Uses AQS state to
* represent the number of holds on the lock.
*/
- static abstract class Sync extends AbstractQueuedSynchronizer {
+ abstract static class Sync extends AbstractQueuedSynchronizer {
private static final long serialVersionUID = -5179523762034025860L;
/**
@@ -200,7 +200,7 @@
/**
* Sync object for non-fair locks
*/
- final static class NonfairSync extends Sync {
+ static final class NonfairSync extends Sync {
private static final long serialVersionUID = 7316153563782823691L;
/**
@@ -222,7 +222,7 @@
/**
* Sync object for fair locks
*/
- final static class FairSync extends Sync {
+ static final class FairSync extends Sync {
private static final long serialVersionUID = -3000897897090466540L;
final void lock() {
@@ -269,7 +269,7 @@
* @param fair {@code true} if this lock should use a fair ordering policy
*/
public ReentrantLock(boolean fair) {
- sync = (fair)? new FairSync() : new NonfairSync();
+ sync = fair ? new FairSync() : new NonfairSync();
}
/**
@@ -440,7 +440,8 @@
* @throws NullPointerException if the time unit is null
*
*/
- public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
+ public boolean tryLock(long timeout, TimeUnit unit)
+ throws InterruptedException {
return sync.tryAcquireNanos(1, unit.toNanos(timeout));
}
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java Wed Dec 01 21:46:52 2010 +0000
@@ -155,7 +155,7 @@
* }
* // Downgrade by acquiring read lock before releasing write lock
* rwl.readLock().lock();
- * } finally {
+ * } finally {
* rwl.writeLock().unlock(); // Unlock write, still hold read
* }
* }
@@ -215,7 +215,8 @@
* @author Doug Lea
*
*/
-public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializable {
+public class ReentrantReadWriteLock
+ implements ReadWriteLock, java.io.Serializable {
private static final long serialVersionUID = -6992448646407690164L;
/** Inner class providing readlock */
private final ReentrantReadWriteLock.ReadLock readerLock;
@@ -251,7 +252,7 @@
* Synchronization implementation for ReentrantReadWriteLock.
* Subclassed into fair and nonfair versions.
*/
- static abstract class Sync extends AbstractQueuedSynchronizer {
+ abstract static class Sync extends AbstractQueuedSynchronizer {
private static final long serialVersionUID = 6317671515068378041L;
/*
@@ -618,7 +619,7 @@
final Thread getOwner() {
// Must read state before owner to ensure memory consistency
- return ((exclusiveCount(getState()) == 0)?
+ return ((exclusiveCount(getState()) == 0) ?
null :
getExclusiveOwnerThread());
}
@@ -669,7 +670,7 @@
/**
* Nonfair version of Sync
*/
- final static class NonfairSync extends Sync {
+ static final class NonfairSync extends Sync {
private static final long serialVersionUID = -8159625535654395037L;
final boolean writerShouldBlock() {
return false; // writers can always barge
@@ -689,7 +690,7 @@
/**
* Fair version of Sync
*/
- final static class FairSync extends Sync {
+ static final class FairSync extends Sync {
private static final long serialVersionUID = -2274990926593161451L;
final boolean writerShouldBlock() {
return hasQueuedPredecessors();
@@ -702,7 +703,7 @@
/**
* The lock returned by method {@link ReentrantReadWriteLock#readLock}.
*/
- public static class ReadLock implements Lock, java.io.Serializable {
+ public static class ReadLock implements Lock, java.io.Serializable {
private static final long serialVersionUID = -5992448646407690164L;
private final Sync sync;
@@ -867,7 +868,8 @@
* @throws NullPointerException if the time unit is null
*
*/
- public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
+ public boolean tryLock(long timeout, TimeUnit unit)
+ throws InterruptedException {
return sync.tryAcquireSharedNanos(1, unit.toNanos(timeout));
}
@@ -908,7 +910,7 @@
/**
* The lock returned by method {@link ReentrantReadWriteLock#writeLock}.
*/
- public static class WriteLock implements Lock, java.io.Serializable {
+ public static class WriteLock implements Lock, java.io.Serializable {
private static final long serialVersionUID = -4992448646407690164L;
private final Sync sync;
@@ -1108,7 +1110,8 @@
* @throws NullPointerException if the time unit is null
*
*/
- public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
+ public boolean tryLock(long timeout, TimeUnit unit)
+ throws InterruptedException {
return sync.tryAcquireNanos(1, unit.toNanos(timeout));
}
--- a/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/Interrupt.java Wed Dec 01 21:46:52 2010 +0000
@@ -136,5 +136,5 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class Fun {abstract void f() throws Throwable;}
+ private abstract static class Fun {abstract void f() throws Throwable;}
}
--- a/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -79,9 +79,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -79,9 +79,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile MapCheck.java
+ * @compile -source 1.5 MapCheck.java
* @run main/timeout=240 MapCheck
* @summary Times and checks basic map operations
*/
@@ -64,7 +64,7 @@
if (args.length > 0) {
try {
mapClass = Class.forName(args[0]);
- } catch(ClassNotFoundException e) {
+ } catch (ClassNotFoundException e) {
throw new RuntimeException("Class " + args[0] + " not found.");
}
}
@@ -102,7 +102,7 @@
try {
Map m = (Map)cl.newInstance();
return m;
- } catch(Exception e) {
+ } catch (Exception e) {
throw new RuntimeException("Can't instantiate " + cl + ": " + e);
}
}
@@ -139,7 +139,7 @@
}
}
timer.finish();
- reallyAssert (sum == expect * iters);
+ reallyAssert(sum == expect * iters);
}
static void t2(String nm, int n, Map s, Object[] key, int expect) {
@@ -149,7 +149,7 @@
if (s.remove(key[i]) != null) ++sum;
}
timer.finish();
- reallyAssert (sum == expect);
+ reallyAssert(sum == expect);
}
static void t3(String nm, int n, Map s, Object[] key, int expect) {
@@ -159,7 +159,7 @@
if (s.put(key[i], absent[i & absentMask]) == null) ++sum;
}
timer.finish();
- reallyAssert (sum == expect);
+ reallyAssert(sum == expect);
}
static void t4(String nm, int n, Map s, Object[] key, int expect) {
@@ -169,7 +169,7 @@
if (s.containsKey(key[i])) ++sum;
}
timer.finish();
- reallyAssert (sum == expect);
+ reallyAssert(sum == expect);
}
static void t5(String nm, int n, Map s, Object[] key, int expect) {
@@ -179,7 +179,7 @@
if (s.remove(key[i]) != null) ++sum;
}
timer.finish();
- reallyAssert (sum == expect);
+ reallyAssert(sum == expect);
}
static void t6(String nm, int n, Map s, Object[] k1, Object[] k2) {
@@ -190,7 +190,7 @@
if (s.get(k2[i & absentMask]) != null) ++sum;
}
timer.finish();
- reallyAssert (sum == n);
+ reallyAssert(sum == n);
}
static void t7(String nm, int n, Map s, Object[] k1, Object[] k2) {
@@ -201,7 +201,7 @@
if (s.containsKey(k2[i & absentMask])) ++sum;
}
timer.finish();
- reallyAssert (sum == n);
+ reallyAssert(sum == n);
}
static void t8(String nm, int n, Map s, Object[] key, int expect) {
@@ -211,7 +211,7 @@
if (s.get(key[i]) != null) ++sum;
}
timer.finish();
- reallyAssert (sum == expect);
+ reallyAssert(sum == expect);
}
@@ -223,7 +223,7 @@
for (int i = 0; i < absentSize; i += step)
if (s.containsValue(absent[i])) ++sum;
timer.finish();
- reallyAssert (sum != 0);
+ reallyAssert(sum != 0);
}
@@ -235,7 +235,7 @@
if (ks.contains(key[i])) ++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
@@ -243,37 +243,37 @@
int sum = 0;
timer.start("Iter Key ", size);
for (Iterator it = s.keySet().iterator(); it.hasNext(); ) {
- if(it.next() != MISSING)
+ if (it.next() != MISSING)
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void ittest2(Map s, int size) {
int sum = 0;
timer.start("Iter Value ", size);
for (Iterator it = s.values().iterator(); it.hasNext(); ) {
- if(it.next() != MISSING)
+ if (it.next() != MISSING)
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void ittest3(Map s, int size) {
int sum = 0;
timer.start("Iter Entry ", size);
for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) {
- if(it.next() != MISSING)
+ if (it.next() != MISSING)
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void ittest4(Map s, int size, int pos) {
IdentityHashMap seen = new IdentityHashMap(size);
- reallyAssert (s.size() == size);
+ reallyAssert(s.size() == size);
int sum = 0;
timer.start("Iter XEntry ", size);
Iterator it = s.entrySet().iterator();
@@ -287,9 +287,9 @@
if (x != MISSING)
++sum;
}
- reallyAssert (s.containsKey(k));
+ reallyAssert(s.containsKey(k));
it.remove();
- reallyAssert (!s.containsKey(k));
+ reallyAssert(!s.containsKey(k));
while (it.hasNext()) {
Map.Entry x = (Map.Entry)(it.next());
Object k2 = x.getKey();
@@ -298,12 +298,12 @@
++sum;
}
- reallyAssert (s.size() == size-1);
+ reallyAssert(s.size() == size-1);
s.put(k, v);
- reallyAssert (seen.size() == size);
+ reallyAssert(seen.size() == size);
timer.finish();
- reallyAssert (sum == size);
- reallyAssert (s.size() == size);
+ reallyAssert(sum == size);
+ reallyAssert(s.size() == size);
}
@@ -324,7 +324,7 @@
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void entest2(Hashtable ht, int size) {
@@ -335,7 +335,7 @@
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
@@ -349,7 +349,7 @@
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void entest4(Hashtable ht, int size) {
@@ -361,7 +361,7 @@
++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
}
static void entest(Map s, int size) {
@@ -409,13 +409,13 @@
timer.start("Iter Equals ", size * 2);
boolean eqt = s2.equals(s) && s.equals(s2);
- reallyAssert (eqt);
+ reallyAssert(eqt);
timer.finish();
timer.start("Iter HashCode ", size * 2);
int shc = s.hashCode();
int s2hc = s2.hashCode();
- reallyAssert (shc == s2hc);
+ reallyAssert(shc == s2hc);
timer.finish();
timer.start("Put (present) ", size);
@@ -430,7 +430,7 @@
if (es2.contains(entry)) ++sum;
}
timer.finish();
- reallyAssert (sum == size);
+ reallyAssert(sum == size);
t6("Get ", size, s2, key, absent);
@@ -438,13 +438,13 @@
s2.put(key[size-1], absent[0]);
timer.start("Iter Equals ", size * 2);
eqt = s2.equals(s) && s.equals(s2);
- reallyAssert (!eqt);
+ reallyAssert(!eqt);
timer.finish();
timer.start("Iter HashCode ", size * 2);
int s1h = s.hashCode();
int s2h = s2.hashCode();
- reallyAssert (s1h != s2h);
+ reallyAssert(s1h != s2h);
timer.finish();
s2.put(key[size-1], hold);
@@ -455,12 +455,12 @@
es.remove(s2i.next());
timer.finish();
- reallyAssert (s.isEmpty());
+ reallyAssert(s.isEmpty());
timer.start("Clear ", size);
s2.clear();
timer.finish();
- reallyAssert (s2.isEmpty() && s.isEmpty());
+ reallyAssert(s2.isEmpty() && s.isEmpty());
}
static void stest(Map s, int size) throws Exception {
@@ -489,7 +489,7 @@
System.out.print(time + "ms");
if (s instanceof IdentityHashMap) return;
- reallyAssert (s.equals(m));
+ reallyAssert(s.equals(m));
}
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile MapLoops.java
+ * @compile -source 1.5 MapLoops.java
* @run main/timeout=1600 MapLoops
* @summary Exercise multithreaded maps, by default ConcurrentHashMap.
* Multithreaded hash table test. Each thread does a random walk
@@ -225,7 +225,7 @@
barrier.await();
}
catch (Throwable throwable) {
- synchronized(System.err) {
+ synchronized (System.err) {
System.err.println("--------------------------------");
throwable.printStackTrace();
}
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -79,9 +79,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/CopyOnWriteArrayList/EqualsRace.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/CopyOnWriteArrayList/EqualsRace.java Wed Dec 01 21:46:52 2010 +0000
@@ -66,7 +66,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
public abstract void realRun() throws Throwable;
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }}}
--- a/jdk/test/java/util/concurrent/CopyOnWriteArraySet/RacingCows.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/CopyOnWriteArraySet/RacingCows.java Wed Dec 01 21:46:52 2010 +0000
@@ -125,7 +125,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
public abstract void realRun() throws Throwable;
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }}}
--- a/jdk/test/java/util/concurrent/CyclicBarrier/Basic.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/CyclicBarrier/Basic.java Wed Dec 01 21:46:52 2010 +0000
@@ -83,7 +83,7 @@
//----------------------------------------------------------------
// Convenience methods for creating threads that call CyclicBarrier.await
//----------------------------------------------------------------
- private static abstract class Awaiter extends Thread {
+ private abstract static class Awaiter extends Thread {
static AtomicInteger count = new AtomicInteger(1);
{
@@ -417,14 +417,14 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- static abstract class Fun { abstract void f() throws Throwable; }
+ abstract static class Fun { abstract void f() throws Throwable; }
private static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
catch (Throwable t) {
if (k.isAssignableFrom(t.getClass())) pass();
else unexpected(t);}}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
abstract void realRun() throws Throwable;
public void run() {
try {realRun();} catch (Throwable t) {unexpected(t);}}}
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile ExchangeLoops.java
+ * @compile -source 1.5 ExchangeLoops.java
* @run main/timeout=720 ExchangeLoops
* @summary checks to make sure a pipeline of exchangers passes data.
*/
@@ -78,9 +78,9 @@
final Exchanger<Int> right;
final CyclicBarrier barrier;
volatile int result;
- Stage (Exchanger<Int> left,
- Exchanger<Int> right,
- CyclicBarrier b, int iters) {
+ Stage(Exchanger<Int> left,
+ Exchanger<Int> right,
+ CyclicBarrier b, int iters) {
this.left = left;
this.right = right;
barrier = b;
--- a/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/Exchanger/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -78,9 +78,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4965960
- * @compile ExecutorCompletionServiceLoops.java
+ * @compile -source 1.5 ExecutorCompletionServiceLoops.java
* @run main/timeout=3600 ExecutorCompletionServiceLoops
* @summary Exercise ExecutorCompletionServiceLoops
*/
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -78,9 +78,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/Executors/Throws.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/Executors/Throws.java Wed Dec 01 21:46:52 2010 +0000
@@ -122,7 +122,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class Fun {abstract void f() throws Throwable;}
+ private abstract static class Fun {abstract void f() throws Throwable;}
static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
--- a/jdk/test/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/FutureTask/BlockingTaskExecutor.java Wed Dec 01 21:46:52 2010 +0000
@@ -87,7 +87,7 @@
* A helper class with a method to wait for a notification.
*
* The notification is received via the
- * <code>sendNotification</code> method.
+ * {@code sendNotification} method.
*/
static class NotificationReceiver {
/** Has the notifiee been notified? */
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile CancelledFutureLoops.java
+ * @compile -source 1.5 CancelledFutureLoops.java
* @run main/timeout=2000 CancelledFutureLoops
* @summary Checks for responsiveness of futures to cancellation.
* Runs under the assumption that ITERS computations require more than
@@ -64,10 +64,10 @@
try {
new FutureLoop(i).test();
}
- catch(BrokenBarrierException bb) {
+ catch (BrokenBarrierException bb) {
// OK; ignore
}
- catch(ExecutionException ee) {
+ catch (ExecutionException ee) {
// OK; ignore
}
Thread.sleep(TIMEOUT);
--- a/jdk/test/java/util/concurrent/FutureTask/Customized.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/FutureTask/Customized.java Wed Dec 01 21:46:52 2010 +0000
@@ -203,7 +203,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class Fun {abstract void f() throws Throwable;}
+ private abstract static class Fun {abstract void f() throws Throwable;}
static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
--- a/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/FutureTask/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -78,9 +78,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java Wed Dec 01 21:46:52 2010 +0000
@@ -161,11 +161,8 @@
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
- Class<?> k = new Object(){}.getClass().getEnclosingClass();
- try {k.getMethod("instanceMain",String[].class)
- .invoke( k.newInstance(), (Object) args);}
- catch (Throwable e) {throw e.getCause();}}
- public void instanceMain(String[] args) throws Throwable {
+ new DelayOverflow().instanceMain(args);}
+ void instanceMain(String[] args) throws Throwable {
try {test(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java Wed Dec 01 21:46:52 2010 +0000
@@ -36,9 +36,9 @@
import static java.util.concurrent.TimeUnit.*;
public class ConfigChanges {
- final static ThreadGroup tg = new ThreadGroup("pool");
+ static final ThreadGroup tg = new ThreadGroup("pool");
- final static Random rnd = new Random();
+ static final Random rnd = new Random();
static void report(ThreadPoolExecutor tpe) {
try {
@@ -241,7 +241,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class Fun {abstract void f() throws Throwable;}
+ private abstract static class Fun {abstract void f() throws Throwable;}
static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/Custom.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/Custom.java Wed Dec 01 21:46:52 2010 +0000
@@ -43,7 +43,7 @@
private static class CustomTask<V> extends FutureTask<V> {
- public final static AtomicInteger births = new AtomicInteger(0);
+ public static final AtomicInteger births = new AtomicInteger(0);
CustomTask(Callable<V> c) { super(c); births.getAndIncrement(); }
CustomTask(Runnable r, V v) { super(r, v); births.getAndIncrement(); }
}
@@ -63,7 +63,7 @@
}
private static class CustomSTPE extends ScheduledThreadPoolExecutor {
- public final static AtomicInteger decorations = new AtomicInteger(0);
+ public static final AtomicInteger decorations = new AtomicInteger(0);
CustomSTPE() {
super(threadCount);
}
@@ -89,7 +89,7 @@
return count;
}
- private final static int threadCount = 10;
+ private static final int threadCount = 10;
public static void main(String[] args) throws Throwable {
CustomTPE tpe = new CustomTPE();
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ScheduledTickleService.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ScheduledTickleService.java Wed Dec 01 21:46:52 2010 +0000
@@ -37,10 +37,10 @@
// We get intermittent ClassCastException if greater than 1
// because of calls to compareTo
- private final static int concurrency = 2;
+ private static final int concurrency = 2;
// Record when tasks are done
- public final static CountDownLatch done = new CountDownLatch(concurrency);
+ public static final CountDownLatch done = new CountDownLatch(concurrency);
public static void realMain(String... args) throws InterruptedException {
// our tickle service
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ShutdownNowExecuteRace.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ShutdownNowExecuteRace.java Wed Dec 01 21:46:52 2010 +0000
@@ -40,7 +40,7 @@
static volatile boolean quit = false;
static volatile ThreadPoolExecutor pool = null;
- final static Runnable sleeper = new Runnable() { public void run() {
+ static final Runnable sleeper = new Runnable() { public void run() {
final long ONE_HOUR = 1000L * 60L * 60L;
try { Thread.sleep(ONE_HOUR); }
catch (InterruptedException ie) {}
@@ -81,14 +81,14 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class Fun {abstract void f() throws Throwable;}
+ private abstract static class Fun {abstract void f() throws Throwable;}
static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
catch (Throwable t) {
if (k.isAssignableFrom(t.getClass())) pass();
else unexpected(t);}}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
abstract void realRun() throws Throwable;
public void run() {
try {realRun();} catch (Throwable t) {unexpected(t);}}}
--- a/jdk/test/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/ThreadPoolExecutor/ThrowingTasks.java Wed Dec 01 21:46:52 2010 +0000
@@ -35,7 +35,7 @@
import java.util.concurrent.atomic.*;
public class ThrowingTasks {
- final static Random rnd = new Random();
+ static final Random rnd = new Random();
@SuppressWarnings("serial")
static class UncaughtExceptions
@@ -65,16 +65,16 @@
}
}
- final static UncaughtExceptions uncaughtExceptions
+ static final UncaughtExceptions uncaughtExceptions
= new UncaughtExceptions();
- final static UncaughtExceptionsTable uncaughtExceptionsTable
+ static final UncaughtExceptionsTable uncaughtExceptionsTable
= new UncaughtExceptionsTable();
- final static AtomicLong totalUncaughtExceptions
+ static final AtomicLong totalUncaughtExceptions
= new AtomicLong(0);
- final static CountDownLatch uncaughtExceptionsLatch
+ static final CountDownLatch uncaughtExceptionsLatch
= new CountDownLatch(24);
- final static Thread.UncaughtExceptionHandler handler
+ static final Thread.UncaughtExceptionHandler handler
= new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
check(! Thread.currentThread().isInterrupted());
@@ -84,19 +84,19 @@
uncaughtExceptionsLatch.countDown();
}};
- final static ThreadGroup tg = new ThreadGroup("Flaky");
+ static final ThreadGroup tg = new ThreadGroup("Flaky");
- final static ThreadFactory tf = new ThreadFactory() {
+ static final ThreadFactory tf = new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread t = new Thread(tg, r);
t.setUncaughtExceptionHandler(handler);
return t;
}};
- final static RuntimeException rte = new RuntimeException();
- final static Error error = new Error();
- final static Throwable weird = new Throwable();
- final static Exception checkedException = new Exception();
+ static final RuntimeException rte = new RuntimeException();
+ static final Error error = new Error();
+ static final Throwable weird = new Throwable();
+ static final Exception checkedException = new Exception();
static class Thrower implements Runnable {
Throwable t;
@@ -105,13 +105,13 @@
public void run() { if (t != null) Thread.currentThread().stop(t); }
}
- final static Thrower noThrower = new Thrower(null);
- final static Thrower rteThrower = new Thrower(rte);
- final static Thrower errorThrower = new Thrower(error);
- final static Thrower weirdThrower = new Thrower(weird);
- final static Thrower checkedThrower = new Thrower(checkedException);
+ static final Thrower noThrower = new Thrower(null);
+ static final Thrower rteThrower = new Thrower(rte);
+ static final Thrower errorThrower = new Thrower(error);
+ static final Thrower weirdThrower = new Thrower(weird);
+ static final Thrower checkedThrower = new Thrower(checkedException);
- final static List<Thrower> throwers = Arrays.asList(
+ static final List<Thrower> throwers = Arrays.asList(
noThrower, rteThrower, errorThrower, weirdThrower, checkedThrower);
static class Flaky implements Runnable {
--- a/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java Wed Dec 01 21:46:52 2010 +0000
@@ -24,6 +24,8 @@
/*
* @test
* @bug 4992443 4994819
+ * @compile -source 1.5 VMSupportsCS8.java
+ * @run main VMSupportsCS8
* @summary Checks that the value of VMSupportsCS8 matches system properties.
*/
--- a/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/Lock/FlakyMutex.java Wed Dec 01 21:46:52 2010 +0000
@@ -75,10 +75,10 @@
catch (Throwable t) { checkThrowable(t); }
}
- try { check (! m.tryLock()); }
+ try { check(! m.tryLock()); }
catch (Throwable t) { checkThrowable(t); }
- try { check (! m.tryLock(1, TimeUnit.MICROSECONDS)); }
+ try { check(! m.tryLock(1, TimeUnit.MICROSECONDS)); }
catch (Throwable t) { checkThrowable(t); }
m.unlock();
--- a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java Wed Dec 01 21:46:52 2010 +0000
@@ -64,7 +64,7 @@
return outputOf(new InputStreamReader(is, "UTF-8"));
}
- final static ExecutorService drainers = Executors.newFixedThreadPool(12);
+ static final ExecutorService drainers = Executors.newFixedThreadPool(12);
static Future<String> futureOutputOf(final InputStream is) {
return drainers.submit(
new Callable<String>() { public String call() throws IOException {
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile CancelledLockLoops.java
+ * @compile -source 1.5 CancelledLockLoops.java
* @run main/timeout=2800 CancelledLockLoops
* @summary tests lockInterruptibly.
* Checks for responsiveness of locks to interrupts. Runs under that
@@ -64,7 +64,7 @@
try {
new ReentrantLockLoop(i).test();
}
- catch(BrokenBarrierException bb) {
+ catch (BrokenBarrierException bb) {
// OK, ignore
}
Thread.sleep(TIMEOUT);
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile LockOncePerThreadLoops.java
+ * @compile -source 1.5 LockOncePerThreadLoops.java
* @run main/timeout=15000 LockOncePerThreadLoops
* @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
*/
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -78,9 +78,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile SimpleReentrantLockLoops.java
+ * @compile -source 1.5 SimpleReentrantLockLoops.java
* @run main/timeout=4500 SimpleReentrantLockLoops
* @summary multiple threads using a single lock
*/
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,6 +34,8 @@
/*
* @test
* @bug 4486658 5031862
+ * @compile -source 1.5 TimeoutLockLoops.java
+ * @run main TimeoutLockLoops
* @summary Checks for responsiveness of locks to timeouts.
* Runs under the assumption that ITERS computations require more than
* TIMEOUT msecs to complete, which seems to be a safe assumption for
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/Bug6571733.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/Bug6571733.java Wed Dec 01 21:46:52 2010 +0000
@@ -45,7 +45,7 @@
Thread thread = new Thread() { public void run() {
try {
- check (! lock.writeLock().tryLock(0, TimeUnit.DAYS));
+ check(! lock.writeLock().tryLock(0, TimeUnit.DAYS));
lock.readLock().lock();
lock.readLock().unlock();
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/LoopHelpers.java Wed Dec 01 21:46:52 2010 +0000
@@ -78,9 +78,9 @@
* Basically same as java.util.Random.
*/
public static class SimpleRandom {
- private final static long multiplier = 0x5DEECE66DL;
- private final static long addend = 0xBL;
- private final static long mask = (1L << 48) - 1;
+ private static final long multiplier = 0x5DEECE66DL;
+ private static final long addend = 0xBL;
+ private static final long mask = (1L << 48) - 1;
static final AtomicLong seq = new AtomicLong(1);
private long seed = System.nanoTime() + seq.getAndIncrement();
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Wed Dec 01 21:46:52 2010 +0000
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile MapLoops.java
+ * @compile -source 1.5 MapLoops.java
* @run main/timeout=4700 MapLoops
* @summary Exercise multithreaded maps, by default ConcurrentHashMap.
* Multithreaded hash table test. Each thread does a random walk
@@ -65,7 +65,7 @@
if (args.length > 0) {
try {
mapClass = Class.forName(args[0]);
- } catch(ClassNotFoundException e) {
+ } catch (ClassNotFoundException e) {
throw new RuntimeException("Class " + args[0] + " not found.");
}
}
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java Wed Dec 01 13:01:53 2010 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/RWMap.java Wed Dec 01 21:46:52 2010 +0000
@@ -57,21 +57,33 @@
}
public int size() {
- rwl.readLock().lock(); try {return m.size();} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.size(); }
+ finally { rwl.readLock().unlock(); }
}
- public boolean isEmpty(){
- rwl.readLock().lock(); try {return m.isEmpty();} finally { rwl.readLock().unlock(); }
+
+ public boolean isEmpty() {
+ rwl.readLock().lock();
+ try { return m.isEmpty(); }
+ finally { rwl.readLock().unlock(); }
}
public Object get(Object key) {
- rwl.readLock().lock(); try {return m.get(key);} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.get(key); }
+ finally { rwl.readLock().unlock(); }
}
public boolean containsKey(Object key) {
- rwl.readLock().lock(); try {return m.containsKey(key);} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.containsKey(key); }
+ finally { rwl.readLock().unlock(); }
}
- public boolean containsValue(Object value){
- rwl.readLock().lock(); try {return m.containsValue(value);} finally { rwl.readLock().unlock(); }
+
+ public boolean containsValue(Object value) {
+ rwl.readLock().lock();
+ try { return m.containsValue(value); }
+ finally { rwl.readLock().unlock(); }
}
@@ -88,28 +100,45 @@
}
public boolean equals(Object o) {
- rwl.readLock().lock(); try {return m.equals(o);} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.equals(o); }
+ finally { rwl.readLock().unlock(); }
}
+
public int hashCode() {
- rwl.readLock().lock(); try {return m.hashCode();} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.hashCode(); }
+ finally { rwl.readLock().unlock(); }
}
+
public String toString() {
- rwl.readLock().lock(); try {return m.toString();} finally { rwl.readLock().unlock(); }
+ rwl.readLock().lock();
+ try { return m.toString(); }
+ finally { rwl.readLock().unlock(); }
}
-
+ public Object put(Object key, Object value) {
+ rwl.writeLock().lock();
+ try { return m.put(key, value); }
+ finally { rwl.writeLock().unlock(); }
+ }
- public Object put(Object key, Object value) {
- rwl.writeLock().lock(); try {return m.put(key, value);} finally { rwl.writeLock().unlock(); }
- }
public Object remove(Object key) {
- rwl.writeLock().lock(); try {return m.remove(key);} finally { rwl.writeLock().unlock(); }
+ rwl.writeLock().lock();
+ try { return m.remove(key); }
+ finally { rwl.writeLock().unlock(); }
}
+
public void putAll(Map map) {
- rwl.writeLock().lock(); try {m.putAll(map);} finally { rwl.writeLock().unlock(); }
+ rwl.writeLock().lock();
+ try { m.putAll(map); }
+ finally { rwl.writeLock().unlock(); }
}
+
public void clear() {
- rwl.writeLock().lock(); try {m.clear();} finally { rwl.writeLock().unlock(); }
+ rwl.writeLock().lock();
+ try { m.clear(); }
+ finally { rwl.writeLock().unlock(); }
}
}