Skip to content

Generate static forwarders in interfaces #59

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
retronym opened this issue Oct 20, 2015 · 0 comments
Closed

Generate static forwarders in interfaces #59

retronym opened this issue Oct 20, 2015 · 0 comments
Assignees
Milestone

Comments

@retronym
Copy link
Member

Now that the JVM supports static methods in interfaces, we can generate forwarders for methods in a module companioned by a trait.

retronym added a commit to retronym/scala that referenced this issue Oct 20, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Oct 21, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59

I had to disable use of the lambda deserialization refletion cache
when in interfaces, as this change revealed a latent design issue
with our lambda deserialization approach. Disabling the cache isn't
a correctness problem, but hampers performance.
retronym added a commit to retronym/scala that referenced this issue Oct 30, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 9, 2015
The previous encodings eagerly created static fields (for caches)
in the enclosing class, but this isn't an option once we start to
emit code in interface default methods.

Generate static forwarders for object members in companion interface

We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 9, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 9, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 9, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 9, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 14, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 15, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Dec 15, 2015
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Jan 19, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Jan 19, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Jan 28, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 12, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 17, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 18, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 18, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 23, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 24, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 24, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue Feb 25, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
@retronym retronym added this to the 2.12.0-M5 milestone Apr 27, 2016
@retronym retronym self-assigned this Apr 27, 2016
retronym added a commit to retronym/scala that referenced this issue Apr 27, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

I've only commited the test using the default backend (GenBCode), but
I've also made the change and manaully verified the test works under
the soon-to-be-removed GenASM.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue May 19, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

```
% qscalac -Ybackend:GenASM test/files/run/trait-static-forwarder/forwarders.scala && javac -d . -classpath . test/files/run/trait-static-forwarder/Test.java && qscala Test
./T.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature': class file for scala.reflect.ScalaSignature not found
1 warning
42
```

Fixes scala/scala-dev#59
retronym added a commit to retronym/scala that referenced this issue May 19, 2016
We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

Fixes scala/scala-dev#59
lrytz pushed a commit to scala/scala that referenced this issue May 19, 2016
…5131)

We used to disable generation of static forwarders when a object had a
trait as a companion, as one could not add methods with bodies to an
interface in JVM 6.

The JVM lifted this restriction to support default methods in interfaces,
so we can lift the restriction on static forwarders, too.

Fixes scala/scala-dev#59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant