8000 Issue/5117 by szeiger · Pull Request #14 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Issue/5117 #14

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

Merged
merged 2 commits into from
Dec 2, 2011
Merged

Issue/5117 #14

merged 2 commits into from
Dec 2, 2011

Conversation

szeiger
Copy link
Contributor
@szeiger szeiger commented Dec 2, 2011

Make Enumeration.ValueSet Serializable

Closes SI-5117.

(depends on #13)

- Make Enumeration.ValueSet a SortedSet and back it by a BitSet
- Add toBitMask and fromBitMask methods for value sets
- Add an Ordering for the values
- Deprecate names seq in the Enumeration constructor
- Add + method to Value for easy ValueSet creation
@paulp paulp merged commit 66b6ad4 into scala:master Dec 2, 2011
heathermiller added a commit that referenced this pull request Apr 15, 2012
heathermiller pushed a commit to heathermiller/scala that referenced this pull request Oct 11, 2012
scala.reflect.api.Position documentation
retronym referenced this pull request in retronym/scala May 7, 2014
lrytz pushed a commit to lrytz/scala that referenced this pull request May 20, 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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokespecial scala#17                 // Method T.$init$:()V
[info]        8: getstatic     scala#23                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#24                 // String C
[info]       13: invokevirtual scala#28                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokespecial scala#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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokestatic  scala#18                 // Method T.$init$:(LT;)V
[info]        8: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#25                 // String C
[info]       13: invokevirtual scala#29                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokestatic  scala#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  scala#15                 // Method foo:(LT;)I
[info]        4: ireturn
[info]
[info]   public static void $init$(T);
[info]     Code:
[info]        0: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]        3: ldc           scala#25                 // String T
[info]        5: invokevirtual scala#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  scala#32                 // Method $init$:(LT;)V
[info]        4: return
[info] }
```
lrytz pushed a commit to lrytz/scala 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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokespecial scala#17                 // Method T.$init$:()V
[info]        8: getstatic     scala#23                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#24                 // String C
[info]       13: invokevirtual scala#28                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokespecial scala#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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokestatic  scala#18                 // Method T.$init$:(LT;)V
[info]        8: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#25                 // String C
[info]       13: invokevirtual scala#29                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokestatic  scala#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  scala#15                 // Method foo:(LT;)I
[info]        4: ireturn
[info]
[info]   public static void $init$(T);
[info]     Code:
[info]        0: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]        3: ldc           scala#25                 // String T
[info]        5: invokevirtual scala#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  scala#32                 // Method $init$:(LT;)V
[info]        4: return
[info] }
```
lrytz pushed a commit to lrytz/scala 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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokespecial scala#17                 // Method T.$init$:()V
[info]        8: getstatic     scala#23                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#24                 // String C
[info]       13: invokevirtual scala#28                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokespecial scala#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 scala#14                 // Method java/lang/Object."<init>":()V
[info]        4: aload_0
[info]        5: invokestatic  scala#18                 // Method T.$init$:(LT;)V
[info]        8: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]       11: ldc           scala#25                 // String C
[info]       13: invokevirtual scala#29                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]       16: aload_0
[info]       17: invokestatic  scala#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  scala#15                 // Method foo:(LT;)I
[info]        4: ireturn
[info]
[info]   public static void $init$(T);
[info]     Code:
[info]        0: getstatic     scala#24                 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info]        3: ldc           scala#25                 // String T
[info]        5: invokevirtual scala#29                 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info]        8: return
[info]
[info] }
```
OlivierBlanvillain pushed a commit to OlivierBlanvillain/scala that referenced this pull request Jun 27, 2017
Drop internalNameString and make javaBinaryName return a String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0