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

Macros fail to find annotations upon modification of the classes interface. #7424

Closed
scabug opened this issue Apr 25, 2013 · 4 comments
Closed
Labels

Comments

@scabug
Copy link

scabug commented Apr 25, 2013

When using a macro to find annotations the macro is unable to find the annotations on modification of the parent classes interface. The macro is run, but the annotations list of the symbol of interest is empty. However, once the file which executes these macros is recompiled, the annotations are again found.
Minimal example: https://github.com/bryce-anderson/scalaerror/

@scabug
Copy link
Author

scabug commented Apr 25, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7424?orig=1
Reporter: Bryce Anderson (bryce-anderson)
Affected Versions: 2.10.0, 2.10.1
See #7561

@scabug
Copy link
Author

scabug commented Apr 26, 2013

@xeno-by said:
This is an unfortunate consequence of lazy loading employed by scalac.

The workaround is elaborate, though effective. Put the following lines before println:

m.typeSignature // force loading method's signature
m.annotations.foreach(_.tpe) // force loading all the annotations

@scabug
Copy link
Author

scabug commented Jun 6, 2013

@xeno-by said (edited on Jun 6, 2013 8:00:46 PM UTC):
Also see #7561

@SethTisue
Copy link
Member

closing since a workaround exists and since scala.reflect isn't changing much anymore. comment/reopen if you disagree

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

No branches or pull requests

3 participants