Does this seem like a bug to anyone else? In a Jav...
# announcements
k
Does this seem like a bug to anyone else? In a Java library the annotations were just switched from jsr305 to jetbrains. There's a getter method defined like this:
Copy code
/**
     * Get the value of the OutputArguments Property, if it exists.
     *
     * @return the value of the OutputArguments Property, if it exists.
     * @see MethodNodeProperties#OutputArguments
     */
    @Nullable
    public Argument[] getOutputArguments() {
        return getProperty(MethodNodeProperties.OutputArguments).orElse(null);
    }
Now in some Kotlin code that uses this library it is inferring the type to be
Array<Argument?>?
instead of
Array<Argument>?
as it did previously. So now what was once:
Copy code
override fun getOutputArguments(): Array<Argument> = methodNode.outputArguments ?: emptyArray()
now won't compile unless it's changed to something like this:
Copy code
override fun getOutputArguments(): Array<Argument> {
    val outputArguments: Array<Argument>? =
        methodNode.outputArguments as Array<Argument>?

    return outputArguments ?: emptyArray()
}
Hmm, compiles fine via Gradle
must be yet another Kotlin compiler front end bug
a
would have thought it should be seen as
Array<Argument!>?
absent any other information about the array elements being nullable
k
Yes, that's how I expect it to be seen as well.
I do get a warning when building with gradle, but not an error as I do in the IDE