title: Java interface "Alias"
body: <p>Consider the following two Java files that contain a simplified version of my issue</p>
  
  <pre><code>#a.java
  package a;
  public interface I {
   //...
  }
  
  #b.java
  package b;
  public interface I {
   //... (different stuff from a.I)
  }
  </code></pre>
  
  <p>You'll notice within my project there are two interfaces named "I". This cannot be changed.
  I am in a situation where I need to use both types inside a single class. Now of course, I could just reference each of their types as a.I and b.I, but I'm trying to avoid it for nothing other than maintaining readability.  </p>
  
  <p>I want to do something like this</p>
  
  <pre><code>interface B extends b.I {
  
  }
  </code></pre>
  
  <p>This could let me use the interface of I by using B and, and a.I as just I by importing. The problem is that this doesn't work, let's take this concrete example using </p>
  
  <pre><code>interface MyList extends List&lt;String&gt; {
  }
  
  MyList l = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>This yields a type error. Why doesn't Java "know" that MyList extends List? </p>
  
  <p>Also, I've tried casting in the above example, but it generates a ClassCastException</p>
  
  <p>Thoughts?</p>