Repository navigation
fix(searches): handle null array safely and eliminate raw type warnings in FibonacciSearch - #7650
Conversation
…gs in FibonacciSearch
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
@alxkm Hi! I have submitted this PR to safely handle null arrays without throwing NullPointerException, eliminate raw type compiler warnings in FibonacciSearch, and add corresponding test coverage. Please review when you have a moment. Thanks! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7650 +/- ##
============================================
- Coverage 82.19% 82.19% -0.01%
- Complexity 8376 8378 +2
============================================
Files 842 842
Lines 26099 26101 +2
Branches 5089 5090 +1
============================================
+ Hits 21452 21453 +1
- Misses 3857 3858 +1
Partials 790 790 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alxkm
left a comment
There was a problem hiding this comment.
Looks good. NPE and @SuppressWarnings gone, nice. Thank you for the contribution.
clang-format -i --style=file path/to/your/file.javaDescription
This pull request addresses null safety and type safety in
FibonacciSearch:find(null, key)previously threw an unexpectedNullPointerExceptionwhen evaluatingarray.length == 0. Added an explicit check throwingIllegalArgumentException("Input array must not be null.")consistent with the method contract and existing parameter checks.isSortedas<T extends Comparable<T>> boolean isSorted(T[] array), eliminating raw type usage and allowing removal of@SuppressWarnings({"rawtypes", "unchecked"}).FibonacciSearchasfinalfollowing project conventions.@throwsJavadoc to document null array handling and added a unit test verifyingIllegalArgumentExceptionis thrown when array is null.