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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

SethTisue commented Mar 2, 2018

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

@SethTisue SethTisue closed this Mar 2, 2018

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