7 Replies Latest reply on Aug 21, 2009 10:20 AM by Ausi Freak

    Interfaces Extending Interfaces Problem?

    Ausi Freak

      Hey everyone,

      I have a problem that could effect anyone who is using interfaces that extends other interfaces.

       

      Check this out:

       

      If I have an interface IHuman that extends three interfaces IMortal, ILimbed and IHealth:

       

      package
      {
           public interface IHuman extends IMortal, ILimbed, IHealth
           {
                
           }
      }
      

       

      Extends

      package
      {
           public interface IMortal
           {
                function spawn():void;
                function die():void;
           }
      }
      
      package
      {
           public interface ILimbed
           {
                function sprint():void;
                function walk():void;
                function crouch():void;
           }
      }
      
      package
      {
           public interface IHealth
           {
                function set health( value:Number ):void;
                function get health():Number;
           }
      }
      
      

       

      Now when the code is generated for the Human class when the IHuman interface is implimented, CHECK THIS OUT!

       

      package
      {
           public class Human implements IHuman
           {
                public function Human()
                {
                }
      
                public function spawn():void
                {
                }
                
                public function sprint():void
                {
                }
                
                public function set health(value:Number):void
                {
                }
                
                public function die():void
                {
                }
                
                public function walk():void
                {
                }
                
                public function get health():Number
                {
                     return 0;
                }
                
                public function crouch():void
                {
                }
                
           }
      }
      

       

      The functions are all over the place, it becomes an interface pasta! Now, I dont know if there is a preference for this. But I have been looking all day, and I have found no solution to this code generation problem.

      This is not helpful code generation, it simply throws the interfaced functions around in your class, and becomes a real hastle to re-organize.


      Does anyone have a solution to this really odd code generation problem?
      Cheers

      --
      Nick