You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling with -Xcheckinit, the compiler-generated bitmap field(s) are not marked synthetic. For example:
$ ~/Programs/scala-2.11.7/bin/scala -Xcheckinit
Welcome to Scala version 2.11.7 (OpenJDK 64-Bit Server VM, Java 1.8.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> final class Foo(constant: Double) { val value: Double = constant }
defined class Foo
scala> classOf[Foo].getDeclaredFields
res0: Array[java.lang.reflect.Field] = Array(private final double Foo.value, private volatile boolean Foo.bitmap$init$0)
scala> res0.last.isSynthetic
res1: Boolean = false
This may cause a problem for reflection-based tools that specifically must ignore synthetic fields for correctness (e.g. see this thread related to the EqualsVerifier library).
A similar issue was raised on the scala-internals mailing list last year, and there seemed to be agreement that such compiler-generated bitmap fields should be marked synthetic. However, I was unable to find an associated issue in JIRA.
The text was updated successfully, but these errors were encountered:
@soc said (edited on Sep 1, 2015 5:20:08 PM UTC):
I agree, although if I remember correctly, synthetic translates to ARTIFACT, not SYNTHETIC, in scalac terms. Adriaan, can you advise?
Mhhh, by the way, shouldn't this field be marked as transient, too?
When compiling with
-Xcheckinit
, the compiler-generated bitmap field(s) are not marked synthetic. For example:This may cause a problem for reflection-based tools that specifically must ignore synthetic fields for correctness (e.g. see this thread related to the EqualsVerifier library).
A similar issue was raised on the scala-internals mailing list last year, and there seemed to be agreement that such compiler-generated bitmap fields should be marked synthetic. However, I was unable to find an associated issue in JIRA.
The text was updated successfully, but these errors were encountered: