Adds a debug(...) method to IBase, the base class for all Treble interfaces

The default implementation does nothing but this allows implementations to
emit diagnostics to a given file handle in a unified fashion.

Bug: 33961528
Test: hidl_test, hidl_test_java
Change-Id: Id7e8417275934c73032c9832c41e041d2d5d2fb7
diff --git a/Method.cpp b/Method.cpp
index 476a10b..9d40856 100644
--- a/Method.cpp
+++ b/Method.cpp
@@ -89,6 +89,10 @@
     }
 }
 
+bool Method::isHiddenFromJava() const {
+    return isHidlReserved() && name() == "debug";
+}
+
 bool Method::overridesCppImpl(MethodImplType type) const {
     CHECK(mIsHidlReserved);
     return mCppImpl.find(type) != mCppImpl.end();
@@ -204,6 +208,10 @@
 }
 
 bool Method::isJavaCompatible() const {
+    if (isHiddenFromJava()) {
+        return true;
+    }
+
     for (const auto &arg : *mArgs) {
         if (!arg->isJavaCompatible()) {
             return false;