-
Notifications
You must be signed in to change notification settings - Fork 21
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
VerifyError ascribing Java annotations to scala.annotation.Annotation #9644
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9644?orig=1 |
In recent 2.12, assigning |
hrhino
added a commit
to hrhino/scala
that referenced
this issue
Jun 29, 2018
Previously, `JavaParsers` and `ClassfileParser` would "fix-up" Java annotations to be non-abstract classes with `Annotation` and `StaticAnnotation` as parents. This caused all manner of strangeness and invalid classfiles (see linked tickets) and was surprising, to say the least. Now, the only special dispensation given to Java annotations is that they get a public, no-args class constructor, because that's what it takes to get `typedAnnotation` to be able to look up the type. This means that `new Foo`, where `Foo` is a Java annotation, still compiles (as it does right now, actually). Part of the reason for this commit is to provoke a discussion about how to fix that. Fixes scala/bug#8778. Fixes scala/bug#9400. Fixes scala/bug#9644.
hrhino
added a commit
to hrhino/scala
that referenced
this issue
Jul 1, 2018
Previously, `JavaParsers` and `ClassfileParser` would "fix-up" Java annotations to be non-abstract classes with `Annotation` and `StaticAnnotation` as parents. This caused all manner of strangeness and invalid classfiles (see linked tickets) and was surprising, to say the least. Now, the only special dispensation given to Java annotations is that they get a public, no-args class constructor, because that's what it takes to get `typedAnnotation` to be able to look up the type. This means that `new Foo`, where `Foo` is a Java annotation, still compiles (as it does right now, actually). Part of the reason for this commit is to provoke a discussion about how to fix that. Fixes scala/bug#8778. Fixes scala/bug#9400. Fixes scala/bug#9644.
hrhino
added a commit
to hrhino/scala
that referenced
this issue
Jul 1, 2018
Previously, `JavaParsers` and `ClassfileParser` would "fix-up" Java annotations to be non-abstract classes with `Annotation` and `StaticAnnotation` as parents. This caused all manner of strangeness and invalid classfiles (see linked tickets) and was surprising, to say the least. Now, the only special dispensation given to Java annotations is that they get a public, no-args class constructor, because that's what it takes to get `typedAnnotation` to be able to look up the type. This means that `new Foo`, where `Foo` is a Java annotation, still compiles (as it does right now, actually). Part of the reason for this commit is to provoke a discussion about how to fix that. Fixes scala/bug#8778. Fixes scala/bug#9400. Fixes scala/bug#9644.
hrhino
added a commit
to hrhino/scala
that referenced
this issue
Jul 2, 2018
Previously, `JavaParsers` and `ClassfileParser` would "fix-up" Java annotations to be non-abstract classes with `Annotation` and `StaticAnnotation` as parents. This caused all manner of strangeness and invalid classfiles (see linked tickets) and was surprising, to say the least. Now, the only special dispensation given to Java annotations is that they get a public, no-args class constructor, because that's what it takes to get `typedAnnotation` to be able to look up the type. This means that `new Foo`, where `Foo` is a Java annotation, still compiles (as it does right now, actually). Part of the reason for this commit is to provoke a discussion about how to fix that. Fixes scala/bug#8778. Fixes scala/bug#9400. Fixes scala/bug#9644.
hrhino
added a commit
to hrhino/scala
that referenced
this issue
Jul 2, 2018
Previously, `JavaParsers` and `ClassfileParser` would "fix-up" Java annotations to be non-abstract classes with `Annotation` and `StaticAnnotation` as parents. This caused all manner of strangeness and invalid classfiles (see linked tickets) and was surprising, to say the least. Now, the only special dispensation given to Java annotations is that they get a public, no-args class constructor, because that's what it takes to get `typedAnnotation` to be able to look up the type. This means that `new Foo`, where `Foo` is a Java annotation, still compiles (as it does right now, actually). Part of the reason for this commit is to provoke a discussion about how to fix that. Fixes scala/bug#8778. Fixes scala/bug#9400. Fixes scala/bug#9644.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scala says Java annotations extend scala.annotation.Annotation, but generates invalid bytecode trying to perform this cast:
This happens for all Java annotations, Deprecated isn't special.
This was mentioned in a comment of #9400, but is a separate issue. Also reported here.
The text was updated successfully, but these errors were encountered: