Skip to content

Commit 36b46c2

Browse files
committed
fix!: remove extraneous thrown exception for Java major version bump
1 parent 9432979 commit 36b46c2

39 files changed

Lines changed: 36 additions & 77 deletions

File tree

src/main/java/com/google/api/generator/gapic/composer/comment/SettingsCommentComposer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import com.google.api.generator.engine.ast.CommentStatement;
1818
import com.google.api.generator.engine.ast.JavaDocComment;
19-
import com.google.api.generator.engine.ast.LineComment;
2019
import com.google.api.generator.engine.ast.TypeNode;
2120
import com.google.api.generator.gapic.utils.JavaStyle;
2221
import com.google.common.base.Preconditions;
@@ -80,7 +79,6 @@ public class SettingsCommentComposer {
8079

8180
public static final List<CommentStatement> APPLY_TO_ALL_UNARY_METHODS_METHOD_COMMENTS =
8281
Arrays.asList(
83-
LineComment.withComment("NEXT_MAJOR_VER: remove 'throws Exception'."),
8482
JavaDocComment.builder()
8583
.addComment(
8684
"Applies the given settings updater function to all of the unary API methods"

src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceSettingsClassComposer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,6 @@ private static MethodDefinition createNestedBuilderApplyToAllUnaryMethod(
648648
.setReturnType(builderType)
649649
.setName(javaMethodName)
650650
.setArguments(Arrays.asList(settingsUpdaterVarExpr.toBuilder().setIsDecl(true).build()))
651-
.setThrowsExceptions(
652-
Arrays.asList(TypeNode.withReference(ConcreteReference.withClazz(Exception.class))))
653651
.setBody(Arrays.asList(ExprStatement.withExpr(applyMethodExpr)))
654652
.setReturnExpr(ValueExpr.withValue(ThisObjectValue.withType(builderType)))
655653
.build();

src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceStubSettingsClassComposer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,6 @@ private static MethodDefinition createNestedClassApplyToAllUnaryMethodsMethod(
17221722
.setReturnType(returnType)
17231723
.setName(methodName)
17241724
.setArguments(settingsUpdaterVarExpr.toBuilder().setIsDecl(true).build())
1725-
.setThrowsExceptions(Arrays.asList(TypeNode.withExceptionClazz(Exception.class)))
17261725
.setBody(Arrays.asList(ExprStatement.withExpr(superApplyExpr)))
17271726
.setReturnExpr(returnExpr)
17281727
.build();

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,13 @@ public class DeprecatedServiceSettings extends ClientSettings<DeprecatedServiceS
155155
return ((DeprecatedServiceStubSettings.Builder) getStubSettings());
156156
}
157157

158-
// NEXT_MAJOR_VER: remove 'throws Exception'.
159158
/**
160159
* Applies the given settings updater function to all of the unary API methods in this service.
161160
*
162161
* <p>Note: This method does not support applying settings to streaming methods.
163162
*/
164163
public Builder applyToAllUnaryMethods(
165-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
164+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
166165
super.applyToAllUnaryMethods(
167166
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
168167
return this;

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/DeprecatedServiceStubSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,13 @@ public class DeprecatedServiceStubSettings extends StubSettings<DeprecatedServic
250250
return builder;
251251
}
252252

253-
// NEXT_MAJOR_VER: remove 'throws Exception'.
254253
/**
255254
* Applies the given settings updater function to all of the unary API methods in this service.
256255
*
257256
* <p>Note: This method does not support applying settings to streaming methods.
258257
*/
259258
public Builder applyToAllUnaryMethods(
260-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
259+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
261260
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
262261
return this;
263262
}

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,13 @@ public class EchoSettings extends ClientSettings<EchoSettings> {
200200
return ((EchoStubSettings.Builder) getStubSettings());
201201
}
202202

203-
// NEXT_MAJOR_VER: remove 'throws Exception'.
204203
/**
205204
* Applies the given settings updater function to all of the unary API methods in this service.
206205
*
207206
* <p>Note: This method does not support applying settings to streaming methods.
208207
*/
209208
public Builder applyToAllUnaryMethods(
210-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
209+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
211210
super.applyToAllUnaryMethods(
212211
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
213212
return this;

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/EchoStubSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,13 @@ public class EchoStubSettings extends StubSettings<EchoStubSettings> {
547547
return builder;
548548
}
549549

550-
// NEXT_MAJOR_VER: remove 'throws Exception'.
551550
/**
552551
* Applies the given settings updater function to all of the unary API methods in this service.
553552
*
554553
* <p>Note: This method does not support applying settings to streaming methods.
555554
*/
556555
public Builder applyToAllUnaryMethods(
557-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
556+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
558557
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
559558
return this;
560559
}

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/LoggingServiceV2StubSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,14 +666,13 @@ public class LoggingServiceV2StubSettings extends StubSettings<LoggingServiceV2S
666666
return builder;
667667
}
668668

669-
// NEXT_MAJOR_VER: remove 'throws Exception'.
670669
/**
671670
* Applies the given settings updater function to all of the unary API methods in this service.
672671
*
673672
* <p>Note: This method does not support applying settings to streaming methods.
674673
*/
675674
public Builder applyToAllUnaryMethods(
676-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
675+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
677676
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
678677
return this;
679678
}

src/test/java/com/google/api/generator/gapic/composer/grpc/goldens/PublisherStubSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,13 @@ public class PublisherStubSettings extends StubSettings<PublisherStubSettings> {
724724
return builder;
725725
}
726726

727-
// NEXT_MAJOR_VER: remove 'throws Exception'.
728727
/**
729728
* Applies the given settings updater function to all of the unary API methods in this service.
730729
*
731730
* <p>Note: This method does not support applying settings to streaming methods.
732731
*/
733732
public Builder applyToAllUnaryMethods(
734-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
733+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
735734
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
736735
return this;
737736
}

src/test/java/com/google/api/generator/gapic/composer/rest/goldens/ComplianceSettings.golden

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,13 @@ public class ComplianceSettings extends ClientSettings<ComplianceSettings> {
166166
return ((ComplianceStubSettings.Builder) getStubSettings());
167167
}
168168

169-
// NEXT_MAJOR_VER: remove 'throws Exception'.
170169
/**
171170
* Applies the given settings updater function to all of the unary API methods in this service.
172171
*
173172
* <p>Note: This method does not support applying settings to streaming methods.
174173
*/
175174
public Builder applyToAllUnaryMethods(
176-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
175+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
177176
super.applyToAllUnaryMethods(
178177
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
179178
return this;

0 commit comments

Comments
 (0)