Skip to content

Commit be0d7e9

Browse files
committed
Prevent construction of container classes and reduce API
1 parent e969a90 commit be0d7e9

File tree

13 files changed

+33
-7
lines changed

13 files changed

+33
-7
lines changed

auth/src/main/java/io/grpc/auth/ClientAuthInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* <p> Uses the new and simplified Google auth library:
5959
* https://github.com/google/google-auth-library-java
6060
*/
61-
public class ClientAuthInterceptor implements ClientInterceptor {
61+
public final class ClientAuthInterceptor implements ClientInterceptor {
6262

6363
private final Credentials credentials;
6464

benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class TestServiceGrpc {
1818

19+
private TestServiceGrpc() {}
20+
1921
public static final String SERVICE_NAME = "grpc.testing.TestService";
2022

2123
// Static method descriptors that strictly reflect the proto.

benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class WorkerGrpc {
1818

19+
private WorkerGrpc() {}
20+
1921
public static final String SERVICE_NAME = "grpc.testing.Worker";
2022

2123
// Static method descriptors that strictly reflect the proto.

compiler/src/java_plugin/cpp/java_generator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ static void PrintService(const ServiceDescriptor* service,
511511
"@$Generated$(\"by gRPC proto compiler\")\n"
512512
"public class $service_class_name$ {\n\n");
513513
p->Indent();
514+
p->Print(
515+
*vars,
516+
"private $service_class_name$() {}\n\n");
514517

515518
p->Print(
516519
*vars,

compiler/src/test/golden/TestService.java.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class TestServiceGrpc {
1818

19+
private TestServiceGrpc() {}
20+
1921
public static final String SERVICE_NAME = "grpc.testing.TestService";
2022

2123
// Static method descriptors that strictly reflect the proto.

compiler/src/test/golden/TestServiceNano.java.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import java.io.IOException;
1818
@javax.annotation.Generated("by gRPC proto compiler")
1919
public class TestServiceGrpc {
2020

21+
private TestServiceGrpc() {}
22+
2123
public static final String SERVICE_NAME = "grpc.testing.TestService";
2224

2325
// Static method descriptors that strictly reflect the proto.

examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class GreeterGrpc {
1818

19+
private GreeterGrpc() {}
20+
1921
public static final String SERVICE_NAME = "helloworld.Greeter";
2022

2123
// Static method descriptors that strictly reflect the proto.

examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class RouteGuideGrpc {
1818

19+
private RouteGuideGrpc() {}
20+
1921
public static final String SERVICE_NAME = "routeguide.RouteGuide";
2022

2123
// Static method descriptors that strictly reflect the proto.

interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class ReconnectServiceGrpc {
1818

19+
private ReconnectServiceGrpc() {}
20+
1921
public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
2022

2123
// Static method descriptors that strictly reflect the proto.

interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
@javax.annotation.Generated("by gRPC proto compiler")
1717
public class TestServiceGrpc {
1818

19+
private TestServiceGrpc() {}
20+
1921
public static final String SERVICE_NAME = "grpc.testing.TestService";
2022

2123
// Static method descriptors that strictly reflect the proto.

0 commit comments

Comments
 (0)