aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Dutertry (JIRA)" <>
Subject [jira] [Created] (ARIES-1849) Aries proxy does not work with interface default methods
Date Thu, 18 Oct 2018 08:48:00 GMT
Nicolas Dutertry created ARIES-1849:

             Summary: Aries proxy does not work with interface default methods
                 Key: ARIES-1849
             Project: Aries
          Issue Type: Bug
          Components: Proxy
    Affects Versions: proxy-impl-1.1.2
            Reporter: Nicolas Dutertry

Since Java 8 it is possible to define default implementations inside interface definition.

It seems that Aries proxy is not compatible with interface default methods. As a result it
is not possible to use a blueprint reference to a service implementing an interface with default

The following unit test demonstrate the issue :
import java.util.Collections;
import org.apache.aries.proxy.UnableToProxyException;
import org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator;
import org.junit.Assert;
import org.junit.Test;

public class InterfaceProxyGeneratorTest {
    public static interface Service {
        String getName();
        default String getValue() {
            return "default";
    public static class ServiceImpl implements Service {
        public String getName() {
            return "serviceimpl";
        public String getValue() {
            return "value";
    public void testProxy() throws UnableToProxyException {
        ServiceImpl serviceImpl = new ServiceImpl();
        Assert.assertEquals("serviceimpl", serviceImpl.getName());
        Assert.assertEquals("value", serviceImpl.getValue());
        Service proxy = (Service)InterfaceProxyGenerator.getProxyInstance(
            null, null, Collections.singleton(Service.class),
            () -> {
                return serviceImpl;
        Assert.assertEquals("serviceimpl", proxy.getName());
        Assert.assertEquals("value", proxy.getValue());

This message was sent by Atlassian JIRA

View raw message