Skip to content

Type constant annotation arguments correctly #8655

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
Apr 3, 2020

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 2, 2020

An annotation argument of type boolean, byte, char or short will be
represented as a CONSTANT_Integer in the classfile, so back in
3b882c2 I made sure that we took this
type into account when creating a Constant, but this is not enough: we
store parsed constants in a values cache, and the same constant might
be used with different expected types, so the conversion needs to be
done on demand.

@smarter

This comment has been minimized.

@smarter

This comment has been minimized.

An annotation argument of type boolean, byte, char or short will be
represented as a CONSTANT_Integer in the classfile, so back in
3b882c2 I made sure that we took this
type into account when creating a `Constant`, but this is not enough: we
store parsed constants in a `values` cache, and the same constant might
be used with different expected types, so the conversion needs to be
done on demand.
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed you doing a Sherlock Holmes on Gitter. Nicely played!

@odersky odersky merged commit 07912a2 into scala:master Apr 3, 2020
@odersky odersky deleted the annot-constant branch April 3, 2020 11:10
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