-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK 11 - Class sun.reflect.CallerSensitive not found - continuing with a stub. #11679
Comments
@lrytz this one might interest you |
failed already for me
I don't think it's related to the code in the backend that you refer to, as we're not loading any symbols at this point. It's probably some other entity that carries the It's quite certainly related to the use of |
Oh great, Oracle is doing its best to tear down all their Java related resources (https://download.oracle.com/maven - 404). It will take me a moment to see where that repository went. |
Hmmm, no, download works fine for me (and Travis CI also builds without complaining); perhaps you are behind a strange firewall?
|
Yes, the
When I see two ways to make this work.
|
An immediate workaround would be to declare an annotation |
I tried changing
commit b7c2be1df4fdc3d0664caaa88c82252d86531367 (HEAD -> ticket/11679, retronym/ticket/11679)
Author: Jason Zaugg <jzaugg@gmail.com>
Date: Tue Aug 27 16:52:40 2019 +1000
Assume StubSymbols are not StaticAnnotations
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index e438b2d677..619d9ac23e 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -323,7 +323,14 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
/** Check whether the type or any of the arguments are erroneous */
def isErroneous = atp.isErroneous || args.exists(_.isErroneous)
- def isStatic = symbol isNonBottomSubClass StaticAnnotationClass
+ def isStatic = {
+ symbol match {
+ case _: StubSymbol =>
+ false // See scala/bug#11679
+ case _ =>
+ symbol isNonBottomSubClass StaticAnnotationClass
+ }
+ }
/** Check whether any of the arguments mention a symbol */
def refsSymbol(sym: Symbol) = hasArgWhich(_.symbol == sym) But I fear that this could make scalac too lenient -- when annotations based on stub symbols make it into signatures serialized by the |
Extended patch to scalac that would retain the desired fail-fast behaviour in the pickler: retronym/scala#67 |
In the reproduction in scala/bug#11679, an SBT build that uses `--release 8` and as such does not have `sun._` on the classpath, `APIPhase` (a custom compiler phase in SBT/Zinc that serializes the API of each file to perform change detection in incremental compilation) is attempting to serialize the API of the member `@CallerSensitive ClassLoader getParent` that `de.sciss.synth.proc.impl.MemoryClassLoader` inherits from `j.l.ClassLoader`. Until that point, scalac was doing okay without having a classfile for `CallerSensitve` -- it just used a `StubSymbol` in its place. Scala's pickle phase only serializes `.decls`, not `.members`. When `APIPhase` filters the list of annotations: https://github.com/sbt/zinc/blob/4b414b6677/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala#L789-L800 for those that extend `scala.StaticAnnotation`, the stub symbol fails and aborts compilation. Static annotations are part of the API because the are could affect how client code is compiled. This commit changes `AnnotationInfo.isStatic` to return false for annotations to absent classfiles. It also makes sure that we still have a hard-error if annotations based on absent classfiles are processed by the pickle phase. I have manually tested this commit with the SBT project in the bug. Fixes scala/bug#11679
Hello. Is there any workaround, I'm running into this again (cross building with Scala 2.12.10 and 2.13.1)
Is there a trick I can use? Unfortunately here I really have to compile under JDK 11 and I really need |
Maybe you could put the JDK 8 |
I have proposed a fix in SBT/Zinc: sbt/zinc#701 |
Fixes scala/bug#11679 Rewritten from sbt/zinc@2097464
I am building a project with
"-release", "8"
, compiling with sbt under OpenJDK 11. For both cross Scala versions 2.12.9 and 2.13.0, this fails at several places with errors likeor
Unfortunately it's not easy to isolate the code that breaks (I tried simple reductions but they don't crash the compiler). It's on a project that runs on multiple snapshot dependencies, so the heavy way to reproduce is
(i.e. use JDK 11)
This should be reproducible and yield
Perhaps related to #10817 . The only place that
CallerSensitive
appears in seems to be https://github.com/scala/scala/blob/3027652cab884c88f5cc20f710e351a0730c5ba2/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala#L132The text was updated successfully, but these errors were encountered: