Skip to content

Commit

Permalink
Remove deprecated methods and corresponding tests (#1678)
Browse files Browse the repository at this point in the history
Remove deprecated methods and its references in one pass by a self-made script, with a few exceptions:
- There are still plenty of manual work involved to update usages of deprecated methods and fields
- Manual corrections due to misspell of the word "deprecated"
- google-cloud-pubsub: Pubsub has a few deprecated packages and it affects its integrated tests as well. Removing deprecated packages is not in the scope of this PR.
- google-cloud-compute: Compute engine has a few "Deprecated" related service which causes lots of noise of the automated script. 
- google-cloud-datastore
  - In `ValueBuilder` `getExcludeFromIndexes` was marked as deprecated which is inconsistent with other getter/setter methods
  - Preserved the fields `meaning` in `ValueBuilder` since it is still wide used in the code. May require a separate PR to deprecate.
  • Loading branch information
shinfan authored Mar 7, 2017
1 parent 4283033 commit 5cbbbae
Show file tree
Hide file tree
Showing 284 changed files with 224 additions and 10,604 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ public enum Type {
this.type = type;
}

@Deprecated
public Type type() {
return getType();
}

public Type getType() {
return type;
Expand Down Expand Up @@ -131,13 +127,6 @@ public Domain(String domain) {
this.domain = domain;
}

/**
* Returns the domain name.
*/
@Deprecated
public String domain() {
return getDomain();
}

/**
* Returns the domain name.
Expand Down Expand Up @@ -201,15 +190,6 @@ public Group(String identifier) {
this.identifier = identifier;
}

/**
* Returns group's identifier, can be either a
* <a href="https://cloud.google.com/bigquery/docs/reference/v2/datasets#access.specialGroup">
* special group identifier</a> or a group email.
*/
@Deprecated
public String identifier() {
return getIdentifier();
}

/**
* Returns group's identifier, can be either a
Expand Down Expand Up @@ -306,13 +286,6 @@ public User(String email) {
this.email = email;
}

/**
* Returns user's email.
*/
@Deprecated
public String email() {
return getEmail();
}

/**
* Returns user's email.
Expand Down Expand Up @@ -369,13 +342,6 @@ public View(TableId id) {
this.id = id;
}

/**
* Returns table's identity.
*/
@Deprecated
public TableId id() {
return getId();
}

/**
* Returns table's identity.
Expand Down Expand Up @@ -417,13 +383,6 @@ private Acl(Entity entity, Role role) {
this.role = role;
}

/**
* Returns the entity for this ACL.
*/
@Deprecated
public Entity entity() {
return getEntity();
}

/**
* Returns the entity for this ACL.
Expand All @@ -432,13 +391,6 @@ public Entity getEntity() {
return entity;
}

/**
* Returns the role specified by this ACL.
*/
@Deprecated
public Role role() {
return getRole();
}

/**
* Returns the role specified by this ACL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ enum DatasetField implements FieldSelector {
this.selector = selector;
}

@Override
@Deprecated
public String selector() {
return getSelector();
}

@Override
public String getSelector() {
Expand Down Expand Up @@ -111,11 +106,6 @@ enum TableField implements FieldSelector {
this.selector = selector;
}

@Override
@Deprecated
public String selector() {
return getSelector();
}

@Override
public String getSelector() {
Expand Down Expand Up @@ -148,11 +138,6 @@ enum JobField implements FieldSelector {
this.selector = selector;
}

@Override
@Deprecated
public String selector() {
return getSelector();
}

@Override
public String getSelector() {
Expand Down Expand Up @@ -207,7 +192,7 @@ private DatasetOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the dataset's fields to be returned by the RPC call. If this
* option is not provided all dataset's fields are returned. {@code DatasetOption.fields} can
* be used to specify only the fields of interest. {@link Dataset#datasetId()} is always
* be used to specify only the fields of interest. {@link Dataset#getDatasetId()} is always
* returned, even if not specified.
*/
public static DatasetOption fields(DatasetField... fields) {
Expand Down Expand Up @@ -277,8 +262,8 @@ private TableOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the table's fields to be returned by the RPC call. If this
* option is not provided all table's fields are returned. {@code TableOption.fields} can be
* used to specify only the fields of interest. {@link Table#tableId()} and type (which is part
* of {@link Table#definition()}) are always returned, even if not specified.
* used to specify only the fields of interest. {@link Table#getTableId()} and type (which is part
* of {@link Table#getDefinition()}) are always returned, even if not specified.
*/
public static TableOption fields(TableField... fields) {
return new TableOption(BigQueryRpc.Option.FIELDS,
Expand Down Expand Up @@ -372,9 +357,9 @@ public static JobListOption pageToken(String pageToken) {
/**
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
* specify only the fields of interest. {@link Job#jobId()}, {@link JobStatus#state()},
* {@link JobStatus#error()} as well as type-specific configuration (e.g.
* {@link QueryJobConfiguration#query()} for Query Jobs) are always returned, even if not
* specify only the fields of interest. {@link Job#getJobId()}, {@link JobStatus#getState()},
* {@link JobStatus#getError()} as well as type-specific configuration (e.g.
* {@link QueryJobConfiguration#getQuery()} for Query Jobs) are always returned, even if not
* specified. {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when
* listing jobs.
*/
Expand All @@ -398,8 +383,8 @@ private JobOption(BigQueryRpc.Option option, Object value) {
/**
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
* specify only the fields of interest. {@link Job#jobId()} as well as type-specific
* configuration (e.g. {@link QueryJobConfiguration#query()} for Query Jobs) are always
* specify only the fields of interest. {@link Job#getJobId()} as well as type-specific
* configuration (e.g. {@link QueryJobConfiguration#getQuery()} for Query Jobs) are always
* returned, even if not specified.
*/
public static JobOption fields(JobField... fields) {
Expand Down Expand Up @@ -468,7 +453,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
* } catch (BigQueryException e) {
* // the dataset was not created
* }
* }</pre>
* } </pre>
*
* @throws BigQueryException upon failure
*/
Expand Down Expand Up @@ -546,8 +531,8 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {

/**
* Lists the project's datasets. This method returns partial information on each dataset:
* ({@link Dataset#datasetId()}, {@link Dataset#friendlyName()} and
* {@link Dataset#generatedId()}). To get complete information use either
* ({@link Dataset#getDatasetId()}, {@link Dataset#getFriendlyName()} and
* {@link Dataset#getGeneratedId()}). To get complete information use either
* {@link #getDataset(String, DatasetOption...)} or
* {@link #getDataset(DatasetId, DatasetOption...)}.
*
Expand All @@ -567,8 +552,8 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {

/**
* Lists the datasets in the provided project. This method returns partial information on each
* dataset: ({@link Dataset#datasetId()}, {@link Dataset#friendlyName()} and
* {@link Dataset#generatedId()}). To get complete information use either
* dataset: ({@link Dataset#getDatasetId()}, {@link Dataset#getFriendlyName()} and
* {@link Dataset#getGeneratedId()}). To get complete information use either
* {@link #getDataset(String, DatasetOption...)} or
* {@link #getDataset(DatasetId, DatasetOption...)}.
*
Expand Down Expand Up @@ -734,8 +719,8 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {

/**
* Lists the tables in the dataset. This method returns partial information on each table:
* ({@link Table#tableId()}, {@link Table#friendlyName()}, {@link Table#generatedId()} and type,
* which is part of {@link Table#definition()}). To get complete information use either
* ({@link Table#getTableId()}, {@link Table#getFriendlyName()}, {@link Table#getGeneratedId()} and type,
* which is part of {@link Table#getDefinition()}). To get complete information use either
* {@link #getTable(TableId, TableOption...)} or
* {@link #getTable(String, String, TableOption...)}.
*
Expand All @@ -756,8 +741,8 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {

/**
* Lists the tables in the dataset. This method returns partial information on each table:
* ({@link Table#tableId()}, {@link Table#friendlyName()}, {@link Table#generatedId()} and type,
* which is part of {@link Table#definition()}). To get complete information use either
* ({@link Table#getTableId()}, {@link Table#getFriendlyName()}, {@link Table#getGeneratedId()}
* and type, which is part of {@link Table#getDefinition()}). To get complete information use either
* {@link #getTable(TableId, TableOption...)} or
* {@link #getTable(String, String, TableOption...)}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
/**
* Google Cloud BigQuery Error. Objects of this class represent errors encountered by the BigQuery
* service while executing a request. A BigQuery Job that terminated with an error has a non-null
* {@link JobStatus#error()}. A job can also encounter errors during its execution that do not cause
* the whole job to fail (see {@link JobStatus#executionErrors()}). Similarly, queries and insert
* all requests can cause BigQuery errors that do not mean the whole operation failed (see
* {@link QueryResponse#executionErrors()} and {@link InsertAllResponse#insertErrors()}). When a
* {@link BigQueryException} is thrown the BigQuery Error that caused it, if any, can be accessed
* with {@link BigQueryException#error()}.
* {@link JobStatus#getError()}. A job can also encounter errors during its execution that do not
* cause the whole job to fail (see {@link JobStatus#getExecutionErrors()}). Similarly, queries and
* insert all requests can cause BigQuery errors that do not mean the whole operation failed (see
* {@link QueryResponse#getExecutionErrors()} and {@link InsertAllResponse#getInsertErrors()}).
* When a {@link BigQueryException} is thrown the BigQuery Error that caused it, if any, can be
* accessed with {@link BigQueryException#getError()}.
*/
public final class BigQueryError implements Serializable {

Expand Down Expand Up @@ -70,16 +70,6 @@ public BigQueryError(String reason, String location, String message) {
this.debugInfo = null;
}

/**
* Returns short error code that summarizes the error.
*
* @see <a href="https://cloud.google.com/bigquery/troubleshooting-errors">Troubleshooting
* Errors</a>
*/
@Deprecated
public String reason() {
return getReason();
}

/**
* Returns short error code that summarizes the error.
Expand All @@ -91,13 +81,6 @@ public String getReason() {
return reason;
}

/**
* Returns where the error occurred, if present.
*/
@Deprecated
public String location() {
return getLocation();
}

/**
* Returns where the error occurred, if present.
Expand All @@ -110,13 +93,6 @@ String getDebugInfo() {
return debugInfo;
}

/**
* Returns a human-readable description of the error.
*/
@Deprecated
public String message() {
return getMessage();
}

/**
* Returns a human-readable description of the error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ public BigQueryException(IOException exception) {
this.error = error;
}

/**
* Returns the {@link BigQueryError} that caused this exception. Returns {@code null} if none
* exists.
*/
@Deprecated
public BigQueryError error() {
return getError();
}

/**
* Returns the {@link BigQueryError} that caused this exception. Returns {@code null} if none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ private static class DatasetPageFetcher implements NextPageFetcher<Dataset> {
this.serviceOptions = serviceOptions;
}

@Override
@Deprecated
public Page<Dataset> nextPage() {
return getNextPage();
}

@Override
public Page<Dataset> getNextPage() {
Expand All @@ -85,11 +80,6 @@ private static class TablePageFetcher implements NextPageFetcher<Table> {
this.datasetId = datasetId;
}

@Override
@Deprecated
public Page<Table> nextPage() {
return getNextPage();
}

@Override
public Page<Table> getNextPage() {
Expand All @@ -110,11 +100,6 @@ private static class JobPageFetcher implements NextPageFetcher<Job> {
this.serviceOptions = serviceOptions;
}

@Override
@Deprecated
public Page<Job> nextPage() {
return getNextPage();
}

@Override
public Page<Job> getNextPage() {
Expand All @@ -137,11 +122,6 @@ private static class TableDataPageFetcher implements NextPageFetcher<List<FieldV
this.table = table;
}

@Override
@Deprecated
public Page<List<FieldValue>> nextPage() {
return getNextPage();
}

@Override
public Page<List<FieldValue>> getNextPage() {
Expand All @@ -165,11 +145,6 @@ private static class QueryResultsPageFetcherImpl
this.job = job;
}

@Override
@Deprecated
public QueryResult nextPage() {
return getNextPage();
}

@Override
public QueryResult getNextPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,11 @@ public boolean equals(Object obj) {
return baseEquals(other);
}

@Deprecated
public static BigQueryOptions defaultInstance() {
return getDefaultInstance();
}

public static BigQueryOptions getDefaultInstance() {
return newBuilder().build();
}

@Deprecated
public static Builder builder() {
return newBuilder();
}

public static Builder newBuilder() {
return new Builder();
Expand Down
Loading

0 comments on commit 5cbbbae

Please sign in to comment.