Skip to content
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

Assume StubSymbols are not StaticAnnotations #67

Closed
wants to merge 1 commit into from
Closed

Commits on Aug 28, 2019

  1. Assume StubSymbols are not StaticAnnotations

    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
    retronym committed Aug 28, 2019
    Configuration menu
    Copy the full SHA
    555cdae View commit details
    Browse the repository at this point in the history