Skip to content

Commit

Permalink
Remove @Beta from most classes in com.google.common.reflect.
Browse files Browse the repository at this point in the history
Addresses #3051 (but doesn't remove `@Beta` from `Invokable`).

RELNOTES=`reflect`: Remove `@Beta` from most classes.
PiperOrigin-RevId: 416091958
  • Loading branch information
netdpb authored and Google Java Core Libraries committed Dec 16, 2021
1 parent 8eff3ed commit 6512408
Show file tree
Hide file tree
Showing 20 changed files with 12 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
Expand All @@ -39,7 +38,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractInvocationHandler implements InvocationHandler {

Expand Down
4 changes: 0 additions & 4 deletions android/guava/src/com/google/common/reflect/ClassPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR;
import static java.util.logging.Level.WARNING;

import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
Expand Down Expand Up @@ -91,7 +90,6 @@
* @author Ben Yu
* @since 14.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class ClassPath {
private static final Logger logger = Logger.getLogger(ClassPath.class.getName());
Expand Down Expand Up @@ -204,7 +202,6 @@ public ImmutableSet<ClassInfo> getTopLevelClassesRecursive(String packageName) {
*
* @since 14.0
*/
@Beta
public static class ResourceInfo {
private final File file;
private final String resourceName;
Expand Down Expand Up @@ -300,7 +297,6 @@ public String toString() {
*
* @since 14.0
*/
@Beta
public static final class ClassInfo extends ResourceInfo {
private final String className;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
Expand All @@ -29,7 +28,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
Expand Down Expand Up @@ -60,7 +58,6 @@ public static <B> Builder<B> builder() {
*
* @since 13.0
*/
@Beta
public static final class Builder<B> {
private final ImmutableMap.Builder<TypeToken<? extends B>, B> mapBuilder =
ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.Beta;
import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ForwardingMapEntry;
import com.google.common.collect.ForwardingSet;
Expand All @@ -39,7 +38,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
Expand Down
4 changes: 4 additions & 0 deletions android/guava/src/com/google/common/reflect/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
/**
* Represents a method or constructor parameter.
*
* <p><b>Note:</b> Since Java 8 introduced {@link java.lang.reflect.Parameter} to represent method
* and constructor parameters, this class is no longer necessary. We intend to deprecate it in a
* future version.
*
* @author Ben Yu
* @since 14.0
*/
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/reflect/Reflection.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.Beta;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

Expand All @@ -26,7 +25,6 @@
*
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class Reflection {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.google.common.base.Preconditions.checkArgument;

import com.google.common.annotations.Beta;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import javax.annotation.CheckForNull;
Expand All @@ -34,7 +33,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
/*
* A nullable bound would let users create a TypeParameter instance for a parameter with a nullable
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/reflect/TypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkState;
import static java.util.Arrays.asList;

import com.google.common.annotations.Beta;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -51,7 +50,6 @@
* @author Ben Yu
* @since 15.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class TypeResolver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.DoNotMock;
import java.util.Map;
Expand Down Expand Up @@ -42,7 +41,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap")
@ElementTypesAreNonnullByDefault
public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> {
Expand Down
3 changes: 2 additions & 1 deletion android/guava/src/com/google/common/reflect/TypeToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@SuppressWarnings("serial") // SimpleTypeToken is the serialized form.
@ElementTypesAreNonnullByDefault
public abstract class TypeToken<T> extends TypeCapture<T> implements Serializable {
Expand Down Expand Up @@ -591,6 +590,7 @@ public final TypeToken<?> getComponentType() {
*
* @since 14.0
*/
@Beta
public final Invokable<T, Object> method(Method method) {
checkArgument(
this.someRawTypeIsSubclassOf(method.getDeclaringClass()),
Expand Down Expand Up @@ -630,6 +630,7 @@ public String toString() {
*
* @since 14.0
*/
@Beta
public final Invokable<T, T> constructor(Constructor<?> constructor) {
checkArgument(
constructor.getDeclaringClass() == getRawType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
Expand All @@ -39,7 +38,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public abstract class AbstractInvocationHandler implements InvocationHandler {

Expand Down
4 changes: 0 additions & 4 deletions guava/src/com/google/common/reflect/ClassPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR;
import static java.util.logging.Level.WARNING;

import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
Expand Down Expand Up @@ -91,7 +90,6 @@
* @author Ben Yu
* @since 14.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class ClassPath {
private static final Logger logger = Logger.getLogger(ClassPath.class.getName());
Expand Down Expand Up @@ -204,7 +202,6 @@ public ImmutableSet<ClassInfo> getTopLevelClassesRecursive(String packageName) {
*
* @since 14.0
*/
@Beta
public static class ResourceInfo {
private final File file;
private final String resourceName;
Expand Down Expand Up @@ -300,7 +297,6 @@ public String toString() {
*
* @since 14.0
*/
@Beta
public static final class ClassInfo extends ResourceInfo {
private final String className;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
Expand All @@ -29,7 +28,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
Expand Down Expand Up @@ -60,7 +58,6 @@ public static <B> Builder<B> builder() {
*
* @since 13.0
*/
@Beta
public static final class Builder<B> {
private final ImmutableMap.Builder<TypeToken<? extends B>, B> mapBuilder =
ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.Beta;
import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ForwardingMapEntry;
import com.google.common.collect.ForwardingSet;
Expand All @@ -39,7 +38,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B>
implements TypeToInstanceMap<B> {
Expand Down
4 changes: 4 additions & 0 deletions guava/src/com/google/common/reflect/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
/**
* Represents a method or constructor parameter.
*
* <p><b>Note:</b> Since Java 8 introduced {@link java.lang.reflect.Parameter} to represent method
* and constructor parameters, this class is no longer necessary. We intend to deprecate it in a
* future version.
*
* @author Ben Yu
* @since 14.0
*/
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/reflect/Reflection.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.Beta;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

Expand All @@ -26,7 +25,6 @@
*
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class Reflection {

Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/reflect/TypeParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.google.common.base.Preconditions.checkArgument;

import com.google.common.annotations.Beta;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import javax.annotation.CheckForNull;
Expand All @@ -34,7 +33,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@ElementTypesAreNonnullByDefault
/*
* A nullable bound would let users create a TypeParameter instance for a parameter with a nullable
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/reflect/TypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkState;
import static java.util.Arrays.asList;

import com.google.common.annotations.Beta;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -51,7 +50,6 @@
* @author Ben Yu
* @since 15.0
*/
@Beta
@ElementTypesAreNonnullByDefault
public final class TypeResolver {

Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/reflect/TypeToInstanceMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package com.google.common.reflect;

import com.google.common.annotations.Beta;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.DoNotMock;
import java.util.Map;
Expand Down Expand Up @@ -42,7 +41,6 @@
* @author Ben Yu
* @since 13.0
*/
@Beta
@DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap")
@ElementTypesAreNonnullByDefault
public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> {
Expand Down
3 changes: 2 additions & 1 deletion guava/src/com/google/common/reflect/TypeToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
* @author Ben Yu
* @since 12.0
*/
@Beta
@SuppressWarnings("serial") // SimpleTypeToken is the serialized form.
@ElementTypesAreNonnullByDefault
public abstract class TypeToken<T> extends TypeCapture<T> implements Serializable {
Expand Down Expand Up @@ -591,6 +590,7 @@ public final TypeToken<?> getComponentType() {
*
* @since 14.0
*/
@Beta
public final Invokable<T, Object> method(Method method) {
checkArgument(
this.someRawTypeIsSubclassOf(method.getDeclaringClass()),
Expand Down Expand Up @@ -630,6 +630,7 @@ public String toString() {
*
* @since 14.0
*/
@Beta
public final Invokable<T, T> constructor(Constructor<?> constructor) {
checkArgument(
constructor.getDeclaringClass() == getRawType(),
Expand Down

0 comments on commit 6512408

Please sign in to comment.