Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function created with Reflect.makeVarArgs() crashes on Java when calling with no args #9037

Closed
ckentgeorge opened this issue Dec 15, 2019 · 0 comments

Comments

@ckentgeorge
Copy link

@ckentgeorge ckentgeorge commented Dec 15, 2019

This is a regression from Haxe 3. The following code builds with Haxe 4.0.3 but crashes with Exception in thread "main" java.lang.NullPointerException when run. This problem is not present on the JS or C++ targets.


class Main
{
   public static function main()
   {
      var f = 
         (args:Array<Dynamic>) ->
         {
            if (args != null)
            {
               trace('Received ${args.length} args:');
               for (arg in args)
               {
                  trace(' - $arg');
               }
            }
            else
            {
               trace('Argument array was null.');
            }
         };
      var f:Dynamic = Reflect.makeVarArgs(f);
      f('hello');
      // This line crashes on Java target.
      f();
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.