No enclosing instance of type ITask is accessible.
<p>I would like to make abstract class which has several inner classes extend it and could create  instances of its inner classes via static methods but I get compiler error "No enclosing instance of type ITask is accessible. Must qualify the allocation with an enclosing instance of type ITask (e.g. x.new A() where x is an instance of ITask)."</p>

<p>I've <a href="http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html" rel="nofollow">found out</a> that inner classes should be created by instances of outer class but my outer class has abstract method and I can't create instance of it. I made inner classes which extend parent because I wont to control creation of them.
So is there any way how to make my pattern works.</p>

<p>My code:</p>

<pre><code>public abstract class ITask {
public abstract void Execute(Subscriber itm);

static public ITask CreateSendTask(Buffer buffer)
{
    return new SendData(buffer);
}

static public ITask CreateSTTask(Ticket sid)
{
    return new StartTransmission(sid);
}

static public ITask CreateETTask(Ticket sid)
{
    return new EndTransmission(sid);
}


private class SendData extends ITask
{
         /// some implemetation...
}

private class StartTransmission extends ITask
{
         /// some implemetation...
}

private class EndTransmission extends ITask
{
    /// some implemetation...
}
</code></pre>

<p>}</p>

<p>The problem is with methods Create(.*)Task.</p>

<p>Thanks!</p>
