Skip to content

Conversation

@kevinherron
Copy link
Collaborator

What problem(s) was I solving?

The existing API used method overloading to distinguish between primitive arrays (byte[], int[], etc.) and their boxed counterparts (Byte[], Integer[], etc.). This approach had two issues:

  1. API clarity: Overloaded methods like setByteArray(T, int, byte[]) and setByteArray(T, int, Byte[]) can be confusing and error-prone, especially when working with generics or reflection
  2. Missing getters: There were no getter methods for boxed arrays - only setters existed for boxed types

What user-facing changes did I ship?

Breaking change: Renamed all boxed array setter methods to use explicit "Boxed" naming:

  • setBooleanArray(T, int, Boolean[])setBoxedBooleanArray(T, int, Boolean[])
  • setByteArray(T, int, Byte[])setBoxedByteArray(T, int, Byte[])
  • setShortArray(T, int, Short[])setBoxedShortArray(T, int, Short[])
  • setIntArray(T, int, Integer[])setBoxedIntArray(T, int, Integer[])
  • setLongArray(T, int, Long[])setBoxedLongArray(T, int, Long[])
  • setFloatArray(T, int, Float[])setBoxedFloatArray(T, int, Float[])
  • setDoubleArray(T, int, Double[])setBoxedDoubleArray(T, int, Double[])

New feature: Added getter methods for all boxed array types:

  • getBoxedBooleanArray(T, int, int)
  • getBoxedByteArray(T, int, int)
  • getBoxedShortArray(T, int, int)
  • getBoxedIntArray(T, int, int)
  • getBoxedLongArray(T, int, int)
  • getBoxedFloatArray(T, int, int)
  • getBoxedDoubleArray(T, int, int)

How I implemented it

  1. Updated ByteOps interface with renamed setter methods and new getter method signatures
  2. Implemented the getter methods in AbstractByteOps using loops that call the corresponding single-value getters
  3. Renamed setter implementations in AbstractByteOps to match new method names
  4. Updated UnsignedByteOps delegate wrapper to use the new method names

How to verify it

Manual Testing

  • Run mvn clean test - all tests pass

Description for the changelog

Add explicit "Boxed" naming for boxed array operations and introduce getter methods for boxed arrays (getBoxedBooleanArray, getBoxedByteArray, etc.). This is a breaking change that renames existing boxed array setters from overloaded names to explicit setBoxed*Array names.

Rename set methods for boxed arrays (Boolean[], Byte[], Short[], Integer[],
Long[], Float[], Double[]) from overloaded names to explicit "Boxed" names
(e.g., setByteArray -> setBoxedByteArray) for API clarity.

Add corresponding getter methods for boxed arrays (getBoxedBooleanArray,
getBoxedByteArray, etc.) that return object arrays instead of primitives.
@kevinherron kevinherron merged commit ccd79db into master Dec 30, 2025
1 check passed
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.

2 participants