Skip to content

Conversation

bc-lee
Copy link

@bc-lee bc-lee commented Sep 23, 2025

Previously, the checker only accepted arrayOffset() calls or safe constructors. Now it also accepts array() calls when properly guarded by hasArray() checks in if/else conditions.

Valid patterns now recognized:

  • if (buffer.hasArray()) { buffer.array(); }
  • if (!buffer.hasArray()) { ... } else { buffer.array(); }

Fixes #5241

Previously, the checker only accepted arrayOffset() calls or safe constructors.
Now it also accepts array() calls when properly guarded by hasArray() checks
in if/else conditions.

Valid patterns now recognized:
- if (buffer.hasArray()) { buffer.array(); }
- if (!buffer.hasArray()) { ... } else { buffer.array(); }
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.

ByteBufferBackingArray should recognize hasArray() guards
1 participant