Skip to content

Conversation

@kevinherron
Copy link
Contributor

@kevinherron kevinherron commented May 23, 2025

Allow boxed update values to be written into primitive current values and primitive update values to be written into boxed current values.

fixes #1476

Allow boxed update values to be written into primitive current value and primitive update values to be written into boxed current values.

fixes #1476
@kevinherron kevinherron requested a review from Copilot May 23, 2025 14:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that NumericRange.writeToValueAtRange can apply updates between primitive and boxed arrays by comparing boxed base types and instantiating the new array with the correct component type.

  • Added getBoxedType to ArrayUtil (with tests) to normalize primitive vs. wrapper types
  • Updated writeToValueAtRange to use getBoxedType for type checks and to instantiate the result with the original array’s component type
  • Added tests in NumericRangeTest for writing boxed updates into primitive arrays and vice versa

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
stack-core/src/test/java/.../ArrayUtilTest.java New parameterized tests for getBoxedType
stack-core/src/main/java/.../ArrayUtil.java Implemented getBoxedType and updated copyright year
sdk-server/src/test/java/.../NumericRangeTest.java Tests for primitive↔boxed update handling
sdk-core/src/main/java/.../NumericRange.java Use getBoxedType in type comparison and adjust array instantiation and loop
Comments suppressed due to low confidence (1)

opc-ua-sdk/sdk-core/src/main/java/org/eclipse/milo/opcua/sdk/core/NumericRange.java:225

  • The exception message prints the array objects instead of their types. It would be clearer to include the class names, e.g. currentType=%s, updateType=%s, currentType.getName(), updateType.getName()`.
String.format("currentType=%s, updateType=%s", current, update));

@kevinherron kevinherron merged commit 8699d0e into 1.0 May 23, 2025
6 checks passed
@kevinherron kevinherron added this to the 1.0.1 milestone Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boxed vs primitive comparison in NumericRange

2 participants