A way to remove debug code?

I work on a pretty big project on android client of a service and I am looking for a solution of removal of debug information for years and can’t find a good one except hack:

 class SomeClass(val someProperty: Int) {
     override fun toString(): String {
              if(BuildConfig.DEBUG) {
                      return "SomeClass: $someProperty"
              }
              return super.toString()
     }
}

This is the only current solution to remove debug code I found but I want to achieve next code:

 class SomeClass(val someProperty: Int) {
     @DebugOnly
     override fun toString(): String {
              return "SomeClass: $someProperty"
     }
 }

This code must be equal to the first one or even better(full removal of toString() method from class). Is it possible? I started to read about annotation processors but for now I doubt it is viable because of this method is literrally everywhere in 20k+ classes and if I somehow figure out how to do it with annotation processor, compilation times will be near to ethernity. So I think it needs to be done as compiler plugin for a performant solution? But afaik compiler plugin development is not open - so I guess it can be feature request for android extensions?