Skip to content

Add NAMESPACE and NAMESPACES to ASAtom#695

Merged
MaximPlusov merged 4 commits intointegrationfrom
namespace
Mar 17, 2026
Merged

Add NAMESPACE and NAMESPACES to ASAtom#695
MaximPlusov merged 4 commits intointegrationfrom
namespace

Conversation

@LonelyMidoriya
Copy link
Copy Markdown
Contributor

@LonelyMidoriya LonelyMidoriya commented Mar 16, 2026

Summary by CodeRabbit

  • New Features
    • Added many predefined PDF name constants (e.g., Caret, Circle, FileAttachment, FreeText, Highlight, Ink, Line, Link, Movie, Namespace(s), Polygon, PolyLine, PrinterMark, Projection, Redact, RichMedia, Text, TrapNet, Underline, Watermark) to expand recognized atoms.
    • Added an annotation classification method to detect markup annotations (isMarkup), improving annotation handling and classification.

@LonelyMidoriya LonelyMidoriya self-assigned this Mar 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

Adds many new public predefined ASAtom constants in ASAtom.java and introduces PDAnnotation.isMarkup() plus a static set of markup annotation types in PDAnnotation.java; no other control flow or logic changes.

Changes

Cohort / File(s) Summary
ASAtom additions
src/main/java/org/verapdf/as/ASAtom.java
Adds numerous new public static final ASAtom constants (e.g., CARET, CIRCLE, FILE_ATTACHMENT, FREE_TEXT, HIGHLIGHT, INK, LINE, LINK, MOVIE, NAMESPACE, NAMESPACES, POLYGON, POLY_LINE, PRINTER_MARK, PROJECTION, REDACT, RICH_MEDIA, TEXT, TRAP_NET, UNDERLINE, WATERMARK). Declarative additions only.
Annotation markup detection
src/main/java/org/verapdf/pd/PDAnnotation.java
Adds a private static markupAnnotationTypes set (populated with many ASAtom markup kinds) and a new public boolean isMarkup() method that checks the annotation subtype against that set.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • MaximPlusov

Poem

🐇 I nudged new atoms into the light,
Names aligned, all tidy, bright.
Now annotations ask and see,
“Am I markup?” — answered free.
A hop, a nibble, code feels right.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions only NAMESPACE and NAMESPACES constants, but the changeset adds 22 additional ASAtom constants and a new public isMarkup() method in PDAnnotation—significantly more than the title suggests. Update the title to reflect all major changes, such as 'Add markup annotation types and namespace constants to ASAtom and PDAnnotation' or provide a more comprehensive description of the scope.
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 (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch namespace
📝 Coding Plan
  • Generate coding plan for human review comments

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 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/org/verapdf/as/ASAtom.java`:
- Line 318: Rename the misspelled constant ASAtom.HIGHTLIGHT to ASAtom.HIGHLIGHT
and correct its value string from "Hightlight" to "Highlight"; update any usages
(e.g., the reference in PDAnnotation from ASAtom.HIGHTLIGHT to ASAtom.HIGHLIGHT)
so the annotation subtype matches the PDF spec and PDAnnotation.isMarkup() will
detect highlight annotations correctly.

In `@src/main/java/org/verapdf/pd/PDAnnotation.java`:
- Around line 40-61: The static initializer for markupAnnotationTypes references
the misspelled constant ASAtom.HIGHTLIGHT; update this to the corrected
ASAtom.HIGHLIGHT (or whatever exact identifier was fixed in ASAtom.java) inside
the static block where markupAnnotationTypes is populated to match the renamed
symbol.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9c62b13-9cfb-4645-8399-89d7bc38a661

📥 Commits

Reviewing files that changed from the base of the PR and between ec501f2 and e561168.

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

public static final ASAtom HIDE_MENUBAR = new ASAtom("HideMenubar");
public static final ASAtom HIDE_TOOLBAR = new ASAtom("HideToolbar");
public static final ASAtom HIDE_WINDOWUI = new ASAtom("HideWindowUI");
public static final ASAtom HIGHTLIGHT = new ASAtom("Hightlight");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical typo: HIGHTLIGHT should be HIGHLIGHT.

The constant name and value are both misspelled as "Hightlight" instead of "Highlight". According to PDF specification, the annotation subtype is "Highlight". This typo will cause PDAnnotation.isMarkup() to incorrectly return false for valid Highlight annotations because the subtype string won't match.

🐛 Proposed fix
-    public static final ASAtom HIGHTLIGHT = new ASAtom("Hightlight");
+    public static final ASAtom HIGHLIGHT = new ASAtom("Highlight");

Note: After renaming, update the reference in PDAnnotation.java line 50 from ASAtom.HIGHTLIGHT to ASAtom.HIGHLIGHT.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static final ASAtom HIGHTLIGHT = new ASAtom("Hightlight");
public static final ASAtom HIGHLIGHT = new ASAtom("Highlight");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/verapdf/as/ASAtom.java` at line 318, Rename the misspelled
constant ASAtom.HIGHTLIGHT to ASAtom.HIGHLIGHT and correct its value string from
"Hightlight" to "Highlight"; update any usages (e.g., the reference in
PDAnnotation from ASAtom.HIGHTLIGHT to ASAtom.HIGHLIGHT) so the annotation
subtype matches the PDF spec and PDAnnotation.isMarkup() will detect highlight
annotations correctly.

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)

40-61: Add a small regression matrix for isMarkup().

This set is now the source of truth for markup classification, so a couple of positive and negative cases would make future drift much easier to catch — for example, Highlight and FileAttachment should stay true, while Link and Widget should stay false.

Also applies to: 103-105

🤖 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 40 - 61, Add a
small regression test matrix for PDAnnotation.isMarkup() that asserts the
current source-of-truth set markupAnnotationTypes (and behavior of isMarkup())
stays stable: include positive cases using ASAtom.HIGHLIGHT and
ASAtom.FILE_ATTACHMENT (expect true) and negative cases using ASAtom.LINK and
ASAtom.WIDGET (expect false); place tests alongside existing PDAnnotation tests
(also cover the items referenced around lines 103-105) so future changes to
markupAnnotationTypes or isMarkup() will fail if classification drifts.
🤖 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 40-61: Add a small regression test matrix for
PDAnnotation.isMarkup() that asserts the current source-of-truth set
markupAnnotationTypes (and behavior of isMarkup()) stays stable: include
positive cases using ASAtom.HIGHLIGHT and ASAtom.FILE_ATTACHMENT (expect true)
and negative cases using ASAtom.LINK and ASAtom.WIDGET (expect false); place
tests alongside existing PDAnnotation tests (also cover the items referenced
around lines 103-105) so future changes to markupAnnotationTypes or isMarkup()
will fail if classification drifts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 81fabbfb-61ce-4955-b59c-1f9a3c690314

📥 Commits

Reviewing files that changed from the base of the PR and between 28a182f and e8a839b.

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

@MaximPlusov MaximPlusov merged commit 480626f into integration Mar 17, 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