Skip to content

[java] Closure in constructor breaks assumption #2688

@singpolyma

Description

@singpolyma

The following code says "Types that derive from a native class must have its super() call as the first statement in the constructor" and generates code where the extra variables generated for the closure come before the super call, even though the super call is clearly first in my code:

private enum Unit {
   Unit;
}

class AsyncTask<A> extends android.os.AsyncTask<A,Unit,Unit> {
   private var task:Array<A> -> Void;

   public function new(tsk:Void -> Void) {
      super();
      task = function(x) {
         tsk();
      };
   }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions