-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Migration rework #1: #40
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
Conversation
- The @migration annotation can now be used like @Deprecation, old syntax is still supported, but deprecated. - Improved the wording and the consistency of most migration messages, migration warnings now also show the version the change occurred. - Adjusted test. - Partially fixes SI-4990.
|
This looks pretty good. Since "2.8" and "2.9" are technically not versions of scala, can you change all those strings to "2.8.0" and "2.9.0". Also, can you please read http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html and author your commit messages accordingly. |
|
I left out the patch number because I decided that I didn't want to check every single migrated method when it changed exactly. I'll change it and add ".0". |
|
Nothing which merits a migration warning should ever be introduced in a point release (which isn't to say it never happened, but it'll at worst be the rare exception.) |
|
Ok. New pull request is up. |
Fixes strap.scalacheck build by adding reflect to the classpath
VarHandles bring a host of new "polymorphic signature" methods to
the Java 9 standard library. This commit updates the way we detect
such methods to look at the absense/presense of the
`PolymorphicSignature` annotation, so as to include these (and any
future additions.)
When we see applications of such methods, we disable adaptation
of argument and return types.
Tested manually with JDK9-ea:
```
Welcome to Scala 2.12.2-20161208-165912-3de1c0c (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea).
Type in expressions for evaluation. Or try :help.
scala> import java.lang.invoke._, scala.runtime.IntRef
import java.lang.invoke._
import scala.runtime.IntRef
scala> val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
varHandle: java.lang.invoke.VarHandle = java.lang.invoke.VarHandleInts$FieldInstanceReadWrite@7112ce6
scala> varHandle.getAndSet(ref, 1): Int
res5: Int = 0
scala> varHandle.getAndSet(ref, 1): Int
res6: Int = 1
```
Inspecting bytecode shows the absense of box/unboxing:
```
object Test {
import java.lang.invoke._, scala.runtime.IntRef
val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
def main(args: Array[String]): Unit = {
val i : Int = varHandle.getAndSet(IntRef.zero, 1)
}
}
```
```
public void main(java.lang.String[]);
Code:
0: aload_0
1: invokevirtual #28 // Method varHandle:()Ljava/lang/invoke/VarHandle;
4: invokestatic #34 // Method scala/runtime/IntRef.zero:()Lscala/runtime/IntRef;
7: iconst_1
8: invokevirtual #40 // Method java/lang/invoke/VarHandle.getAndSet:(Lscala/runtime/IntRef;I)I
11: istore_2
12: return
```
VarHandles bring a host of new "polymorphic signature" methods to
the Java 9 standard library. This commit updates the way we detect
such methods to look at the absense/presense of the
`PolymorphicSignature` annotation, so as to include these (and any
future additions.)
When we see applications of such methods, we disable adaptation
of argument and return types.
Tested manually with JDK9-ea:
```
Welcome to Scala 2.12.2-20161208-165912-3de1c0c (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea).
Type in expressions for evaluation. Or try :help.
scala> import java.lang.invoke._, scala.runtime.IntRef
import java.lang.invoke._
import scala.runtime.IntRef
scala> val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
varHandle: java.lang.invoke.VarHandle = java.lang.invoke.VarHandleInts$FieldInstanceReadWrite@7112ce6
scala> varHandle.getAndSet(ref, 1): Int
res5: Int = 0
scala> varHandle.getAndSet(ref, 1): Int
res6: Int = 1
```
Inspecting bytecode shows the absense of box/unboxing:
```
object Test {
import java.lang.invoke._, scala.runtime.IntRef
val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
def main(args: Array[String]): Unit = {
val i : Int = varHandle.getAndSet(IntRef.zero, 1)
}
}
```
```
public void main(java.lang.String[]);
Code:
0: aload_0
1: invokevirtual #28 // Method varHandle:()Ljava/lang/invoke/VarHandle;
4: invokestatic #34 // Method scala/runtime/IntRef.zero:()Lscala/runtime/IntRef;
7: iconst_1
8: invokevirtual #40 // Method java/lang/invoke/VarHandle.getAndSet:(Lscala/runtime/IntRef;I)I
11: istore_2
12: return
```
VarHandles bring a host of new "polymorphic signature" methods to
the Java 9 standard library. This commit updates the way we detect
such methods to look at the absense/presense of the
`PolymorphicSignature` annotation, so as to include these (and any
future additions.)
When we see applications of such methods, we disable adaptation
of argument and return types.
Tested manually with JDK9-ea:
```
Welcome to Scala 2.12.2-20161208-165912-3de1c0c (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea).
Type in expressions for evaluation. Or try :help.
scala> import java.lang.invoke._, scala.runtime.IntRef
import java.lang.invoke._
import scala.runtime.IntRef
scala> val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
varHandle: java.lang.invoke.VarHandle = java.lang.invoke.VarHandleInts$FieldInstanceReadWrite@7112ce6
scala> varHandle.getAndSet(ref, 1): Int
res5: Int = 0
scala> varHandle.getAndSet(ref, 1): Int
res6: Int = 1
```
Inspecting bytecode shows the absense of box/unboxing:
```
object Test {
import java.lang.invoke._, scala.runtime.IntRef
val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
def main(args: Array[String]): Unit = {
val i : Int = varHandle.getAndSet(IntRef.zero, 1)
}
}
```
```
public void main(java.lang.String[]);
Code:
0: aload_0
1: invokevirtual #28 // Method varHandle:()Ljava/lang/invoke/VarHandle;
4: invokestatic #34 // Method scala/runtime/IntRef.zero:()Lscala/runtime/IntRef;
7: iconst_1
8: invokevirtual #40 // Method java/lang/invoke/VarHandle.getAndSet:(Lscala/runtime/IntRef;I)I
11: istore_2
12: return
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Before:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private final int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: return
}
```
The assignment to the final field `foo` has always contravened the JVM spec,
and this rule is enforced for any classfiles of format 53 and higher.
After this patch:
```
scala> trait T { val foo = 24 }; class C extends T
defined trait T
defined class C
scala> :javap -private -c C
Compiled from "<console>"
public class $line3.$read$$iw$$iw$C implements $line3.$read$$iw$$iw$T {
private int foo;
public int foo();
Code:
0: aload_0
1: getfield #21 // Field foo:I
4: ireturn
public void $line3$$read$$iw$$iw$T$_setter_$foo_$eq(int);
Code:
0: aload_0
1: iload_1
2: putfield #21 // Field foo:I
5: return
public $line3.$read$$iw$$iw$C();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokestatic #34 // InterfaceMethod $line3/$read$$iw$$iw$T.$init$:(L$line3/$read$$iw$$iw$T;)V
8: getstatic #40 // Field scala/runtime/ScalaRunTime$.MODULE$:Lscala/runtime/ScalaRunTime$;
11: invokevirtual #43 // Method scala/runtime/ScalaRunTime$.releaseFence:()V
14: return
}
```
Support classes with nested HK type parameters
Some tests in specialized fail with "value integerBoxCount is not a member of object scala.runtime.BoxesRunTime", but it could also be my old machine I'm currently testing on ...