[toolbox] Cannot invoke Java vararg constructor

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[toolbox] Cannot invoke Java vararg constructor

Jerzy Muller
When I try to invoke Java vararg constructor in toolbox typecheck fails - it needs Array[T] to be passed as an argument:

scala> toolbox.typecheck(toolbox.parse("new debug.JavaVarArg(1)"))
.tools.reflect.ToolBoxError: reflective typecheck has failed: type mismatch;
: Int(1)
: Array[Integer]

Standard methods taking varargs works ok:

scala> toolbox.typecheck(toolbox.parse("java.util.Arrays.asList(1,2,3)"))
: toolbox.u.Tree = java.util.Arrays.asList[Int](1, 2, 3)

I logged Jira for it here: https://issues.scala-lang.org/browse/SI-9212

You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.