Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have a collegue which has a similar problem in real code. There, he has an abstract base class with 2 type parameters that has two subclasses fixing them to concrete types. Basically, this allows for defining the complete logic in the abstract class instead of having to duplicate the code in both subclasses with swapped concrete types.</p> <p>Basically, the code is something along these lines:</p> <pre><code>public abstract class AImpl&lt;X extends A&lt;Y&gt;, Y extends A&lt;X&gt;&gt; { public X foo(Y o) { return o.doStuff(); } public Y bar(X o) { return o.doStuff(); } } class VImpl extends AImpl&lt;V, E&gt; {} class EImpl extends AImpl&lt;E, V&gt; {} interface A&lt;T&gt; { T doStuff(); } interface V extends A&lt;E&gt; {} interface E extends A&lt;V&gt; {} </code></pre> <p>This code actually compiles. In reality, there are not just 2 subclasses, but a deeper type hierarchy, e.g., three variants of VImpl and EImpl, each of which have arbitrary many subclasses. Well, and actually, there are 3 type parameters, and the restrictions are a bit more complicated as shown above.</p> <p>When there were only two variants of VImpl and EImpl, it still compiled fine. As soon as the third variants were added, he got that stack overflow in the compiler. That said, the Eclipse compiler is still able to compile the code, so it seems that it's simply <em>javac</em> doing something recursively which it should better do iteratively.</p> <p>Unfortunately, we are not able to reduce the complete code base to some minimal example suitable for a bug report...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload