-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Optimization: Introduce CompactAnnotation #24679
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
base: main
Are you sure you want to change the base?
Conversation
9af8000 to
66aa6bb
Compare
This one takes a type argument instead of as a tree argument. For now it's reserved for retains-like annotations. CompactAnnotations don't need tree maps and annotated types containing them hash properly.
We don't need the constructor anymore since `RetainingAnnotation` has equivalent functionality. And we don't need the deconstructor since there is already `CapturingOrRetainsType`.
noti0na1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| val mtpsWithArgs = mtps.zip(argss) | ||
| val argMap = mtpsWithArgs.toMap | ||
| val deps = mutable.HashMap[Tree, List[Tree]]().withDefaultValue(Nil) | ||
| val deps = mutable.LinkedHashMap[Tree, List[Tree]]().withDefaultValue(Nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, why do we choose to use mutable.LinkedHashMap now?
|
@odersky unfortunately, scaladoc now renders CC-related annotations incorrectly/not at all in places. I'll try to push a fix before the release cutoff. |
|
@bracevac So should we hold-off merging this until the scaladoc is fixed? |
|
@odersky yes, otherwise, the API will not be rendered correctly. |




This one takes a type argument instead of as a tree argument. This makes mapping such annotations a lot faster and also safer. In fact, in retrospect, most annotations could be represented as
CompactAnnotations.CompactAnnotationis extended byRetainingAnnotation, which is reserved for@retains,@retainsByNameand@retainsCap. We make sure that all annotations with these classes are represented asRetainingAnnotations.For now there are no
CompactAnnotations other than@RetainingAnnotations but this could be changed in the future.