Skip to content

Add isVisibleAnnotation method#702

Merged
MaximPlusov merged 1 commit into
integrationfrom
visible-annotation
Apr 29, 2026
Merged

Add isVisibleAnnotation method#702
MaximPlusov merged 1 commit into
integrationfrom
visible-annotation

Conversation

@LonelyMidoriya
Copy link
Copy Markdown
Contributor

@LonelyMidoriya LonelyMidoriya commented Apr 29, 2026

Summary by CodeRabbit

  • New Features
    • Enhanced annotation visibility detection to improve handling of annotation display properties.

@LonelyMidoriya LonelyMidoriya self-assigned this Apr 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

A new static utility method isVisibleAnnotation is added to PDAnnotation that determines annotation visibility by inspecting the F flags entry. The method returns true when the flag value is null or bit 2 is unset, and false when bit 2 is set.

Changes

Cohort / File(s) Summary
Annotation Visibility Utility
src/main/java/org/verapdf/pd/PDAnnotation.java
Added public static method isVisibleAnnotation to evaluate annotation visibility based on the F flags bitmask (bit 2 determines hidden state).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A flag check so fine and neat,
Bit two tells visibility's beat,
Annotations dance, now we can see,
Who's hidden and who's wild and free!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new static utility method isVisibleAnnotation to PDAnnotation class.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 visible-annotation

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/org/verapdf/pd/PDAnnotation.java (1)

327-330: Reuse existing flag helper instead of hardcoded mask.

Line 329 duplicates F-bit parsing already centralized in isHidden()/getFlagValue(int). Using the existing helper keeps behavior consistent if flag handling changes later.

Proposed refactor
 public static boolean isVisibleAnnotation(PDAnnotation annotation) {
-    Long f = annotation.getIntegerKey(ASAtom.F);
-    return (f == null || (f & 2) != 2);
+    return !annotation.isHidden();
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/verapdf/pd/PDAnnotation.java` around lines 327 - 330, The
method isVisibleAnnotation currently reimplements the F flag bitmask; instead
call the existing helper instead to keep behavior consistent: replace the manual
mask with the centralized flag logic by returning !annotation.isHidden() (or, if
you prefer, using annotation.getFlagValue(2) via the existing getFlagValue(int)
helper) so visibility uses the same flag-parsing as isHidden()/getFlagValue.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/main/java/org/verapdf/pd/PDAnnotation.java`:
- Around line 327-330: The method isVisibleAnnotation currently reimplements the
F flag bitmask; instead call the existing helper instead to keep behavior
consistent: replace the manual mask with the centralized flag logic by returning
!annotation.isHidden() (or, if you prefer, using annotation.getFlagValue(2) via
the existing getFlagValue(int) helper) so visibility uses the same flag-parsing
as isHidden()/getFlagValue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1788f61f-bd2a-4787-9678-83e58ac6d384

📥 Commits

Reviewing files that changed from the base of the PR and between 2999ba8 and 723574e.

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

@MaximPlusov MaximPlusov merged commit 4261065 into integration Apr 29, 2026
9 checks passed
@MaximPlusov MaximPlusov deleted the visible-annotation branch May 3, 2026 16:20
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