Skip to content

Commit

Permalink
Optimize argument array creation in reflection call
Browse files Browse the repository at this point in the history
  • Loading branch information
udalov committed Sep 5, 2016
1 parent c422de7 commit d0d1824
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ internal abstract class FunctionCaller<out M : Member>(
class InstanceMethod(method: ReflectMethod) : Method(method) {
override fun call(args: Array<*>): Any? {
checkArguments(args)
return callMethod(args[0], args.asList().subList(1, args.size).toTypedArray())
return callMethod(args[0], args.copyOfRange(1, args.size))
}
}

class JvmStaticInObject(method: ReflectMethod) : Method(method, requiresInstance = true) {
override fun call(args: Array<*>): Any? {
checkArguments(args)
checkObjectInstance(args.firstOrNull())
return callMethod(null, args.asList().subList(1, args.size).toTypedArray())
return callMethod(null, args.copyOfRange(1, args.size))
}
}

Expand Down

0 comments on commit d0d1824

Please sign in to comment.