Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2647

UnsupportedOperationException when decorating interface with default method

    XMLWordPrintable

    Details

      Description

      This may or may not be related to WELD-2638.

       We have generic interface which declares method getIdMapper:

      public interface EntityMapper<ID extends Serializable, DB extends GenericEntity<ID>, DTO extends REF, REF extends DTOEntity> {
          IdMapper<ID, String> getIdMapper();
      }
      

      An interface extending the EntityMapper interface with default implementation of getIdMapper:

      public interface ProductVersionMapper
              extends UpdatableEntityMapper<Integer, ProductVersion, org.jboss.pnc.dto.ProductVersion, ProductVersionRef> {
          @Override
          default IdMapper<Integer, String> getIdMapper() {
              return new IntIdMapper();
          }
      

      There is also generated implementation of ProductVersionMapper, but that one doesn't mention method getIdMapper.

      And now we added Decorator for the ProductVersionMapper interace (which also doesn't mention getIdMapper) and now we see following error when some code tries to call method getIdMapper:

      Caused by: org.jboss.weld.exceptions.UnsupportedOperationException: 
      	at org.jboss.weld.core@3.1.4.Final-redhat-00001//org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:49)
      	at deployment.ear-package-2.0.1-SNAPSHOT.ear.mapper.jar//org.jboss.pnc.mapper.ProductVersionMapperImpl$Proxy$_$$_WeldSubclass.getIdMapper(Unknown Source)
      	at deployment.ear-package-2.0.1-SNAPSHOT.ear.mapper.jar//org.jboss.pnc.mapper.ProductVersionMapperImpl$Proxy$_$$_WeldClientProxy.getIdMapper(Unknown Source)
      	at deployment.ear-package-2.0.1-SNAPSHOT.ear.mapper.jar//org.jboss.pnc.mapper.RefToReferenceMapper.toEntityReference(RefToReferenceMapper.java:176)
      	at deployment.ear-package-2.0.1-SNAPSHOT.ear.mapper.jar//org.jboss.pnc.mapper.RefToReferenceMapper$Proxy$_$$_WeldSubclass.toEntityReference$$super(Unknown Source)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	---SNIP---
      

      I attached an archive with the related classes.

        Attachments

          Activity

            People

            Assignee:
            manovotn Matěj Novotný
            Reporter:
            janinko Honza Brázdil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: