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
Java transient flag is not translated to Scala annotation #10042
Comments
Imported From: https://issues.scala-lang.org/browse/SI-10042?orig=1 |
@lrytz said: In fact, there is no Scala flag that corresponds to |
@jvican said (edited on Nov 11, 2016 10:22:18 AM UTC): |
@adriaanm said (edited on Nov 23, 2016 6:27:42 PM UTC): |
@retronym said: Probably the most similar is the way we parse the |
@retronym said (edited on Dec 1, 2016 7:24:30 AM UTC): Looks like we forgot to create the
|
a.k.a., once more into the ClassfileParser fray. In `JavaMirrors`, add these synthetic annotations along with the real ones (and the `@throws` annotation which we already synthesize in the same place). In `ClassfileParser`, inspect the access flags and apply the appropriate annotations then. Happily, we were already doing The Right Thing[tm] for these classes if we loaded their symbols via `JavaParsers`, so for today that file escapes unscathed. Fixes scala/bug#10042.
a.k.a., once more into the ClassfileParser fray. In `JavaMirrors`, add these synthetic annotations along with the real ones (and the `@throws` annotation which we already synthesize in the same place). In `ClassfileParser`, inspect the access flags and apply the appropriate annotations then. Happily, we were already doing The Right Thing[tm] for these classes if we loaded their symbols via `JavaParsers`, so for today that file escapes unscathed. Fixes scala/bug#10042.
a.k.a., once more into the ClassfileParser fray. In `JavaMirrors`, add these synthetic annotations along with the real ones (and the `@throws` annotation which we already synthesize in the same place). In `ClassfileParser`, inspect the access flags and apply the appropriate annotations then. Happily, we were already doing The Right Thing[tm] for these classes if we loaded their symbols via `JavaParsers`, so for today that file escapes unscathed. Fixes scala/bug#10042.
There is currently no way to check if a Java symbol is transient or not.
This is the case because
scala.reflect.internal.ClassfileConstants
does not translate theJAVA_ACC_TRANSIENT
flag to a Scala flag. Therefore, checks withhasFlag(Flags.TRANS_FLAG)
in symbols are negative for transitive variables in Java classes.There is a hack through reflection that can be used to check this, but the fact that this case is not handled is bad for java interop and Serialization-intensive code.
The text was updated successfully, but these errors were encountered: