Calling overloaded method passing null argument

You are browsing legacy Javonet 1.5 (Java<>.NET bridge for Windows) documentation. Use the left side menu or click here to switch to latest Javonet 2.0 documentation. Javonet 2.0 allows you to use any module from JVM, CLR, Netcore, Python, Ruby, Perl, NodeJS on Windows, Linux and MacOs from any application created in Java, Clojure, Groovy, Kotlin, C#, F#, J#, VB.NET, Python, Perl, Ruby, JavaScript, TypeScript, C++ and GoLang

In some cases you might need to call a method - that has multiple overloads with the same number of arguments - passing null. Considering following case:

Select technology of module you want to use:

If you call MethodA passing "null" as argument .NET side will not be able to resolve which method should be called as in both overloads null can be passed. Ambigous invocation exception will be thrown. To overcome this issue Javonet introduces "NNull" type which allows to pass type-specific null value.

How to call .NET method passing type-specific null value:

I code in:

Select technology of module you want to use:

See Live Example!