When Interface A defines Interface B in its method signature
<p>... how can I restrict an implementation of A to use a certain implementation of B in the method signature?</p>

<p><strong><em>Use Case</em></strong></p>

<p>Here is a <code>Unit</code> interface and two enums that implement it:</p>

<pre><code>public interface Unit { ... }

public enum ForceUnit implements Unit { ... }
public enum MassUnit implements Unit { ... }
</code></pre>

<p>Which is used by the <code>Property</code> interface:</p>

<pre><code>public interface Property {

    public void setUnit( Unit unit );    // for example
}

public class Force implements Property { ... }
public class Mass implements Property { ... }
</code></pre>

<p>Here I want to be able to enforce that:</p>

<ul>
<li><code>Force</code> uses only <code>ForceUnit</code> in the <code>setUnit</code> signature</li>
<li><code>Mass</code> uses only <code>MassUnit</code> in the <code>setUnit</code> signature</li>
</ul>

<hr>

<p>When I try to do this, Eclipse complains:</p>

<blockquote>
  <p>The type <code>Mass</code> must implement the inherited abstract method <code>Property.setUnit(unit)</code></p>
</blockquote>

<p>And promptly suggests two quick fixes:</p>

<ul>
<li>make the class abstract, which is not an option since I want to be able to do stuff like <code>Mass mass = new Mass();</code></li>
<li>add the unimplemented methods with an <code>@Override</code> annotation. I don't know if this is the right fix, but to me this smacks of clumsiness.</li>
</ul>

<hr>

<h2>Questions</h2>

<ul>
<li>What options do I have to achieve what I want? Would the use of generics help here?</li>
<li>Why does marking the class as abstract resolve the issue?</li>
</ul>