Skip to content

Fix #9492: Avoid forcing nested annotation #9536

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

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

smarter
Copy link
Member

@smarter smarter commented Aug 11, 2020

Java allows annotations inside arrays inside annotations, when parsing
the outer annotation, we need to produce an untyped tree for the array
and therefore the nested annotations. Previously this was done using
Annotation#tree which actually produces a typed tree, this works since
typed trees can be used as untyped tree but it requires forcing the
content of the nested annotation which can lead to cycles.

Instead, we now use a dedicated subclass of Annotation with an extra
untpdTree method we use for the purpose of generating a tree for the
nested annotation without forcing anything.

Java allows annotations inside arrays inside annotations, when parsing
the outer annotation, we need to produce an untyped tree for the array
and therefore the nested annotations. Previously this was done using
`Annotation#tree` which actually produces a typed tree, this works since
typed trees can be used as untyped tree but it requires forcing the
content of the nested annotation which can lead to cycles.

Instead, we now use a dedicated subclass of Annotation with an extra
`untpdTree` method we use for the purpose of generating a tree for the
nested annotation without forcing anything.
@odersky odersky merged commit 28069b6 into scala:master Aug 12, 2020
@odersky odersky deleted the fix-annot-cycle branch August 12, 2020 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants