Commit df07d4f
Adds a test for JDK-827271 (#9650)
* Ignore java.lang.Object methods (identified by method name plus method descriptor) when creating muzzle references.
This helps when compiling with Java 18+ because javac will now use INVOKEINTERFACE with the interface name to call
java.lang.Object methods (so the 'owner' is now seen as the interface) whereas before it was using INVOKEVIRTUAL
with java.lang.Object as the method 'owner'.
the key change is described in https://bugs.openjdk.org/browse/JDK-8272715:
"invocations of java.lang.Object methods on interfaces in the classfile will use invokeinterface referring
to the interface, which is consistent with JLS 9.2. This will be done regardless of whether the interface
declares the method explicitly or not."
* chore: Adds a test for JDK-827271
After JDK 18/19 javac compiles differently `Object` methods, while there is a ignore mechanism on java.* packages
after the key change is described in https://bugs.openjdk.org/browse/JDK-827271, `Object`'s methods
are applied to interfaces which may belong to another package.
Key change of JDK-827271
"invocations of `java.lang.Object` methods on interfaces in the classfile will use `invokeinterface` referring
to the interface, which is consistent with JLS 9.2. This will be done regardless of whether the interface
declares the method explicitly or not."
---------
Co-authored-by: Stuart McCulloch <stuart.mcculloch@datadoghq.com>1 parent af7ff80 commit df07d4f
File tree
3 files changed
+56
-18
lines changed- dd-java-agent/agent-tooling
- src/test
- groovy/datadog/trace/agent/tooling/muzzle
- java21/datadog/trace/agent/tooling/muzzle
3 files changed
+56
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
26 | | - | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | | - | |
71 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
90 | 99 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
56 | 73 | | |
57 | 74 | | |
58 | 75 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments