tree_haver 3.2.5 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5491d352853baeea6501864dec4d703cfd57fea279d6e16edf104c2f1d533c90
4
- data.tar.gz: 5c71898a5022f0459bc502bfeb977d7fc7e909ffb3fd0c30fe0b4e2055811fe9
3
+ metadata.gz: 6e544c31dc86e71be78cfcf24e7cbf8a779ef954845b736ec37ed6b550ffe714
4
+ data.tar.gz: 54f83ef36c8167f5071db278ce33f2603864d339a9c246a733957da41540eab4
5
5
  SHA512:
6
- metadata.gz: c3ebc956fca1d0e57925f3a152aa2465bb0b86c5fcb0fc1622fe0f038d00214d38c04cb2c52bdbb08250074d48bbd2096353bf14d5d70a0b3a7ae9b58997e79a
7
- data.tar.gz: 53192de159ce84a508b9795a866ab01ea23af4de7f9b8c4f2be077a7dff1cc394959462926a948a89c84670668beb2a7c2b5eac9f735c39ffabc6f99c6fe9cbb
6
+ metadata.gz: c991da086ba12a279f461f337e7dfa9d0b98d8d6d4f4c5d3d78cc3b848a6174ed42ce71b674e8a2d4ed81c5b17289d6c3903c2ef813db86cd4557a33aa1c1599
7
+ data.tar.gz: 034b9f7df24e5f757013f011b7661559fed243b3fde752d95ab2cac94a0fdfc8270d9ca002d07972c74c1d5455293ac12c7472eacdc106934051cc3231d005b9
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,20 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [3.2.6] - 2026-01-06
34
+
35
+ - TAG: [v3.2.6][3.2.6t]
36
+ - COVERAGE: 92.07% -- 2230/2422 lines in 23 files
37
+ - BRANCH COVERAGE: 74.69% -- 788/1055 branches in 23 files
38
+ - 90.37% documented
39
+
40
+ ### Fixed
41
+
42
+ - **Java backend**: Fixed Optional handling in Node methods that could return nil incorrectly
43
+ - `child(index)`, `child_by_field_name(name)`, `parent`, `next_sibling`, `prev_sibling` now properly check for nil before attempting to unwrap Java Optional
44
+ - Previously, the ternary-based Optional check could fail when jtreesitter returned null directly instead of Optional.empty()
45
+ - This fixes JRuby test failures where `key_name` returned nil and object keys were not extracted
46
+
33
47
  ## [3.2.5] - 2026-01-05
34
48
 
35
49
  - TAG: [v3.2.5][3.2.5t]
@@ -901,7 +915,9 @@ Despite the major version bump to 3.0.0 (following semver due to the breaking `L
901
915
 
902
916
  - Initial release
903
917
 
904
- [Unreleased]: https://github.com/kettle-rb/tree_haver/compare/v3.2.5...HEAD
918
+ [Unreleased]: https://github.com/kettle-rb/tree_haver/compare/v3.2.6...HEAD
919
+ [3.2.6]: https://github.com/kettle-rb/tree_haver/compare/v3.2.5...v3.2.6
920
+ [3.2.6t]: https://github.com/kettle-rb/tree_haver/releases/tag/v3.2.6
905
921
  [3.2.5]: https://github.com/kettle-rb/tree_haver/compare/v3.2.4...v3.2.5
906
922
  [3.2.5t]: https://github.com/kettle-rb/tree_haver/releases/tag/v3.2.5
907
923
  [3.2.4]: https://github.com/kettle-rb/tree_haver/compare/v3.2.3...v3.2.4
@@ -640,8 +640,17 @@ module TreeHaver
640
640
  def child(index)
641
641
  # jtreesitter 0.26.0: getChild returns Optional<Node> or throws IndexOutOfBoundsException
642
642
  result = @impl.getChild(index)
643
- return unless result.respond_to?(:isPresent) ? result.isPresent : result
644
- java_node = result.respond_to?(:get) ? result.get : result
643
+ return if result.nil?
644
+
645
+ # Handle Java Optional
646
+ if result.respond_to?(:isPresent)
647
+ return unless result.isPresent
648
+ java_node = result.get
649
+ else
650
+ # Direct Node return (some jtreesitter versions)
651
+ java_node = result
652
+ end
653
+
645
654
  Node.new(java_node)
646
655
  rescue ::Java::JavaLang::IndexOutOfBoundsException
647
656
  nil
@@ -653,9 +662,19 @@ module TreeHaver
653
662
  # @return [Node, nil] the child node or nil if not found
654
663
  def child_by_field_name(name)
655
664
  # jtreesitter 0.26.0: getChildByFieldName returns Optional<Node>
665
+ # However, some versions or scenarios may return null directly
656
666
  result = @impl.getChildByFieldName(name)
657
- return unless result.respond_to?(:isPresent) ? result.isPresent : result
658
- java_node = result.respond_to?(:get) ? result.get : result
667
+ return if result.nil?
668
+
669
+ # Handle Java Optional
670
+ if result.respond_to?(:isPresent)
671
+ return unless result.isPresent
672
+ java_node = result.get
673
+ else
674
+ # Direct Node return (some jtreesitter versions)
675
+ java_node = result
676
+ end
677
+
659
678
  Node.new(java_node)
660
679
  end
661
680
 
@@ -727,8 +746,16 @@ module TreeHaver
727
746
  def parent
728
747
  # jtreesitter 0.26.0: getParent returns Optional<Node>
729
748
  result = @impl.getParent
730
- return unless result.respond_to?(:isPresent) ? result.isPresent : result
731
- java_node = result.respond_to?(:get) ? result.get : result
749
+ return if result.nil?
750
+
751
+ # Handle Java Optional
752
+ if result.respond_to?(:isPresent)
753
+ return unless result.isPresent
754
+ java_node = result.get
755
+ else
756
+ java_node = result
757
+ end
758
+
732
759
  Node.new(java_node)
733
760
  end
734
761
 
@@ -738,8 +765,16 @@ module TreeHaver
738
765
  def next_sibling
739
766
  # jtreesitter 0.26.0: getNextSibling returns Optional<Node>
740
767
  result = @impl.getNextSibling
741
- return unless result.respond_to?(:isPresent) ? result.isPresent : result
742
- java_node = result.respond_to?(:get) ? result.get : result
768
+ return if result.nil?
769
+
770
+ # Handle Java Optional
771
+ if result.respond_to?(:isPresent)
772
+ return unless result.isPresent
773
+ java_node = result.get
774
+ else
775
+ java_node = result
776
+ end
777
+
743
778
  Node.new(java_node)
744
779
  end
745
780
 
@@ -749,8 +784,16 @@ module TreeHaver
749
784
  def prev_sibling
750
785
  # jtreesitter 0.26.0: getPrevSibling returns Optional<Node>
751
786
  result = @impl.getPrevSibling
752
- return unless result.respond_to?(:isPresent) ? result.isPresent : result
753
- java_node = result.respond_to?(:get) ? result.get : result
787
+ return if result.nil?
788
+
789
+ # Handle Java Optional
790
+ if result.respond_to?(:isPresent)
791
+ return unless result.isPresent
792
+ java_node = result.get
793
+ else
794
+ java_node = result
795
+ end
796
+
754
797
  Node.new(java_node)
755
798
  end
756
799
 
@@ -10,7 +10,7 @@ module TreeHaver
10
10
  # Current version of the tree_haver gem
11
11
  #
12
12
  # @return [String] the version string (e.g., "3.0.0")
13
- VERSION = "3.2.5"
13
+ VERSION = "3.2.6"
14
14
  end
15
15
 
16
16
  # Traditional location for VERSION constant
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree_haver
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -293,10 +293,10 @@ licenses:
293
293
  - MIT
294
294
  metadata:
295
295
  homepage_uri: https://tree-haver.galtzo.com/
296
- source_code_uri: https://github.com/kettle-rb/tree_haver/tree/v3.2.5
297
- changelog_uri: https://github.com/kettle-rb/tree_haver/blob/v3.2.5/CHANGELOG.md
296
+ source_code_uri: https://github.com/kettle-rb/tree_haver/tree/v3.2.6
297
+ changelog_uri: https://github.com/kettle-rb/tree_haver/blob/v3.2.6/CHANGELOG.md
298
298
  bug_tracker_uri: https://github.com/kettle-rb/tree_haver/issues
299
- documentation_uri: https://www.rubydoc.info/gems/tree_haver/3.2.5
299
+ documentation_uri: https://www.rubydoc.info/gems/tree_haver/3.2.6
300
300
  funding_uri: https://github.com/sponsors/pboling
301
301
  wiki_uri: https://github.com/kettle-rb/tree_haver/wiki
302
302
  news_uri: https://www.railsbling.com/tags/tree_haver
metadata.gz.sig CHANGED
Binary file