-
Notifications
You must be signed in to change notification settings - Fork 1.1k
"missing argument" for default annotation parameter to Java interface #2760
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
Comments
It's the Java parser that does not generate the default correctly. If we compile Fork.java separately, it works. |
Here's what we get from the Java parser:
The default arguments are missing. I believe that's no oversight. To do this, we'd need to be able to parse expressions (actually: only constant expressions), and that functionality is currently missing. |
I don't think that's necessary, we already record whether annotations parameters have default values with a special annotation (https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala#L518) and that should be enough to compile uses of Java annotations. I think we just need to add dummy default getters for these parameters like we do when parsing from a classfile: https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala#L640-L645 |
We do record an AnnotationDefault attribute, but we don't record what that attribute is. To do so, we have to parse the default value, which is currently done using I think this would be a great contribution for someone who tries to get into the compiler code base. It's tricky, but requires only a limited footprint of pre-existing knowledge about the compiler. |
Fix #2760: Support defaults in Java annotations parsed from sources
The text was updated successfully, but these errors were encountered: