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
Include -release arg in cache key for ct.sym classpath element
The compiler has a per-classloader cache that backs the classpath
lookups of individual instances of `Global`. Elements in the cache are
used by `Global` instances that are concurrent (think parallel
compilation of sub-projects) or are sequential within a small timeout.
In scala#9557, this was extended to the classpath entry that backs the
`scalac -release` compiler option
([JEP-247](https://openjdk.java.net/jeps/247) support for viewing the
Java base library "as of" an older JDK version.
This change was buggy -- it did not include the selected release in the
cache key, which could lead to a compiler that specifies `-release X`
seeing the results of another compiler using `-release Y`.
This behaviour was tested by a JDK-9+ conditional test
(`MultiReleaseJarTest`) which unfortunately is not part of our CI on
the 2.12.x branch, so the regression went unnoticed.
While in this area, I followed up on a TODO comment in the same test
and discovered another bug in handling of multi-release JARs.
Again, this bug could manifest when different values of `-release` were
used in a build. It would manifest as an `IllegalArgumentException`
in `ResuableDataReader` when it used the size of the non-versioned
classfile when sizing buffers for the versioned classfile.
if (!Properties.isJavaAtLeast("9")) { println("skipping mrJar() on old JDK"); return} // TODO test that the compiler warns that --release is unsupported.
0 commit comments