forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 1
WIP move module-var and -accessor synthesis out of mixin #17
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SI-7981 toSeq on immutable Map and Set return ArrayBuffer
Prepend was throwing segfaults as it was handled differently from Append. This brings the two into line with each other. There are various optimizations that could be applied that have not been, however, such as intercepting sequential prepends and generating one multi-prepend instead of nested single-element prepends. Unit test added to verify minimally that bug is gone.
When comparing a Number and a Character, the backend directly emits a call to this method.
SI-8691 SeqView throws exception when prepending a collection
Fixed all copyToArray methods to do exactly what the docs say they do, with the least-suprise behavior of not throwing an exception if you ask to copy nothing (but would have copied out of range). Iterator had an undocumented requirement for the target index to be in range regardless if anything happened; this has been removed.
Constant folding was incorrectly promoting to Long when the operand was Long, as with other binary ops, but the result type depends on the receiver. Per SLS 12.2.1. This fixes ((1 << 2L): Int) and the other shift ops and the other integral types.
SI-8462: Int shift Long result corrected
SI-8944 A more resiliant naming scheme for case accessors
SI-8519 collection.immutable.Map.apply is inefficient
SI-9030 make BoxesRunTime.equalsNumChar public
SI-7128 copyToArray(xs, 0, 0) should not fail
Conflicts: build.number src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala src/library/scala/collection/Iterator.scala versions.properties
…2.x-20150129 Conflicts: build.number src/library/scala/concurrent/Future.scala versions.properties
…150129 Merge 2.11.x to 2.12.x
... until scala-ide/uber-build#48 is fixed.
Punt on IDE validation in 2.12.x
After typechecking a tree, the typer adapts it to the current
mode and expected type. If we are in FUNmode (typechecking the
qualifier of a value- or type-application), and the tree does not
already have a MethodType or PolyType, it is reinterepreted as
`qual.apply`.
In doing so, `insertApply` stabilizes the type of `qual`, e.g.
replacing `Ident(foo).setType(typeOf[Int])` with
`Ident(foo).setType(typeOf[foo.type])`.
However, this does not check for by-name parameters, which cannot
form the basis for a singleton type, as we can see by trying that
directly:
```
scala> def foo(a: => String) { type T = a.type }
<console>:7: error: stable identifier required, but a.type found.
def foo(a: => String) { type T = a.type }
^
```
When I last touched this code in SI-6206 / 267650c, I noted:
// TODO reconcile the overlap between Typers#stablize and TreeGen.stabilize
I didn't get around to that, but Adriaan gave that code a thorough
cleanup in fada1ef.
It appears that on the back of his work, we can now remove the local
stabilization logic in `insertApply` in favour of `TreeGen.stabilize`.
We then avoid the ill-formed singleton type, and the spurious
"apply is not a member" type error.
I did have to modify `isStableIdent` to check the symbol's info
in addition to the tree's type for by-name-ness.
FiniteDuration.toCoarsest is declared with a return type of Duration even though it can only ever return a FiniteDuration. Change the declaration to return a FiniteDuration so that using this method doesn't require a cast or pattern match on the result in cases where a FiniteDuration is required.
Allow +,-,!,~ to be used as unprefixed identifiers. As prefix operators, they must be followed by a simple expression, so otherwise, consume the id itself as the start of a simple expression.
Allow deprecatedName to specify the name of the parameter
it qualifies.
This tells the user, That's my name, don't wear it out.
I.e., don't use my name when calling me.
Use cases include: the name will change; normally a name
should be provided for a boolean, but not in this case
(perhaps because there is only one argument).
```
scala> def f(@deprecatedName('foo) bar: String) = bar.reverse
f: (bar: String)String
scala> f(foo = "hello")
<console>:9: warning: the parameter name foo has been deprecated. Use bar instead.
f(foo = "hello")
^
res0: String = olleh
scala> def g(@deprecatedName('foo) foo: String) = foo.reverse
g: (foo: String)String
scala> g(foo = "hello")
<console>:9: warning: naming parameter foo has been deprecated.
g(foo = "hello")
^
res1: String = olleh
```
Enable simply:
```
scala> def f(@deprecatedName foo: String) = foo.reverse
f: (foo: String)String
scala> f(foo = "bar")
<console>:9: warning: naming parameter foo has been deprecated.
f(foo = "bar")
^
res0: String = rab
```
`Symbol.deprecatedParamName` conventionally returns `NO_NAME`
when the name is omitted.
Make a couple of functions and use cases for if-else if-else etc.
Also, add a ScalaCheck test.
`scala.collection.{JavaConversions, JavaConverters}` no longer wrap
a `null` collection, but return `null` instead. Before, a wrapper would
hold the original `null` collections, delaying the NPE until the first
operation on the collection was called, with no way of knowing whether we
were holding such a time bomb wrapper until the NPE was thrown.
For example, this now holds: `(null : java.util.Iterator[_]).asScala ==
null`. Before, a wrapper would silently be created that would NPE on any
further interaction.
An example of this issue in the wild can be seen at
scalafx/scalafx#178, and an example of code
that generates such a wrapper [before the issue was fixed](https://github.com/scalafx/scalafx/blob/ad60d5faee687b71d3c0474510d
3f3dd081ea351/scalafx/src/main/scala/scalafx/stage/FileChooser.scala#L138).
- The fact that StreamWithFilter was an inner class prevented
collection of the head during processing after #withFilter,
due to the reference to the outer class instance held in self.
- By implementing StreamWithFilter outside of the Stream class,
we gain control of the reference to the original Stream.
- We clarify explicit "filter after first use" semantics for the
reference to the original stream, which allows it to be GC'd
during the processing of foreach, map, and flatMap.
- Code is more DRY by implementing in terms of Stream#filter,
which is already correctly lazy, and then Stream's #map,
#flatMap, and #foreach, which already correctly allow GC.
- Unfortunately, the type returned by Stream#withFilter *must*
change, as it had previously inherited from the inner class
TraversableLike#WithFilter, which is where the problematic
reference to the outer class instance was held. Therefore,
this change is targetted to 2.12.x. There doesn't appear to
be any way to fix this without changing the type, sadly.
- Special thanks to @paulp who suggested the likely cause of the
issue at nescala 2015, and got me setup to build and run tests.
Also thanks to @Ichoran and @retronym, who suggested that
filter-after-first-use would preserve the reusable nature
of the return value from #withFilter, rather than a single-shot
null-after-first-use solution.
Review by @Ichoran and @retronym
Fixes scala#8990
Rather than leaving it until mixin. The current code in mixin is used for both lazy val and modules, and puts the "slow path" code that uses the monitor into a dedicated method (`moduleName$lzyCompute`). I tracked this back to a3d4d17. I can't tell from that commit whether the performance sensititivity was related to modules or lazy vals, from the commit message I'd say the latter. As the initialization code for a module is just a constructor call, rather than an arbitraryly large chunk of code for a lazy initializer, this commit opts to inline the `lzycompute` method.
retronym
added a commit
that referenced
this pull request
Aug 24, 2015
Calls to synthetic case class apply methods are inlined to the
underlying constructor invocation in refchecks.
However, this can lead to accessibility errors if the constructor
is private.
This commit ensures that the constructor is at least as accessible
as the apply method before performing this tranform.
I've manually checked that other the optimization still works in other
cases:
scala> class CaseApply { Some(42) }
defined class CaseApply
scala> :javap -c CaseApply
Compiled from "<console>"
public class CaseApply {
public CaseApply();
Code:
0: aload_0
1: invokespecial #9 // Method java/lang/Object."<init>":()V
4: new #11 // class scala/Some
7: dup
8: bipush 42
10: invokestatic #17 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
13: invokespecial #20 // Method scala/Some."<init>":(Ljava/lang/Object;)V
16: pop
17: return
}
retronym
added a commit
that referenced
this pull request
Dec 2, 2015
- Leave the members in the trait instead (these will be emitted as
default methods in the interface)
- Add the trait mixin constructor to the interface, rather than
the impl class
- Change the invocation of the mixin constructor to use an
invokespecial. This is encoded with the AST:
`Apply(Select(Super(_, _), mixinConstructor)))`
This compiles a simple example:
```
trait T {
def m = 42
}
class C extends T
object Test {
def main(args: Array[String]): Unit = {
assert(new C().m == 42)
}
}
```
To:
```
Compiled from "test.scala"
public interface T {
public void $init$();
Code:
0: return
public int m();
Code:
0: bipush 42
2: ireturn
}
Compiled from "test.scala"
public class C implements T {
public C();
Code:
0: aload_0
1: invokespecial #14 // Method java/lang/Object."<init>":()V
4: aload_0
5: invokespecial #17 // Method T.$init$:()V
8: return
}
```
We need to re-enable the "trait forwarder" method in `C`. Although
in this example we can rely on Java's method binding rules to call
the right `T.m`, in the general case when we have diamond inheritance
we need to encode Scala's linearization rules. Adriaan explained this
in some detail here:
https://groups.google.com/forum/#!topic/scala-internals/KnxCpSryrSM
For now I'm just starting with the happy path of public defs.
Fields, non-public members, will also need a good helping of finesse.
And modules, lazies.
retronym
added a commit
that referenced
this pull request
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 5, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 9, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 11, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 11, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 17, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 25, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
added a commit
that referenced
this pull request
May 30, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
May 30, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
May 31, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
May 31, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 1, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
added a commit
that referenced
this pull request
Oct 9, 2016
…lining
```
⚡ qscalac -opt:l:classpath -d /tmp sandbox/test.scala && javap -v -cp /tmp Test | cat -b | grep -i --color '$anonfun$test$1'
26 #17 = Utf8 $anonfun$test$1
27 #18 = NameAndType #17:#13 // $anonfun$test$1:()V
28 #19 = InterfaceMethodref #2.#18 // Test.$anonfun$test$1:()V
59 #50 = MethodHandle #6:#19 // invokestatic Test.$anonfun$test$1:()V
96 0: invokestatic #19 // InterfaceMethod $anonfun$test$1:()V
140 public static void $anonfun$test$1();
169 #50 invokestatic Test.$anonfun$test$1:()V
```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Back to refchecks.