pw_rpc: Make service/method ID private in the Java APIs

Service and method IDs are internal to pw_rpc and should not be used
externally.

Change-Id: Ia286bb9bc4b23205c84ed3d82c52132d49d7e9c3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/97681
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/pw_rpc/java/main/dev/pigweed/pw_rpc/Client.java b/pw_rpc/java/main/dev/pigweed/pw_rpc/Client.java
index 95be4cf..f1383ff 100644
--- a/pw_rpc/java/main/dev/pigweed/pw_rpc/Client.java
+++ b/pw_rpc/java/main/dev/pigweed/pw_rpc/Client.java
@@ -134,12 +134,12 @@
       return method(channelId, serviceMethod.service().id(), serviceMethod.id());
     } catch (IllegalArgumentException e) {
       // Rethrow the exception with the service and method name instead of the ID.
-      throw new IllegalArgumentException("Unknown RPC " + serviceMethod.fullName());
+      throw new IllegalArgumentException("Unknown RPC " + serviceMethod.fullName(), e);
     }
   }
 
   /** Returns a MethodClient with the provided service and method IDs. */
-  public synchronized MethodClient method(int channelId, int serviceId, int methodId) {
+  synchronized MethodClient method(int channelId, int serviceId, int methodId) {
     Channel channel = channels.get(channelId);
     if (channel == null) {
       throw new IllegalArgumentException("Unknown channel ID " + channelId);
diff --git a/pw_rpc/java/main/dev/pigweed/pw_rpc/Method.java b/pw_rpc/java/main/dev/pigweed/pw_rpc/Method.java
index e32d955..ff80cbb 100644
--- a/pw_rpc/java/main/dev/pigweed/pw_rpc/Method.java
+++ b/pw_rpc/java/main/dev/pigweed/pw_rpc/Method.java
@@ -41,7 +41,7 @@
 
   public abstract Class<? extends MessageLite> response();
 
-  public final int id() {
+  final int id() {
     return Ids.calculate(name());
   }
 
diff --git a/pw_rpc/java/main/dev/pigweed/pw_rpc/Service.java b/pw_rpc/java/main/dev/pigweed/pw_rpc/Service.java
index 311ff6f..eeffd2a 100644
--- a/pw_rpc/java/main/dev/pigweed/pw_rpc/Service.java
+++ b/pw_rpc/java/main/dev/pigweed/pw_rpc/Service.java
@@ -38,7 +38,7 @@
     return name;
   }
 
-  public int id() {
+  int id() {
     return id;
   }