Skip to content

Commit 5cbbbae

Browse files
authored
Remove deprecated methods and corresponding tests (#1678)
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.
1 parent 4283033 commit 5cbbbae

File tree

284 files changed

+224
-10604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+224
-10604
lines changed

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Acl.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ public enum Type {
8080
this.type = type;
8181
}
8282

83-
@Deprecated
84-
public Type type() {
85-
return getType();
86-
}
8783

8884
public Type getType() {
8985
return type;
@@ -131,13 +127,6 @@ public Domain(String domain) {
131127
this.domain = domain;
132128
}
133129

134-
/**
135-
* Returns the domain name.
136-
*/
137-
@Deprecated
138-
public String domain() {
139-
return getDomain();
140-
}
141130

142131
/**
143132
* Returns the domain name.
@@ -201,15 +190,6 @@ public Group(String identifier) {
201190
this.identifier = identifier;
202191
}
203192

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

214194
/**
215195
* Returns group's identifier, can be either a
@@ -306,13 +286,6 @@ public User(String email) {
306286
this.email = email;
307287
}
308288

309-
/**
310-
* Returns user's email.
311-
*/
312-
@Deprecated
313-
public String email() {
314-
return getEmail();
315-
}
316289

317290
/**
318291
* Returns user's email.
@@ -369,13 +342,6 @@ public View(TableId id) {
369342
this.id = id;
370343
}
371344

372-
/**
373-
* Returns table's identity.
374-
*/
375-
@Deprecated
376-
public TableId id() {
377-
return getId();
378-
}
379345

380346
/**
381347
* Returns table's identity.
@@ -417,13 +383,6 @@ private Acl(Entity entity, Role role) {
417383
this.role = role;
418384
}
419385

420-
/**
421-
* Returns the entity for this ACL.
422-
*/
423-
@Deprecated
424-
public Entity entity() {
425-
return getEntity();
426-
}
427386

428387
/**
429388
* Returns the entity for this ACL.
@@ -432,13 +391,6 @@ public Entity getEntity() {
432391
return entity;
433392
}
434393

435-
/**
436-
* Returns the role specified by this ACL.
437-
*/
438-
@Deprecated
439-
public Role role() {
440-
return getRole();
441-
}
442394

443395
/**
444396
* Returns the role specified by this ACL.

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ enum DatasetField implements FieldSelector {
6464
this.selector = selector;
6565
}
6666

67-
@Override
68-
@Deprecated
69-
public String selector() {
70-
return getSelector();
71-
}
7267

7368
@Override
7469
public String getSelector() {
@@ -111,11 +106,6 @@ enum TableField implements FieldSelector {
111106
this.selector = selector;
112107
}
113108

114-
@Override
115-
@Deprecated
116-
public String selector() {
117-
return getSelector();
118-
}
119109

120110
@Override
121111
public String getSelector() {
@@ -148,11 +138,6 @@ enum JobField implements FieldSelector {
148138
this.selector = selector;
149139
}
150140

151-
@Override
152-
@Deprecated
153-
public String selector() {
154-
return getSelector();
155-
}
156141

157142
@Override
158143
public String getSelector() {
@@ -207,7 +192,7 @@ private DatasetOption(BigQueryRpc.Option option, Object value) {
207192
/**
208193
* Returns an option to specify the dataset's fields to be returned by the RPC call. If this
209194
* option is not provided all dataset's fields are returned. {@code DatasetOption.fields} can
210-
* be used to specify only the fields of interest. {@link Dataset#datasetId()} is always
195+
* be used to specify only the fields of interest. {@link Dataset#getDatasetId()} is always
211196
* returned, even if not specified.
212197
*/
213198
public static DatasetOption fields(DatasetField... fields) {
@@ -277,8 +262,8 @@ private TableOption(BigQueryRpc.Option option, Object value) {
277262
/**
278263
* Returns an option to specify the table's fields to be returned by the RPC call. If this
279264
* option is not provided all table's fields are returned. {@code TableOption.fields} can be
280-
* used to specify only the fields of interest. {@link Table#tableId()} and type (which is part
281-
* of {@link Table#definition()}) are always returned, even if not specified.
265+
* used to specify only the fields of interest. {@link Table#getTableId()} and type (which is part
266+
* of {@link Table#getDefinition()}) are always returned, even if not specified.
282267
*/
283268
public static TableOption fields(TableField... fields) {
284269
return new TableOption(BigQueryRpc.Option.FIELDS,
@@ -372,9 +357,9 @@ public static JobListOption pageToken(String pageToken) {
372357
/**
373358
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
374359
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
375-
* specify only the fields of interest. {@link Job#jobId()}, {@link JobStatus#state()},
376-
* {@link JobStatus#error()} as well as type-specific configuration (e.g.
377-
* {@link QueryJobConfiguration#query()} for Query Jobs) are always returned, even if not
360+
* specify only the fields of interest. {@link Job#getJobId()}, {@link JobStatus#getState()},
361+
* {@link JobStatus#getError()} as well as type-specific configuration (e.g.
362+
* {@link QueryJobConfiguration#getQuery()} for Query Jobs) are always returned, even if not
378363
* specified. {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when
379364
* listing jobs.
380365
*/
@@ -398,8 +383,8 @@ private JobOption(BigQueryRpc.Option option, Object value) {
398383
/**
399384
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
400385
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
401-
* specify only the fields of interest. {@link Job#jobId()} as well as type-specific
402-
* configuration (e.g. {@link QueryJobConfiguration#query()} for Query Jobs) are always
386+
* specify only the fields of interest. {@link Job#getJobId()} as well as type-specific
387+
* configuration (e.g. {@link QueryJobConfiguration#getQuery()} for Query Jobs) are always
403388
* returned, even if not specified.
404389
*/
405390
public static JobOption fields(JobField... fields) {
@@ -468,7 +453,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
468453
* } catch (BigQueryException e) {
469454
* // the dataset was not created
470455
* }
471-
* }</pre>
456+
* } </pre>
472457
*
473458
* @throws BigQueryException upon failure
474459
*/
@@ -546,8 +531,8 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
546531

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

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

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

757742
/**
758743
* Lists the tables in the dataset. This method returns partial information on each table:
759-
* ({@link Table#tableId()}, {@link Table#friendlyName()}, {@link Table#generatedId()} and type,
760-
* which is part of {@link Table#definition()}). To get complete information use either
744+
* ({@link Table#getTableId()}, {@link Table#getFriendlyName()}, {@link Table#getGeneratedId()}
745+
* and type, which is part of {@link Table#getDefinition()}). To get complete information use either
761746
* {@link #getTable(TableId, TableOption...)} or
762747
* {@link #getTable(String, String, TableOption...)}.
763748
*

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryError.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
/**
2727
* Google Cloud BigQuery Error. Objects of this class represent errors encountered by the BigQuery
2828
* service while executing a request. A BigQuery Job that terminated with an error has a non-null
29-
* {@link JobStatus#error()}. A job can also encounter errors during its execution that do not cause
30-
* the whole job to fail (see {@link JobStatus#executionErrors()}). Similarly, queries and insert
31-
* all requests can cause BigQuery errors that do not mean the whole operation failed (see
32-
* {@link QueryResponse#executionErrors()} and {@link InsertAllResponse#insertErrors()}). When a
33-
* {@link BigQueryException} is thrown the BigQuery Error that caused it, if any, can be accessed
34-
* with {@link BigQueryException#error()}.
29+
* {@link JobStatus#getError()}. A job can also encounter errors during its execution that do not
30+
* cause the whole job to fail (see {@link JobStatus#getExecutionErrors()}). Similarly, queries and
31+
* insert all requests can cause BigQuery errors that do not mean the whole operation failed (see
32+
* {@link QueryResponse#getExecutionErrors()} and {@link InsertAllResponse#getInsertErrors()}).
33+
* When a {@link BigQueryException} is thrown the BigQuery Error that caused it, if any, can be
34+
* accessed with {@link BigQueryException#getError()}.
3535
*/
3636
public final class BigQueryError implements Serializable {
3737

@@ -70,16 +70,6 @@ public BigQueryError(String reason, String location, String message) {
7070
this.debugInfo = null;
7171
}
7272

73-
/**
74-
* Returns short error code that summarizes the error.
75-
*
76-
* @see <a href="https://cloud.google.com/bigquery/troubleshooting-errors">Troubleshooting
77-
* Errors</a>
78-
*/
79-
@Deprecated
80-
public String reason() {
81-
return getReason();
82-
}
8373

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

94-
/**
95-
* Returns where the error occurred, if present.
96-
*/
97-
@Deprecated
98-
public String location() {
99-
return getLocation();
100-
}
10184

10285
/**
10386
* Returns where the error occurred, if present.
@@ -110,13 +93,6 @@ String getDebugInfo() {
11093
return debugInfo;
11194
}
11295

113-
/**
114-
* Returns a human-readable description of the error.
115-
*/
116-
@Deprecated
117-
public String message() {
118-
return getMessage();
119-
}
12096

12197
/**
12298
* Returns a human-readable description of the error.

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryException.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ public BigQueryException(IOException exception) {
6666
this.error = error;
6767
}
6868

69-
/**
70-
* Returns the {@link BigQueryError} that caused this exception. Returns {@code null} if none
71-
* exists.
72-
*/
73-
@Deprecated
74-
public BigQueryError error() {
75-
return getError();
76-
}
7769

7870
/**
7971
* Returns the {@link BigQueryError} that caused this exception. Returns {@code null} if none

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ private static class DatasetPageFetcher implements NextPageFetcher<Dataset> {
5858
this.serviceOptions = serviceOptions;
5959
}
6060

61-
@Override
62-
@Deprecated
63-
public Page<Dataset> nextPage() {
64-
return getNextPage();
65-
}
6661

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

88-
@Override
89-
@Deprecated
90-
public Page<Table> nextPage() {
91-
return getNextPage();
92-
}
9383

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

113-
@Override
114-
@Deprecated
115-
public Page<Job> nextPage() {
116-
return getNextPage();
117-
}
118103

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

140-
@Override
141-
@Deprecated
142-
public Page<List<FieldValue>> nextPage() {
143-
return getNextPage();
144-
}
145125

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

168-
@Override
169-
@Deprecated
170-
public QueryResult nextPage() {
171-
return getNextPage();
172-
}
173148

174149
@Override
175150
public QueryResult getNextPage() {

google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryOptions.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,11 @@ public boolean equals(Object obj) {
105105
return baseEquals(other);
106106
}
107107

108-
@Deprecated
109-
public static BigQueryOptions defaultInstance() {
110-
return getDefaultInstance();
111-
}
112108

113109
public static BigQueryOptions getDefaultInstance() {
114110
return newBuilder().build();
115111
}
116112

117-
@Deprecated
118-
public static Builder builder() {
119-
return newBuilder();
120-
}
121113

122114
public static Builder newBuilder() {
123115
return new Builder();

0 commit comments

Comments
 (0)