Commit c71e090
KGP - Fix flaky tests invoking javac through JDK APIs
Tests invoking javac APIs were flaky because ClasspathAnalyzerTest
was using Gradle's ProjectBuilder, which appends tools.jar to
the system class loader. Other tests do not do that, and they
invoke javac APIs directly.
In some executions, this causes some javac classes to be loaded
from the system class loader (the one patched by Gradle), while
some of them will be loaded by UrlClassLoader which points to tools.jar
in java.home. Having javac classes from different class loaders causes
java.lang.IllegalAccessError as package private access across class loaders
is not allowed. https://bugs.openjdk.java.net/browse/JDK-8068152 has more
information on this issue.
This change fixes the issue by fully removing usage of ProjectBuilder.
Test: ClasspathAnalyzerTest1 parent 73120b9 commit c71e090
File tree
2 files changed
+8
-27
lines changed- libraries/tools/kotlin-gradle-plugin/src
- main/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/incremental
- test/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/incremental
2 files changed
+8
-27
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 7 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 9 | | |
14 | 10 | | |
15 | 11 | | |
| |||
39 | 35 | | |
40 | 36 | | |
41 | 37 | | |
42 | | - | |
| 38 | + | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
| |||
75 | 71 | | |
76 | 72 | | |
77 | 73 | | |
78 | | - | |
| 74 | + | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
| |||
101 | 97 | | |
102 | 98 | | |
103 | 99 | | |
104 | | - | |
| 100 | + | |
105 | 101 | | |
106 | 102 | | |
107 | 103 | | |
| |||
115 | 111 | | |
116 | 112 | | |
117 | 113 | | |
118 | | - | |
| 114 | + | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
123 | 119 | | |
124 | 120 | | |
125 | | - | |
126 | 121 | | |
127 | | - | |
128 | | - | |
| 122 | + | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
| |||
149 | 143 | | |
150 | 144 | | |
151 | 145 | | |
152 | | - | |
153 | 146 | | |
154 | | - | |
155 | | - | |
| 147 | + | |
156 | 148 | | |
157 | 149 | | |
158 | 150 | | |
| |||
166 | 158 | | |
167 | 159 | | |
168 | 160 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 161 | | |
181 | 162 | | |
182 | 163 | | |
| |||
192 | 173 | | |
193 | 174 | | |
194 | 175 | | |
195 | | - | |
| 176 | + | |
0 commit comments