Skip to content

Commit

Permalink
Remove @beta from APIs:
Browse files Browse the repository at this point in the history
collect
- most Collectors (aside from BloomFilter and ImmutableRange*, as those whole classes are @beta (though I did remove the redundant @beta annotation from the Collector-returning methods for clarity))
- Maps: asConverter, immutableEnumMap
- MultimapBuilder
- Streams: stream(Iterable), concat

io
- ByteStreams: copy, toByteArray
- CharStreams: copy, toString
- Files: as(Char|Byte)(Source|Sink)

util.concurrent
- Futures: addCallback, getDone, getUnchecked, immediateCancelledFuture, immediateFailedFuture, immediateFuture
- ListeningScheduledExecutorService
- Uninterruptibles

other
- HtmlEscapers
- Splitter.splitToList
- Ticker

Fixes #3287
Fixes #3251 (aside from ImmutableRange*, but those whole classes are @beta, anyway)
Addresses the main concerns of #3285 but doesn't cover the broader request
Fixes #3340
Partially addresses #3239

RELNOTES=Removed `@Beta` from a number of frequently used APIs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=232681253
  • Loading branch information
cpovirk authored and ronshapiro committed Feb 26, 2019
1 parent 0967c79 commit 068cb90
Show file tree
Hide file tree
Showing 39 changed files with 154 additions and 62 deletions.
1 change: 0 additions & 1 deletion android/guava/src/com/google/common/base/Splitter.java
Expand Up @@ -408,7 +408,6 @@ private Iterator<String> splittingIterator(CharSequence sequence) {
* @return an immutable list of the segments split from the parameter
* @since 15.0
*/
@Beta
public List<String> splitToList(CharSequence sequence) {
checkNotNull(sequence);

Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/base/Ticker.java
Expand Up @@ -14,7 +14,6 @@

package com.google.common.base;

import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;

/**
Expand All @@ -28,7 +27,6 @@
* @since 10.0 (<a href="https://github.com/google/guava/wiki/Compatibility">mostly
* source-compatible</a> since 9.0)
*/
@Beta
@GwtCompatible
public abstract class Ticker {
/** Constructor for use by subclasses. */
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/collect/Maps.java
Expand Up @@ -139,7 +139,6 @@ V transform(Entry<K, V> entry) {
* @since 14.0
*/
@GwtCompatible(serializable = true)
@Beta
public static <K extends Enum<K>, V> ImmutableMap<K, V> immutableEnumMap(
Map<K, ? extends V> map) {
if (map instanceof ImmutableEnumMap) {
Expand Down Expand Up @@ -1363,7 +1362,6 @@ public int hashCode() {
*
* @since 16.0
*/
@Beta
public static <A, B> Converter<A, B> asConverter(final BiMap<A, B> bimap) {
return new BiMapConverter<>(bimap);
}
Expand Down
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;

import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Supplier;
import java.io.Serializable;
Expand Down Expand Up @@ -61,7 +60,6 @@
* @param <V0> An upper bound on the value type of the generated multimap.
* @since 16.0
*/
@Beta
@GwtCompatible
public abstract class MultimapBuilder<K0, V0> {
/*
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/html/HtmlEscapers.java
Expand Up @@ -14,7 +14,6 @@

package com.google.common.html;

import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.escape.Escaper;
import com.google.common.escape.Escapers;
Expand All @@ -35,7 +34,6 @@
* @author David Beaumont
* @since 15.0
*/
@Beta
@GwtCompatible
public final class HtmlEscapers {
/**
Expand Down
15 changes: 14 additions & 1 deletion android/guava/src/com/google/common/io/ByteStreams.java
Expand Up @@ -48,7 +48,6 @@
* @author Colin Decker
* @since 1.0
*/
@Beta
@GwtIncompatible
public final class ByteStreams {

Expand Down Expand Up @@ -266,6 +265,7 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException
* @since 20.0
*/
@CanIgnoreReturnValue
@Beta
public static long exhaust(InputStream in) throws IOException {
long total = 0;
long read;
Expand All @@ -280,6 +280,7 @@ public static long exhaust(InputStream in) throws IOException {
* Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the
* beginning.
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes) {
return newDataInput(new ByteArrayInputStream(bytes));
}
Expand All @@ -291,6 +292,7 @@ public static ByteArrayDataInput newDataInput(byte[] bytes) {
* @throws IndexOutOfBoundsException if {@code start} is negative or greater than the length of
* the array
*/
@Beta
public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
checkPositionIndex(start, bytes.length);
return newDataInput(new ByteArrayInputStream(bytes, start, bytes.length - start));
Expand All @@ -303,6 +305,7 @@ public static ByteArrayDataInput newDataInput(byte[] bytes, int start) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataInput newDataInput(ByteArrayInputStream byteArrayInputStream) {
return new ByteArrayDataInputStream(checkNotNull(byteArrayInputStream));
}
Expand Down Expand Up @@ -453,6 +456,7 @@ public String readUTF() {
}

/** Returns a new {@link ByteArrayDataOutput} instance with a default size. */
@Beta
public static ByteArrayDataOutput newDataOutput() {
return newDataOutput(new ByteArrayOutputStream());
}
Expand All @@ -463,6 +467,7 @@ public static ByteArrayDataOutput newDataOutput() {
*
* @throws IllegalArgumentException if {@code size} is negative
*/
@Beta
public static ByteArrayDataOutput newDataOutput(int size) {
// When called at high frequency, boxing size generates too much garbage,
// so avoid doing that if we can.
Expand All @@ -484,6 +489,7 @@ public static ByteArrayDataOutput newDataOutput(int size) {
*
* @since 17.0
*/
@Beta
public static ByteArrayDataOutput newDataOutput(ByteArrayOutputStream byteArrayOutputSteam) {
return new ByteArrayDataOutputStream(checkNotNull(byteArrayOutputSteam));
}
Expand Down Expand Up @@ -659,6 +665,7 @@ public String toString() {
*
* @since 14.0 (since 1.0 as com.google.common.io.NullOutputStream)
*/
@Beta
public static OutputStream nullOutputStream() {
return NULL_OUTPUT_STREAM;
}
Expand All @@ -671,6 +678,7 @@ public static OutputStream nullOutputStream() {
* @return a length-limited {@link InputStream}
* @since 14.0 (since 1.0 as com.google.common.io.LimitInputStream)
*/
@Beta
public static InputStream limit(InputStream in, long limit) {
return new LimitedInputStream(in, limit);
}
Expand Down Expand Up @@ -757,6 +765,7 @@ public long skip(long n) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b) throws IOException {
readFully(in, b, 0, b.length);
}
Expand All @@ -773,6 +782,7 @@ public static void readFully(InputStream in, byte[] b) throws IOException {
* @throws EOFException if this stream reaches the end before reading all the bytes.
* @throws IOException if an I/O error occurs.
*/
@Beta
public static void readFully(InputStream in, byte[] b, int off, int len) throws IOException {
int read = read(in, b, off, len);
if (read != len) {
Expand All @@ -790,6 +800,7 @@ public static void readFully(InputStream in, byte[] b, int off, int len) throws
* @throws EOFException if this stream reaches the end before skipping all the bytes
* @throws IOException if an I/O error occurs, or the stream does not support skipping
*/
@Beta
public static void skipFully(InputStream in, long n) throws IOException {
long skipped = skipUpTo(in, n);
if (skipped < n) {
Expand Down Expand Up @@ -848,6 +859,7 @@ private static long skipSafely(InputStream in, long n) throws IOException {
* @throws IOException if an I/O error occurs
* @since 14.0
*/
@Beta
@CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readBytes(InputStream input, ByteProcessor<T> processor) throws IOException {
checkNotNull(input);
Expand Down Expand Up @@ -883,6 +895,7 @@ public static <T> T readBytes(InputStream input, ByteProcessor<T> processor) thr
* @return the number of bytes read
* @throws IOException if an I/O error occurs
*/
@Beta
@CanIgnoreReturnValue
// Sometimes you don't care how many bytes you actually read, I guess.
// (You know that it's either going to read len bytes or stop at EOF.)
Expand Down
7 changes: 6 additions & 1 deletion android/guava/src/com/google/common/io/CharStreams.java
Expand Up @@ -43,7 +43,6 @@
* @author Colin Decker
* @since 1.0
*/
@Beta
@GwtIncompatible
public final class CharStreams {

Expand Down Expand Up @@ -193,6 +192,7 @@ private static StringBuilder toStringBuilder(Readable r) throws IOException {
* @return a mutable {@link List} containing all the lines
* @throws IOException if an I/O error occurs
*/
@Beta
public static List<String> readLines(Readable r) throws IOException {
List<String> result = new ArrayList<>();
LineReader lineReader = new LineReader(r);
Expand All @@ -212,6 +212,7 @@ public static List<String> readLines(Readable r) throws IOException {
* @throws IOException if an I/O error occurs
* @since 14.0
*/
@Beta
@CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readLines(Readable readable, LineProcessor<T> processor) throws IOException {
checkNotNull(readable);
Expand All @@ -233,6 +234,7 @@ public static <T> T readLines(Readable readable, LineProcessor<T> processor) thr
*
* @since 20.0
*/
@Beta
@CanIgnoreReturnValue
public static long exhaust(Readable readable) throws IOException {
long total = 0;
Expand All @@ -254,6 +256,7 @@ public static long exhaust(Readable readable) throws IOException {
* @throws EOFException if this stream reaches the end before skipping all the characters
* @throws IOException if an I/O error occurs
*/
@Beta
public static void skipFully(Reader reader, long n) throws IOException {
checkNotNull(reader);
while (n > 0) {
Expand All @@ -270,6 +273,7 @@ public static void skipFully(Reader reader, long n) throws IOException {
*
* @since 15.0
*/
@Beta
public static Writer nullWriter() {
return NullWriter.INSTANCE;
}
Expand Down Expand Up @@ -338,6 +342,7 @@ public String toString() {
* @param target the object to which output will be sent
* @return a new Writer object, unless target is a Writer, in which case the target is returned
*/
@Beta
public static Writer asWriter(Appendable target) {
if (target instanceof Writer) {
return (Writer) target;
Expand Down

0 comments on commit 068cb90

Please sign in to comment.