Skip to content

Conversation

@thisisalexandercook
Copy link

@thisisalexandercook thisisalexandercook commented Jun 27, 2025

This PR adds the componentType() method to the @EnsureNonNull annotation expression list attached to the isArray() method. componentType() is indicated as equivalent to getComponentType() which is already included in this expression list.

Copy link
Member

@aosen-xiong aosen-xiong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@wmdietl wmdietl changed the title Include component() in isArray() @EnsureNonNullIf annotation j.l.Class: include componentType() in isArray() @EnsureNonNullIf` annotation Jun 27, 2025
@wmdietl wmdietl changed the title j.l.Class: include componentType() in isArray() @EnsureNonNullIf` annotation j.l.Class: include componentType() in isArray() @EnsureNonNullIf annotation Jun 27, 2025
Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@wmdietl
Copy link
Member

wmdietl commented Jun 27, 2025

One thing to test: componentType() was added in JDK 12.
Do we produce some warning about a missing method if we run on an older JDK?
That is, can you test whether calling isArray produces a warning on a JDK that doesn't have componentType()?

In general, we probably want warnings about contracts that refer to methods that don't exist. But for the JDK we need some special handling.
But we're not type checking older versions of the JDK, so that doesn't affect us here.

So we just need to make sure whether we get a warning on the use of a method that uses a non-existing method in a contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants