Commit 052407b
Serialization Test fixes for JDK 21.
ImmutableMapCodecTest - was using getCanonicalName to retrieve the name
of an anonymous inner class and was getting null, as is the defined
behavior for anonymous inner classes. Switching to getName fixes the test,
which makes it consistent with production code anyway.
MethodCodecTest - this seems like weird JDK21 behavior. Looking up methods
returned by Class.getMethods against the declaring classes does not return
the same method. In this case, in particular, String.class.getMethods includes
java.lang.String.resolveConstantDesc(java.lang.invoke.MethodHandles$Lookup)
throws java.lang.ReflectiveOperationException
which is the method signature according to the ConstantDesc interface. Adding
to the strangeness, calling getDeclaringClass returns String instead of
ConstantDesc.
However, looking up the method with String.class.getDeclaredMethod by name and
parameters, results in
java.lang.String.resolveConstantDesc(java.lang.invoke.MethodHandles$Lookup)
which drops the ReflectiveOperationException. This is actually the proper
signature for strings. This difference shouldn't really matter for
serialization correctness as long as both Method objects are invokable.
Changing the test to serialize the result of looking up via getDeclaredMethod
instead of getMethods fixes it.
PiperOrigin-RevId: 514686339
Change-Id: I1eecae589858fc9296fedee49f810d56720d6ab21 parent b6fc2d9 commit 052407b
File tree
2 files changed
+13
-7
lines changed- src/test/java/com/google/devtools/build/lib/skyframe/serialization
2 files changed
+13
-7
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
0 commit comments