Assume StubSymbols are not StaticAnnotations#67
Closed
Conversation
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
Owner
Author
|
Upstreamed as scala#8379 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.