Skip to content

Commit

Permalink
Document that we don't forward calls to default methods, except when …
Browse files Browse the repository at this point in the history
…we do.

Also, standardize on <b> for Warnings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124370400
  • Loading branch information
cpovirk committed Jun 8, 2016
1 parent 5cac626 commit cee9942
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
* behaviour. In this case, you should override {@code offer} as well, either providing your own
* implementation, or delegating to the provided {@code standardOffer} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingBlockingDeque}.
*
* <p>
* The {@code standard} methods are not guaranteed to be thread-safe, even when all of the methods
* that they depend on are thread-safe.
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
* override {@code addAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardAddAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingCollection}.
*
* <p>The {@code standard} methods are not guaranteed to be thread-safe, even
* when all of the methods that they depend on are thread-safe.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
* the backing map as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><b>{@code default} method warning:</b> This class forwards calls to <i>only some</i> {@code
* default} methods. Specifically, it forwards calls only for methods that existed <a
* href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentMap.html">before
* {@code default} methods were introduced</a>. For newer methods, like {@code forEach}, it inherits
* their default implementations. When those implementations invoke methods, they invoke methods on
* the {@code ForwardingConcurrentMap}.
*
* @author Charles Fry
* @since 2.0
*/
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingDeque.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
* #offer} which can lead to unexpected behavior. In this case, you should
* override {@code offer} as well.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingDeque}.
*
* @author Kurt Alfred Kluever
* @since 12.0
*/
Expand Down
7 changes: 7 additions & 0 deletions guava/src/com/google/common/collect/ForwardingIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
* backing iterator as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><b>{@code default} method warning:</b> This class forwards calls to <i>only some</i> {@code
* default} methods. Specifically, it forwards calls only for methods that existed <a
* href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html">before {@code default}
* methods were introduced</a>. For newer methods, like {@code forEachRemaining}, it inherits their
* default implementations. When those implementations invoke methods, they invoke methods on the
* {@code ForwardingIterator}.
*
* @author Kevin Bourrillion
* @since 2.0
*/
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingList.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
* override {@code addAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardAddAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingList}.
*
* <p>The {@code standard} methods and any collection views they return are not
* guaranteed to be thread-safe, even when all of the methods that they depend
* on are thread-safe.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
* behavior of the backing iterator as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><b>{@code default} method warning:</b> This class forwards calls to <i>only some</i> {@code
* default} methods. Specifically, it forwards calls only for methods that existed <a
* href="https://docs.oracle.com/javase/7/docs/api/java/util/ListIterator.html">before {@code
* default} methods were introduced</a>. For newer methods, like {@code forEachRemaining}, it
* inherits their default implementations. When those implementations invoke methods, they invoke
* methods on the {@code ForwardingListIterator}.
*
* @author Mike Bostock
* @since 2.0
*/
Expand Down
6 changes: 5 additions & 1 deletion guava/src/com/google/common/collect/ForwardingMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@
* desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingMap} forward
* <p><b>Warning:</b> The methods of {@code ForwardingMap} forward
* <i>indiscriminately</i> to the methods of the delegate. For example,
* overriding {@link #put} alone <i>will not</i> change the behavior of {@link
* #putAll}, which can lead to unexpected behavior. In this case, you should
* override {@code putAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardPutAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingMap}.
*
* <p>Each of the {@code standard} methods, where appropriate, use {@link
* Objects#equal} to test equality for both keys and values. This may not be
* the desired behavior for map implementations that use non-standard notions of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* backing map entry as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingMapEntry} forward
* <p><b>Warning:</b> The methods of {@code ForwardingMapEntry} forward
* <i>indiscriminately</i> to the methods of the delegate. For example,
* overriding {@link #getValue} alone <i>will not</i> change the behavior of
* {@link #equals}, which can lead to unexpected behavior. In this case, you
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingMultiset.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
* your own implementation, or delegating to the provided {@code standardAdd}
* method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingMultiset}.
*
* <p>The {@code standard} methods and any collection views they return are not
* guaranteed to be thread-safe, even when all of the methods that they depend
* on are thread-safe.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@
* override one or more methods to modify the behavior of the backing map as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingNavigableMap} forward <i>indiscriminately</i>
* <p><b>Warning:</b> The methods of {@code ForwardingNavigableMap} forward <i>indiscriminately</i>
* to the methods of the delegate. For example, overriding {@link #put} alone <i>will not</i>
* change the behavior of {@link #putAll}, which can lead to unexpected behavior. In this case, you
* should override {@code putAll} as well, either providing your own implementation, or delegating
* to the provided {@code standardPutAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingNavigableMap}.
*
* <p>Each of the {@code standard} methods uses the map's comparator (or the natural ordering of
* the elements, if there is no comparator) to test element equality. As a result, if the comparator
* is not consistent with equals, some of the standard implementations may violate the {@code Map}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
* override one or more methods to modify the behavior of the backing set as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingNavigableSet} forward <i>indiscriminately</i>
* <p><b>Warning:</b> The methods of {@code ForwardingNavigableSet} forward <i>indiscriminately</i>
* to the methods of the delegate. For example, overriding {@link #add} alone <i>will not</i>
* change the behavior of {@link #addAll}, which can lead to unexpected behavior. In this case, you
* should override {@code addAll} as well, either providing your own implementation, or delegating
* to the provided {@code standardAddAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingNavigableSet}.
*
* <p>Each of the {@code standard} methods uses the set's comparator (or the natural ordering of
* the elements, if there is no comparator) to test element equality. As a result, if the
* comparator is not consistent with equals, some of the standard implementations may violate the
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
* override {@code offer} as well, either providing your own implementation, or
* delegating to the provided {@code standardOffer} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingQueue}.
*
* <p>The {@code standard} methods are not guaranteed to be thread-safe, even
* when all of the methods that they depend on are thread-safe.
*
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/collect/ForwardingSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
* override {@code addAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardAddAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingSet}.
*
* <p>The {@code standard} methods are not guaranteed to be thread-safe, even
* when all of the methods that they depend on are thread-safe.
*
Expand Down
6 changes: 5 additions & 1 deletion guava/src/com/google/common/collect/ForwardingSortedMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@
* the backing sorted map as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingSortedMap} forward
* <p><b>Warning:</b> The methods of {@code ForwardingSortedMap} forward
* <i>indiscriminately</i> to the methods of the delegate. For example,
* overriding {@link #put} alone <i>will not</i> change the behavior of {@link
* #putAll}, which can lead to unexpected behavior. In this case, you should
* override {@code putAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardPutAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingSortedMap}.
*
* <p>Each of the {@code standard} methods, where appropriate, use the
* comparator of the map to test equality for both keys and values, unlike
* {@code ForwardingMap}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
* well, either providing your own implementation, or delegating to the provided {@code
* standardAdd} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingSortedMultiset}.
*
* <p>The {@code standard} methods and any collection views they return are not guaranteed to be
* thread-safe, even when all of the methods that they depend on are thread-safe.
*
Expand Down
6 changes: 5 additions & 1 deletion guava/src/com/google/common/collect/ForwardingSortedSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@
* backing sorted set as desired per the <a
* href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
*
* <p><i>Warning:</i> The methods of {@code ForwardingSortedSet} forward
* <p><b>Warning:</b> The methods of {@code ForwardingSortedSet} forward
* <i>indiscriminately</i> to the methods of the delegate. For example,
* overriding {@link #add} alone <i>will not</i> change the behavior of {@link
* #addAll}, which can lead to unexpected behavior. In this case, you should
* override {@code addAll} as well, either providing your own implementation, or
* delegating to the provided {@code standardAddAll} method.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingSortedSet}.
*
* <p>Each of the {@code standard} methods, where appropriate, uses the set's
* comparator (or the natural ordering of the elements, if there is no
* comparator) to test element equality. As a result, if the comparator is not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
* as desired per the <a href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator
* pattern</a>.
*
* <p><b>{@code default} method warning:</b> This class does <i>not</i> forward calls to {@code
* default} methods. Instead, it inherits their default implementations. When those implementations
* invoke methods, they invoke methods on the {@code ForwardingBlockingQueue}.
*
* @author Raimundo Mirisola
*
* @param <E> the type of elements held in this collection
Expand Down

0 comments on commit cee9942

Please sign in to comment.