title: Simulate Default ("Defender") Methods in Android Studio
body: <p>Android Studio does not support Java 8 default methods.
  Is it possible to achieve their functionality though different means?</p>
  
  <p>I've got the code working in a Java IDE. I'm trying to port the following functionality to Android Studio.</p>
  
  <hr>
  
  <p><em>(In the context of a tick-based animation loop.)</em></p>
  
  <p>Simplified, the relevant architecture revolves around four things:</p>
  
  <ol>
  <li>A 'pure' interface (<code>Common</code>) that has getters for the instance variables</li>
  <li>An abstract class (<code>anObject</code>), that extends <code>Common</code> and implements all of its getters, with an <code>updateMe()</code> method which is defined as calling a series of abstract methods.</li>
  <li>Other interfaces that extend <code>Common</code>, where each describes an attribute that affects how <code>anObject</code> would react while executing its abstract methods.</li>
  <li>Concrete classes that extend <code>anObject</code> and implement a number of the attribute interfaces.</li>
  </ol>
  
  <p>The animation loop calls <code>updateMe(...)</code> on each object instance on every tick, which is implemented as a method in <code>anObject</code> as in turn calling the <code>anObject</code> abstract methods (for the sake of the question, just <code>moveMe()</code> and <code>drawMe(...)</code>) on itself.</p>
  
  <p>Now creating composite objects to interact with becomes wonderfully simple:</p>
  
  <pre><code>Ball extends anObject implements isRound, isMobile
  </code></pre>
  
  <p>Interface <code>isRound</code> provides a default implementation for <code>drawMe(..)</code> which uses the getters in <code>Common</code> (implemented in <code>anObject</code>) to grab the object's instance variables and then execute a <code>drawOval(...)</code> command. </p>
  
  <p>Similarly, <code>isMobile</code> implements the abstract <code>moveMe()</code> for <code>Ball</code> that was inherited from <code>anObject</code>.</p>
  
  <p>Oversimplified, but there it is. It makes governing behaviors of a multitude of objects simplistic. My full code has collision checking, player input, etc. With only minor code additions, default methods let you add entirely new games and features. What started out as a Pong assignment now has the ability to be Snake, PacMan, add multiple balls, etc. It seems to be an incredibly powerful resource.  </p>
  
  <p><strong>So, how do I get the functionality of these 'attribute' interfaces into android if I cannot use default methods?</strong> It's essentially allowing multiple and non-linear inheritance.</p>
  
  <p>After writing this it occurs to me that I can just copy/paste the relevant method each time I want an interface to populate it downward, but that is fairly ham-fisted and has the potential to make changes and versioning a living nightmare. I'd still like to see if anyone has a better solution.</p>