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

annotations: occasional spurious "Ann is abstract; cannot be instantiated " error #7603

Closed
scabug opened this issue Jun 24, 2013 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jun 24, 2013

We've had reports of:

We are getting this error from time to time: 
error: trait Test is abstract; cannot be instantiated 
11:09:50 [ant:scalac] @Test def testClientRequestNum = { 
11:09:50 [ant:scalac] ^ 

I see the error is similar to one we spotted on a build here: scala/scala#2107 (comment)

The error suggests that the annotation is binding to the wrong symbol on the classpath has the same name.

I can't reproduce it, but I think I've spotted the problem. Can you?

// need to be lazy, #1782. beforeTyper to allow inferView in annotation args, SI-5892.
AnnotationInfo lazily {
  val context1 = typer.context.make(ann)
  context1.setReportErrors()
  enteringTyper(newTyper(context1) typedAnnotation ann)
}
@scabug
Copy link
Author

scabug commented Jun 24, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7603?orig=1
Reporter: @retronym
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Jun 24, 2013

@retronym said (edited on Jun 24, 2013 11:46:49 AM UTC):
I'm still unable to craft a test to trigger this. My hypothesis is that the field Typer#context is mutated between the point when the lazy annotation info is created and when it is forced.

A few breadcrumbs for code that might be of interest:

    // Namers.scala
    def enterSyms(trees: List[Tree]): Namer = {
      trees.foldLeft(this: Namer) { (namer, t) =>
        val ctx = namer enterSym t
        // for Import trees, enterSym returns a changed context, so we need a new namer
        if (ctx eq namer.context) namer
        else newNamer(ctx)
      }
    }
          // Typer#typeStats
          stat match {
            case imp @ Import(_, _) =>
              imp.symbol.initialize
              if (!imp.symbol.isError) {
                context = context.makeNewImport(imp)
                typedImport(imp)
              } else EmptyTree

@scabug
Copy link
Author

scabug commented Jun 27, 2013

@adriaanm said:
scala/scala#2680

@scabug
Copy link
Author

scabug commented Aug 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants