Skip to content

Matchers.isSubtypeOf always matches literal null #1397

@carterkozak

Description

@carterkozak

ATTENTION! Please read and follow:

Description of the problem / feature request:

Matchers.isSubtypeOf always matches literal null. This would be correct if we were validating that the value can be cast to the requested type, however literal null should not match isSubtypeOf in most cases.
It's arguable that it could be matched for types Void and Object.

Feature requests: what underlying problem are you trying to solve with this feature?

Either return false for null in most cases, or provide javadoc describing the issue.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

isSubtypeOf check on any null literal.

What version of Error Prone are you using?

2.3.3

Have you found anything relevant by searching the web?

No, I don't believe this has been reported yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions