Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5732

Delegating to an abstract class hierarchy doesn't implement interfaces at a higher level

    Details

      Description

      Given:

      public interface Field {	
      	public void aFieldMethod();
      }
      

      and the classes:

      public abstract class AbstractBaseClass implements Field {
      }
      
      public abstract class DelegatedClass extends AbstractBaseClass {
      }
      
      class Delegator {
      	@Delegate private DelegatedClass delegate
      }
      

      then

      assert Field.isAssignableFrom(Delegator)
      

      fails. If Delegator is defined as

      class Delegator {
      	@Delegate private AbstractBaseClass delegate
      }
      

      the test succeeds

        Attachments

        1. AbstractBaseClass.java
          0.3 kB
          Paul Bennett
        2. DelegatedClass.java
          0.3 kB
          Paul Bennett
        3. DelegationTest.groovy
          0.7 kB
          Paul Bennett
        4. Delegator.groovy
          0.3 kB
          Paul Bennett
        5. Field.java
          0.3 kB
          Paul Bennett

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              prajnainc Paul Bennett
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: