Skip to content

Objects.toString() with null default does not return an error #1282

@gulikoza

Description

@gulikoza

I expected this code to report an error:

public class ObjectsTest {

    public static int testFunc(String a) {
        return a.length();
    }

    public static int runT() {
        Object s = null;
        return testFunc(Objects.toString(s, null));
    }
}

testFunc() does not receive a @Nullable and Objects.toString() with null nullDefault should not satisfy the null check.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions