Skip to content

JDK 8 compatibility fix for vector datatype handling#2750

Merged
muskan124947 merged 1 commit intomainfrom
users/muskgupta/fix_vectorfailure_jdk8
Aug 28, 2025
Merged

JDK 8 compatibility fix for vector datatype handling#2750
muskan124947 merged 1 commit intomainfrom
users/muskgupta/fix_vectorfailure_jdk8

Conversation

@muskan124947
Copy link
Copy Markdown
Contributor

@muskan124947 muskan124947 commented Aug 25, 2025

Description

After adding Vector datatype support #2634, we observed failures on JDK 8 due to a NoSuchMethodError when invoking ByteBuffer.position(int).

Root Cause

  • In JDK 8, Buffer.position(int) returns Buffer.
  • In JDK 9+, ByteBuffer overrides this method to return ByteBuffer.

Directly calling ByteBuffer.position(int) caused incompatibility and resulted in NoSuchMethodError on JDK 8.

Fix

Cast the ByteBuffer instance to Buffer before calling position().
This ensures consistent behavior across JDK 8 and newer versions.

Testing

  • Verified all vector-related tests locally.
  • Confirmed successful execution on JDK 8 as well as later JDK versions.

@muskan124947 muskan124947 self-assigned this Aug 25, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.53%. Comparing base (e1acc9e) to head (952f61d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...java/com/microsoft/sqlserver/jdbc/VectorUtils.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2750      +/-   ##
============================================
+ Coverage     51.51%   51.53%   +0.01%     
+ Complexity     4081     4078       -3     
============================================
  Files           149      149              
  Lines         34268    34268              
  Branches       5725     5725              
============================================
+ Hits          17654    17659       +5     
+ Misses        14125    14119       -6     
- Partials       2489     2490       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@machavan machavan added this to the 13.2.1 milestone Aug 25, 2025
@muskan124947 muskan124947 merged commit 2ca55b8 into main Aug 28, 2025
18 of 19 checks 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.

4 participants