You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scala version: 2.13.10, also latest 2.13.x -> 8fa1e7c1
Sbt version: 1.7.1
Java 8 and 11
Maybe you need java-atk-wrapper.jar or similar on your classpath, see below.
or
in Intellij: open respective file, and run via Debug. (not Run!)
Output:
sbt:root> testOnly scala.reflect.io.ZipArchiveTest scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest
...
[info] Test run scala.reflect.io.ZipArchiveTest started
...
[info] Test scala.reflect.io.ZipArchiveTest.manifest resources just works started
[error] Test scala.reflect.io.ZipArchiveTest.manifest resources just works failed: java.lang.AssertionError:null, took 0.028 sec
[error] at scala.reflect.io.ZipArchiveTest.$anonfun$manifest resources just works$2(ZipArchiveTest.scala:60)
[error] at scala.reflect.io.ZipArchiveTest.$anonfun$manifest resources just works$2$adapted(ZipArchiveTest.scala:58)
[error] at scala.util.Using$.$anonfun$resources$2(Using.scala:298)
[error] at scala.util.Using$.resource(Using.scala:261)
[error] at scala.util.Using$.$anonfun$resources$1(Using.scala:297)
[error] at scala.util.Using$.resource(Using.scala:261)
[error] at scala.util.Using$.resources(Using.scala:296)
[error] at scala.reflect.io.ZipArchiveTest.manifest resources just works(ZipArchiveTest.scala:58)
[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:566)
[error] ...
[info] Test run scala.reflect.io.ZipArchiveTestfinished: 1 failed, 0 ignored, 5 total, 0.093s
[info] Test run scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest started
[info] Test scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.cacheInvalidation started
[info] Test scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.manifest classpath entry works started
[error] Test scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.manifest classpath entry works failed: java.lang.AssertionError:null, took 0.024 sec
[error] at scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.$anonfun$manifest classpath entry works$5(ZipAndJarFileLookupFactoryTest.scala:91)
[error] at scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.$anonfun$manifest classpath entry works$5$adapted(ZipAndJarFileLookupFactoryTest.scala:88)
[error] at scala.util.Using$.$anonfun$resources$5(Using.scala:328)
[error] at scala.util.Using$.resource(Using.scala:261)
[error] at scala.util.Using$.$anonfun$resources$4(Using.scala:327)
[error] at scala.util.Using$.resource(Using.scala:261)
[error] at scala.util.Using$.$anonfun$resources$3(Using.scala:326)
[error] at scala.util.Using$.resource(Using.scala:261)
[error] at scala.util.Using$.resources(Using.scala:325)
[error] at scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest.manifest classpath entry works(ZipAndJarFileLookupFactoryTest.scala:88)
[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
[error] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:566)
[error] ...
[info] Test run scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTestfinished: 1 failed, 0 ignored, 2 total, 0.406s
[error] Failed:Total8, Failed2, Errors0, Passed6
[error] Failedtests:
[error] scala.tools.nsc.classpath.ZipAndJarFileLookupFactoryTest
[error] scala.reflect.io.ZipArchiveTest
[error] (junit /Test/ testOnly) sbt.TestsFailedException:Tests unsuccessful
I don't know exactly, what the bug is or how to trigger/prevent it, but I found that the manifestAt returns the wrong manifest.
Adding the following print statement yields interesting insight.
This prints jar:file:/home/anselm/Downloads/idea-IC-221.4501.155/plugins/java/lib/rt/debugger-agent.jar!/META-INF/MANIFEST.MF
in Intellij's debugger and jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF/MANIFEST.MF
in my sbt.
So, clearly, the ScalaClassLoader.getResource returns a manifest of a different jar than set by fromURLs.
This may be a bug in ScalaClassLoader or the classloader may be used in a wrong way in manifestAt().
I hope somebody is able to reproduce this behaviour with the given hints. (Maybe add another jar with another MANIFEST to classpath or so?)
The text was updated successfully, but these errors were encountered:
Prevoisly, calling `.getResource` sometimes returned an URL to a different jar, if there was one on classpath containing a manifest. This was because `getResource` delegates to the parent CL first, and only calls `findResource` if no manifest was found. As `findResource` is `protected` in `ClassLoader` and only made `public` by `java.net.URLClassLoader`, we resort to creating the URL ourselves instead.
fixesscala/bug#12677
Reproduction steps
Scala version:
2.13.10
, also latest2.13.x -> 8fa1e7c1
Sbt version:
1.7.1
Java
8
and11
Maybe you need
java-atk-wrapper.jar
or similar on your classpath, see below.or
or
or
in Intellij: open respective file, and run via Debug. (not Run!)
Output:
Problem
The problem does not occur in some other circumstances (notably the CI). Also @som-snytt wasn't able to reproduce it immediately.
I don't know exactly, what the bug is or how to trigger/prevent it, but I found that the
manifestAt
returns the wrong manifest.Adding the following print statement yields interesting insight.
This prints
jar:file:/home/anselm/Downloads/idea-IC-221.4501.155/plugins/java/lib/rt/debugger-agent.jar!/META-INF/MANIFEST.MF
in Intellij's debugger and
jar:file:/usr/share/java/java-atk-wrapper.jar!/META-INF/MANIFEST.MF
in my sbt.
So, clearly, the
ScalaClassLoader.getResource
returns a manifest of a different jar than set byfromURLs
.This may be a bug in
ScalaClassLoader
or the classloader may be used in a wrong way inmanifestAt()
.I hope somebody is able to reproduce this behaviour with the given hints. (Maybe add another jar with another MANIFEST to classpath or so?)
The text was updated successfully, but these errors were encountered: