polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niclas Hedhman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POLYGENE-251) Support Java 8 default methods on interfaces
Date Mon, 15 May 2017 10:57:04 GMT

    [ https://issues.apache.org/jira/browse/POLYGENE-251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010318#comment-16010318

Niclas Hedhman commented on POLYGENE-251:

Oh, it happens for the greeting() method, which shouldn't be applied... Ok, so the AppliesToFilter
is not working? The InterfaceDefaultMethodsMixin should have been appliedTo the greetings()
method. Must have been doing something wrong there. Yes, the AppliesToFilter is never consulted.

Ahhhh. I think I have found a different bug.

When the concern is doing greetings(), it is not calling the Composite's greetings() method,
but the underlying Mixin's greetings() method, which in this case doesn't exist. And in the
case of abstract Mixin implementation classes, those methods are autogenerated, and all methods
are overridden in mixin implementation classes, to delegate back to the Composite's methods.

So, it is actually a edge case of what the GenericFragmentInvocationHandler should do (now
it calls "down" and not the composite's method) and it just happens to work the way it is
written. So to make this work, the InterfaceDefaultMethodMixin needs to check if it is supposed
to handle a method coming, and if not, then delegate back to that method on the Composite.

YES! That worked.

> Support Java 8 default methods on interfaces
> --------------------------------------------
>                 Key: POLYGENE-251
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-251
>             Project: Polygene
>          Issue Type: Bug
>            Reporter: Paul Merlin
>            Assignee: Niclas Hedhman
>            Priority: Blocker
>             Fix For: 3.0
> The following composite declaration:
> {code}
> public interface DefaultMethods
> {
>     default String sayHello( String name )
>     {
>         return "Hello, " + name + '!';
>     }
> }
> {code}
> fails at assembly with:
> {code}
> Composition Problems Report:
>     message: No implementation found for method 
>     method: String sayHello(String name)
> {code}
> See {{InterfaceDefaultMethodsTest}} in {{core/runtime}}
> Also see POLYGENE-120 for some preliminary investigation.

This message was sent by Atlassian JIRA

View raw message