tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Niederwieser (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (TAP5-2340) Make proxies honor Java 8 default methods
Date Tue, 27 May 2014 13:38:01 GMT

     [ https://issues.apache.org/jira/browse/TAP5-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Peter Niederwieser updated TAP5-2340:
-------------------------------------

          Description: 
MyInterface.java:
{code}
public interface MyInterface {
  default int compute() { return 42; }
}
{code}

PlasticSpec.groovy:
{code}
class PlasticSpec extends Specification {
  def "plastic proxy for interface with default method"() {
    def manager = PlasticManager.withClassLoader(getClass().classLoader).create()
    def proxy = manager.createProxy(MyInterface, {})
    def impl = proxy.newInstance()

    expect:
    impl.compute() == 42 // fails; actual: 0
  }

  def "manual implementation of interface with default method"() {
    def impl = new MyInterface() {}

    expect:
    impl.compute() == 42 // passes
  }
}
{code}

Tested with 5.4-beta-6.

  was:
MyInterface.java:
{code}
public interface MyInterface {
  default int compute() { return 42; }
}
{code}

PlasticSpec.groovy:
{code}
class PlasticSpec extends Specification {
  def "plastic proxy for interface with default method"() {
    def manager = PlasticManager.withClassLoader(getClass().classLoader).create()
    def proxy = manager.createProxy(MyInterface, {})
    def impl = proxy.newInstance()

    expect:
    impl.compute() == 42 // fails; actual: 0
  }

  def "manual implementation of interface with default method"() {
    def impl = new MyInterface() {}

    expect:
    impl.compute() == 42 // passes
  }
}
{code}

    Affects Version/s: 5.4

> Make proxies honor Java 8 default methods
> -----------------------------------------
>
>                 Key: TAP5-2340
>                 URL: https://issues.apache.org/jira/browse/TAP5-2340
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: plastic
>    Affects Versions: 5.4
>            Reporter: Peter Niederwieser
>
> MyInterface.java:
> {code}
> public interface MyInterface {
>   default int compute() { return 42; }
> }
> {code}
> PlasticSpec.groovy:
> {code}
> class PlasticSpec extends Specification {
>   def "plastic proxy for interface with default method"() {
>     def manager = PlasticManager.withClassLoader(getClass().classLoader).create()
>     def proxy = manager.createProxy(MyInterface, {})
>     def impl = proxy.newInstance()
>     expect:
>     impl.compute() == 42 // fails; actual: 0
>   }
>   def "manual implementation of interface with default method"() {
>     def impl = new MyInterface() {}
>     expect:
>     impl.compute() == 42 // passes
>   }
> }
> {code}
> Tested with 5.4-beta-6.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message