bitflicker64 opened a new pull request, #3455:
URL: https://github.com/apache/hugegraph/pull/3455
## Purpose of the PR
Behaviour-preserving cleanups found while scanning `hugegraph-struct`, plus
tests for two paths that had no coverage in the module.
## Main Changes
- Use `instanceof` pattern variables where a cast followed the check:
`IndexLabel`, `BaseElement`, `IndexBuilder`, `CollectionFactory`. In
`IndexBuilder`, `BaseEdge.schemaLabel()` already returns `EdgeLabel`, so the
cast goes away.
- `LZ4Util`: open the LZ4 block streams in try-with-resources. The success
path is unchanged; on a failed read or write the stream is now closed as well,
and the original exception still propagates as `BackendException`.
- `BinaryElementSerializer`: drop the unused package-private `log` field.
- `parseLabelFromCol` and `BytesBuffer.parseOlapId`: drop locals that were
read and never used. Every read stays in the same order, so the buffer position
is unchanged.
- Add `LZ4UtilTest` (round trip, invalid buffer ratios, truncated input) and
`BinaryElementSerializerLabelTest` (`parseLabelFromCol` for vertex and edge
columns; the Store calls it from `QueryUtil` and `FixGraphIdController`).
No public or protected signature, encoded byte or log message changes.
## Verifying these changes
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [x] Already covered by existing tests, such as *(please modify tests
here)*.
- [x] Need tests and can be verified as follows:
- The 6 new tests pass on both master code and this branch, as expected
for a refactor.
- Ran on Linux x86_64, OpenJDK 17.0.20.1, Maven 3.8.7, 2026-11-07, at
`155468a54`:
`mvn -ntp -B test -pl hugegraph-struct -am -Deditorconfig.skip=true`
Result: BUILD SUCCESS, 142 tests, 0 failures, 0 errors, 0 skipped.
Master runs 136 tests in this module. Surefire: `LZ4UtilTest` 3 and
`BinaryElementSerializerLabelTest` 3 run, 0 failed.
- Full repository compile: `mvn -ntp -B -q compile
-Deditorconfig.skip=true -Dmaven.javadoc.skip=true` exits 0.
- `-Deditorconfig.skip=true` is there because master fails the
editorconfig check on `helm/hugegraph/docs/rag.md` (missing final newline), a
file this PR does not touch.
## Does this PR potentially affect the following parts?
- [ ] Dependencies ([add/update
license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
info &
[regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh))
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
- [x] Nope
## Documentation Status
- [ ] `Doc - TODO`: required documentation is pending; complete it before
merging.
- [ ] `Doc - Done`: documentation is included here or linked below.
- [x] `Doc - No Need`: no user-visible documentation is affected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]