fixup! fixup! use resources for `SourceFilesProvider`s
diff --git a/compiler/tests-common-new/build.gradle.kts b/compiler/tests-common-new/build.gradle.kts
index ea88dfa..6ea0cfd 100644
--- a/compiler/tests-common-new/build.gradle.kts
+++ b/compiler/tests-common-new/build.gradle.kts
@@ -49,13 +49,7 @@
 optInToExperimentalCompilerApi()
 optInToUnsafeDuringIrConstructionAPI()
 
-val zipJsr305TestAnnotations = tasks.register<Zip>("zipJsr305TestAnnotations") {
-    archiveFileName.set("jsr305_test_annotations.jar")
-    from { project(":compiler").layout.projectDirectory.dir("testData/diagnostics/helpers/jsr305_test_annotations") }
-}
-
 tasks.processTestResources.configure {
-    from(zipJsr305TestAnnotations)
     from(project(":compiler").layout.projectDirectory.dir("testData")) {
         include("/diagnostics/helpers/**")
         include("/codegen/helpers/**")
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmForeignAnnotationsConfigurator.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmForeignAnnotationsConfigurator.kt
index 9326552..a6af5d6 100644
--- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmForeignAnnotationsConfigurator.kt
+++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/configuration/JvmForeignAnnotationsConfigurator.kt
@@ -34,8 +34,8 @@
 import org.jetbrains.kotlin.test.services.standardLibrariesPathProvider
 import org.jetbrains.kotlin.test.util.KtTestUtil
 import java.io.File
-import java.nio.file.Files
-import java.util.zip.ZipInputStream
+import java.net.URI
+import java.util.zip.ZipFile
 import kotlin.io.path.createTempDirectory
 
 enum class JavaForeignAnnotationType(val path: String) {
@@ -47,7 +47,7 @@
 
 open class JvmForeignAnnotationsConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {
     companion object {
-        val JSR_305_TEST_ANNOTATIONS_PATH = this::class.java.classLoader.getResource("jsr305_test_annotations.jar")!!
+        const val JSR_305_TEST_ANNOTATIONS_PATH = "diagnostics/helpers/jsr305_test_annotations"
     }
 
     override val directiveContainers: List<DirectivesContainer>
@@ -110,23 +110,36 @@
         configuration.addJvmClasspathRoot(testServices.standardLibrariesPathProvider.jvmAnnotationsForTests())
 
         if (JvmEnvironmentConfigurationDirectives.WITH_JSR305_TEST_ANNOTATIONS in registeredDirectives) {
-            val jsr305AnnotationsDir = createTempDirectory().toFile().also {
-                ZipInputStream(JSR_305_TEST_ANNOTATIONS_PATH.openStream()).use { zip ->
-                    while (true) {
-                        val entry = zip.nextEntry ?: break
-                        val file = File(it, entry.name)
-                        if (entry.isDirectory) {
-                            file.mkdirs()
-                        } else {
-                            file.parentFile.mkdirs()
-                            Files.newOutputStream(file.toPath()).use { zip.copyTo(it) }
-                        }
+            val resourceUri = this::class.java.classLoader.getResource(JSR_305_TEST_ANNOTATIONS_PATH)!!.toURI()
+            val target = createTempDirectory().toFile()
+            when (resourceUri.scheme) {
+                "jar" -> {
+                    val array = resourceUri.toString().split("!")
+                    val jarUri = URI.create(array[0])
+                    val pathInsideJar = array[1]
+                    val path = jarUri.toString().substringAfterLast(":")
+                    ZipFile(path).use { zipFile ->
+                        val prefix = pathInsideJar.removePrefix("/")
+                        zipFile.entries().asSequence()
+                            .filter { entry -> !entry.isDirectory && entry.name.startsWith(prefix) }
+                            .forEach { entry ->
+                                val relativePath = entry.name.removePrefix(prefix)
+                                val targetFile = File(target, relativePath)
+                                targetFile.parentFile.mkdirs()
+                                zipFile.getInputStream(entry).use { input ->
+                                    targetFile.outputStream().use { output ->
+                                        input.copyTo(output)
+                                    }
+                                }
+                            }
                     }
                 }
+                "file" -> File(resourceUri).copyRecursively(target)
+                else -> throw UnsupportedOperationException("Unsupported URI scheme: ${resourceUri.scheme}")
             }
             configuration.addJvmClasspathRoot(
                 MockLibraryUtil.compileJavaFilesLibraryToJar(
-                    jsr305AnnotationsDir.path,
+                    target.path,
                     "jsr-305-test-annotations",
                     assertions = JUnit5Assertions,
                     extraClasspath = configuration.jvmClasspathRoots.map { it.absolutePath } + jsr305JarFile.absolutePath
diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/IrInterpreterHelpersSourceFilesProvider.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/IrInterpreterHelpersSourceFilesProvider.kt
index bc5f884..54e0074 100644
--- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/IrInterpreterHelpersSourceFilesProvider.kt
+++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/services/sourceProviders/IrInterpreterHelpersSourceFilesProvider.kt
@@ -5,7 +5,6 @@
 
 package org.jetbrains.kotlin.test.services.sourceProviders
 
-import com.intellij.openapi.application.PathManager
 import org.jetbrains.kotlin.test.directives.AdditionalFilesDirectives
 import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
 import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
@@ -57,19 +56,24 @@
         val stdlibPath = File(this::class.java.classLoader.getResource(STDLIB_PATH)!!.toURI())
 
         return directories.flatMap { directory ->
-            PathManager.getResourceRoot(this::class.java.classLoader, directory)?.let {
-                File(it).walkTopDown()
-                    .mapNotNull { file ->
-                        val canonicalPath = file.parentFile.canonicalPath
-                        val relativePath = runIf(canonicalPath.startsWith(stdlibPath.canonicalPath)) {
-                            canonicalPath.removePrefix(stdlibPath.canonicalPath + File.separatorChar)
+            val resourceUri = this::class.java.classLoader.getResource(directory)!!.toURI()
+            when (resourceUri.scheme) {
+                "file" -> {
+                    File(resourceUri).walkTopDown()
+                        .mapNotNull { file ->
+                            val canonicalPath = file.parentFile.canonicalPath
+                            val relativePath = runIf(canonicalPath.startsWith(stdlibPath.canonicalPath)) {
+                                canonicalPath.removePrefix(stdlibPath.canonicalPath + File.separatorChar)
+                            }
+                            file.takeIf { it.isFile }
+                                ?.takeUnless { EXCLUDES.any { file.endsWith(it) } }
+                                ?.toTestFile(relativePath)
                         }
-                        file.takeIf { it.isFile }
-                            ?.takeUnless { EXCLUDES.any { file.endsWith(it) } }
-                            ?.toTestFile(relativePath)
-                    }
-                    .toList()
-            }!!
+                        .toList()
+                }
+                // TODO(KT-76305) add support for resources in jars
+                else -> throw UnsupportedOperationException("Unsupported URI scheme: ${resourceUri.scheme}")
+            }
         }
     }