Skip to content

Empty Array Can Not Be Converted to VarArgs #143

@Absolutionism

Description

@Absolutionism

Describe the bug
When attempting to use an empty array new Class[0] as a parameter for a method in the position of var args, an ArrayIndexOutOfBoundsException is thrown.

To reproduce

import:
	ch.njol.skript.lang.function.FunctionRegistry
	java.lang.Class
	
function test():
	broadcast "Filler"
	
on load:
	set {_registry} to FunctionRegistry.getRegistry()
	set {_result} to {_registry}.getFunction({_null}, "test", new Class[0])

Expected behavior
The empty array to be an acceptable type for a var args paraameter and not throw ArrayIndexOutOfBoundsException

Screenshots

Image

Server information

  • skript-reflect: 2.6.1-pre1 (Pickle sent)
  • Skript: dev/feature

Additional context
In correlation of SkriptLang/Skript#8031 as a function with no parameters is registered with an empty array rather than null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions