-
Notifications
You must be signed in to change notification settings - Fork 11
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
Read Java annotations. #389
Conversation
e0b4960
to
d35c1fb
Compare
|
||
case AnnotationValue.ClassConst(descriptor) => | ||
val classType = JavaSignatures.parseReturnDescriptor(descriptor.name) | ||
Literal(Constant(classType))(pos) |
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.
documentation of Constant should mention that this can be a raw class type (aka unapplied generic class)
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.
maybe add a test for a generic external class
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.
Added documentation + test.
@@ -38,10 +38,51 @@ private[classfiles] object JavaSignatures: | |||
superRef :: interfaces.map(classRef).toList | |||
end parseSupers | |||
|
|||
def parseReturnDescriptor(descriptor: String)(using ReaderContext, InnerClasses, Resolver): Type = |
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.
this is also implemented by the local method result
inside of parseSignature
, so I wonder if it can be reused with refactoring?
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.
Yes, I know. It's not that easy, however, because the more capable parseSignature
expects a member: TermOrTypeSymbol
that the signature attaches to, which we have no business having here. Factoring this out would require significant refactoring of the whole parsing, so I would rather not do that here (at least not at this point).
d35c1fb
to
d7aede0
Compare
Bonus: read Java parameter names.