From e3ebb242c5075f93a70a3e03598344a7a0bf448a Mon Sep 17 00:00:00 2001 From: Anselm von Wangenheim Date: Mon, 31 Oct 2022 14:42:06 +0100 Subject: [PATCH] {get=>find}Resource in some tests This does not call the parent class loader first, which may return different resources if they're on classpath. fixes scala/bug#12677 --- test/junit/scala/reflect/io/ZipArchiveTest.scala | 2 +- .../tools/nsc/classpath/ZipAndJarFileLookupFactoryTest.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/junit/scala/reflect/io/ZipArchiveTest.scala b/test/junit/scala/reflect/io/ZipArchiveTest.scala index ec7ede4348b6..d1c48d52141d 100644 --- a/test/junit/scala/reflect/io/ZipArchiveTest.scala +++ b/test/junit/scala/reflect/io/ZipArchiveTest.scala @@ -50,7 +50,7 @@ class ZipArchiveTest { assertThrown[IOException](_.getMessage.contains(f.toString))(fza.iterator) } - private def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).getResource("META-INF/MANIFEST.MF"); + private def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).findResource("META-INF/MANIFEST.MF"); // ZipArchive.fromManifestURL(URL) @Test def `manifest resources just works`(): Unit = { diff --git a/test/junit/scala/tools/nsc/classpath/ZipAndJarFileLookupFactoryTest.scala b/test/junit/scala/tools/nsc/classpath/ZipAndJarFileLookupFactoryTest.scala index f152d27473f4..c2ce9d502322 100644 --- a/test/junit/scala/tools/nsc/classpath/ZipAndJarFileLookupFactoryTest.scala +++ b/test/junit/scala/tools/nsc/classpath/ZipAndJarFileLookupFactoryTest.scala @@ -82,7 +82,7 @@ class ZipAndJarFileLookupFactoryTest { () } } - def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).getResource("META-INF/MANIFEST.MF"); + def manifestAt(location: URI): URL = ScalaClassLoader.fromURLs(List(location.toURL), null).findResource("META-INF/MANIFEST.MF"); val j = createTestJar(); Using.resources(ForDeletion(j), new ManifestResources(manifestAt(j.toUri)), new CloseableRegistry) { (_, archive, closeableRegistry) =>