Skip to content

Use Long instead of primitive for dataStreamLength - #711

Merged
MaximPlusov merged 1 commit into
integrationfrom
data-stream-length
Jul 28, 2026
Merged

Use Long instead of primitive for dataStreamLength#711
MaximPlusov merged 1 commit into
integrationfrom
data-stream-length

Conversation

@LonelyMidoriya

@LonelyMidoriya LonelyMidoriya commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of inline image stream lengths when the value is unavailable.
    • Inline image metadata can now accurately represent missing length information.

@LonelyMidoriya LonelyMidoriya self-assigned this Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

PDInlineImage now stores its stream length as nullable Long and updates the public constructor to accept nullable values.

Changes

Inline image length contract

Layer / File(s) Summary
Nullable stream length contract
src/main/java/org/verapdf/pd/images/PDInlineImage.java
The dataStreamLength field and public constructor parameter changed from primitive long to nullable Long, preserving the value returned by getStreamLength().

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

Suggested reviewers: maximplusov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: changing dataStreamLength from primitive long to nullable Long.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch data-stream-length

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/verapdf/pd/images/PDInlineImage.java (1)

46-54: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the primitive constructor for binary compatibility.

Changing the public dataStreamLength parameter from long to Long changes the JVM constructor descriptor. Existing compiled consumers calling the old constructor can fail with NoSuchMethodError; autoboxing only helps code recompiled from source.

Proposed compatibility overload
+	public PDInlineImage(COSObject obj, PDResources imageResources,
+                         PDResources pageResources, long dataStreamLength) {
+		this(obj, imageResources, pageResources, Long.valueOf(dataStreamLength));
+	}
+
 	public PDInlineImage(COSObject obj, PDResources imageResources,
                          PDResources pageResources, Long dataStreamLength) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/org/verapdf/pd/images/PDInlineImage.java` around lines 46 - 54,
Restore the public PDInlineImage constructor overload that accepts primitive
long to preserve its existing JVM descriptor. Keep the Long-based constructor
for nullable values, and have the primitive overload delegate to the Long
constructor while preserving the existing initialization of dataStreamLength.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/main/java/org/verapdf/pd/images/PDInlineImage.java`:
- Around line 46-54: Restore the public PDInlineImage constructor overload that
accepts primitive long to preserve its existing JVM descriptor. Keep the
Long-based constructor for nullable values, and have the primitive overload
delegate to the Long constructor while preserving the existing initialization of
dataStreamLength.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 00f26091-ff1f-4b1b-98b2-ba6c1cf5dc20

📥 Commits

Reviewing files that changed from the base of the PR and between a0a7785 and fd2afbf.

📒 Files selected for processing (1)
  • src/main/java/org/verapdf/pd/images/PDInlineImage.java

@MaximPlusov
MaximPlusov merged commit 2f315b8 into integration Jul 28, 2026
9 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.

2 participants