Make `FinalizableReferenceQueue` more friendly to optimizers.
This includes two changes:
First, don't conservatively verify that `finalizableReferenceClass` has the exact class name of `FinalizableReference`. Naturally, that verification fails if the class gets renamed. (The verification dates all the way back to the creation of `Finalizer` in cl/8884367.)
Second, use `-keepclassmembernames` instead of `-keepnames` so that optimizers are allowed to rename `FinalizableReferenceQueue` and `Finalizer` (though still not their _methods_).
(It's possible that `-keepclassmembernames` didn't even exist back when cl/170888502 added the current rules.)
Based on our existing comments and on my testing, I believe that optimizers are smart enough to update our reflective references when they rename those classes. My current experiments actually suggest (contrary to the comments) that at least our internal optimizer is smart enough even to preserve the names of the methods even without `-keepclassmembernames`. However, that feels scarier to depend on, so I'm proposing to include `-keepclassmembernames`, the minimal change from `-keepnames` necessary to solve the issue I'm attacking.
That issue: Our depot has one test that appears to be checking that its optimization step also performs shading/relocating of packages: It doesn't want to bundle "`com.google.common.*`," so it needs to be able to "rename out" any classes that it uses from those packages. It's able to do that for the classes that it uses _currently_, but when I change `ClosingFuture` to use `FinalizableReferenceQueue` in cl/875703235, it would have trouble. This CL avoids that.
Before (with a simple local test):
```
#8 : (in Lcom/google/common/base/internal/Finalizer;)
name : 'startFinalizer'
```
After (again, with a simple local test; the test that we care about does seem to be able to move the classes out of `com.google.common` entirely):
```
#8 : (in Lcom/google/common/base/a/a;)
name : 'startFinalizer'
```
RELNOTES=n/a
PiperOrigin-RevId: 878455150 C
cpovirk committed
9744861cb9b985bb832b81da91233b423b812276
Parent: 905dbc6
Committed by Google Java Core Libraries <jake-team+copybara@google.com>
on 3/4/2026, 2:19:16 PM