Commit cf62094
committed
Use a ClassLoader for locating resources
Before this change, the VirtualFileSystem was using a `Class` as a beacon
to find resources. I suppose that the intent was to use `Class#getResource`,
but in practice, it's always `clazz.getClassLoader().getResource()` which
is used, which makes it redundant to use a class. This commit refactors
the code to allow declaring which _classloader_ to use for loading. This
is important because in some cases, we don't necessarily have a `Class` to
pass, but we _do_ have a classloader. This should also allow more advanced
scenarios with filtering classloaders for example.
Since the `Class` was actually never directly used, but only its classloader,
this change should have 0 impact for backwards compatibility.1 parent f118f1b commit cf62094
File tree
2 files changed
+46
-28
lines changed- org.graalvm.python.embedding/src/main/java/org/graalvm/python/embedding
2 files changed
+46
-28
lines changedLines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
241 | | - | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | | - | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
256 | 272 | | |
257 | 273 | | |
258 | 274 | | |
| |||
292 | 308 | | |
293 | 309 | | |
294 | 310 | | |
295 | | - | |
| 311 | + | |
296 | 312 | | |
297 | 313 | | |
298 | 314 | | |
| |||
308 | 324 | | |
309 | 325 | | |
310 | 326 | | |
311 | | - | |
| 327 | + | |
312 | 328 | | |
313 | 329 | | |
314 | | - | |
| 330 | + | |
315 | 331 | | |
316 | 332 | | |
317 | 333 | | |
| |||
org.graalvm.python.embedding/src/main/java/org/graalvm/python/embedding/VirtualFileSystemImpl.java
Lines changed: 22 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
330 | 332 | | |
331 | 333 | | |
332 | 334 | | |
| |||
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
673 | | - | |
| 675 | + | |
674 | 676 | | |
675 | 677 | | |
676 | 678 | | |
| |||
746 | 748 | | |
747 | 749 | | |
748 | 750 | | |
749 | | - | |
| 751 | + | |
750 | 752 | | |
751 | 753 | | |
752 | 754 | | |
| |||
791 | 793 | | |
792 | 794 | | |
793 | 795 | | |
794 | | - | |
| 796 | + | |
795 | 797 | | |
796 | 798 | | |
797 | 799 | | |
| |||
831 | 833 | | |
832 | 834 | | |
833 | 835 | | |
834 | | - | |
| 836 | + | |
835 | 837 | | |
836 | 838 | | |
837 | 839 | | |
| |||
0 commit comments