Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[java] Closure in constructor breaks assumption #2688

Open
singpolyma opened this Issue · 3 comments

4 participants

@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();
      };
   }
}
@waneck waneck self-assigned this
@waneck
Owner

Can you provide an example with no dependencies?

@singpolyma

Sure:

class Main<A> extends java.lang.Object {
   private var task:Array<A> -> Void;
   public function new(tsk:Void -> Void) {
      super();
      task = function(x) {
         tsk();
      };
   }
}
@Simn
Owner

I guess that's an issue on all WrapRef targets?

@ncannasse ncannasse added this to the 3.2 milestone
@waneck waneck modified the milestone: 3.3, 3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.