Skip to content

Make isRegistryCompatible() and isOrderingCompatible() public#734

Merged
MaximPlusov merged 1 commit into
integrationfrom
typr0-font
Jun 22, 2026
Merged

Make isRegistryCompatible() and isOrderingCompatible() public#734
MaximPlusov merged 1 commit into
integrationfrom
typr0-font

Conversation

@LonelyMidoriya

@LonelyMidoriya LonelyMidoriya commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Updated font validation API to allow broader access to compatibility-checking methods for CIDSystemInfo registry and CMap ordering.

@LonelyMidoriya LonelyMidoriya self-assigned this Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Two methods in GFPDType0FontisRegistryCompatible() and isOrderingCompatible() — have their access modifiers changed from private to public. No logic, behavior, or internal implementation is altered.

Changes

CIDSystemInfo Compatibility Method Visibility

Layer / File(s) Summary
Promote compatibility methods to public
validation-model/src/main/java/org/verapdf/gf/model/impl/pd/font/GFPDType0Font.java
isRegistryCompatible() and isOrderingCompatible() are changed from private to public; all internal logic (CIDSystemInfo/CMap field reads, null checks, equality comparisons) is unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

Two little methods, once hiding away,
Now public they stand in the light of day!
Registry, Ordering — secrets no more,
The rabbit flung open the visibility door.
🐇✨ "Come one, come all!" the methods now say.

🚥 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 and specifically describes the main change: making two private methods public in the GFPDType0Font 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 typr0-font

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.

@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)
validation-model/src/main/java/org/verapdf/gf/model/impl/pd/font/GFPDType0Font.java (1)

198-218: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add null guards before exposing these methods as public API.

Both methods can throw NullPointerException if getCIDSystemInfo() or getCMap() returns null, since they chain method calls directly without null checks. This is inconsistent with the other similar public methods in this class (e.g., getCIDFontRegistry(), getCMapOrdering()) which properly guard against null before accessing these objects.

Now that these methods are part of the public API, external callers may not be aware of this precondition.

🛡️ Suggested fix to add null guards
     public boolean isRegistryCompatible() {
+        PDCIDSystemInfo cidSystemInfo = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCIDSystemInfo();
+        org.verapdf.pd.font.cmap.PDCMap cmap = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCMap();
+        if (cidSystemInfo == null || cmap == null) {
+            LOGGER.log(Level.FINE, "CIDSystemInfo or CMap is missing");
+            return false;
+        }
-        String fontRegistry = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCIDSystemInfo()
-                .getStringKey(ASAtom.REGISTRY);
-        String cMapRegistry = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCMap().getRegistry();
+        String fontRegistry = cidSystemInfo.getStringKey(ASAtom.REGISTRY);
+        String cMapRegistry = cmap.getRegistry();
         if (fontRegistry == null) {
             LOGGER.log(Level.FINE, "CIDSystemInfo dictionary doesn't contain Registry entry.");
             return false;
         }
         return fontRegistry.equals(cMapRegistry);
     }

     public boolean isOrderingCompatible() {
+        PDCIDSystemInfo cidSystemInfo = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCIDSystemInfo();
+        org.verapdf.pd.font.cmap.PDCMap cmap = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCMap();
+        if (cidSystemInfo == null || cmap == null) {
+            LOGGER.log(Level.FINE, "CIDSystemInfo or CMap is missing");
+            return false;
+        }
-        String fontOrdering = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCIDSystemInfo()
-                .getStringKey(ASAtom.ORDERING);
-        String cMapOrdering = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getCMap().getOrdering();
+        String fontOrdering = cidSystemInfo.getStringKey(ASAtom.ORDERING);
+        String cMapOrdering = cmap.getOrdering();
         if (fontOrdering == null) {
             LOGGER.log(Level.FINE, "CIDSystemInfo dictionary doesn't contain Ordering entry.");
             return false;
         }
         return fontOrdering.equals(cMapOrdering);
     }
🤖 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
`@validation-model/src/main/java/org/verapdf/gf/model/impl/pd/font/GFPDType0Font.java`
around lines 198 - 218, Add null guards to the isRegistryCompatible() and
isOrderingCompatible() methods to prevent NullPointerException when
getCIDSystemInfo() or getCMap() return null. Check if getCIDSystemInfo() is null
before calling getStringKey() on it, and check if getCMap() is null before
calling getRegistry() or getOrdering() on it. Return false in these null cases,
consistent with how null checks are handled for fontRegistry and fontOrdering
within each method.
🤖 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
`@validation-model/src/main/java/org/verapdf/gf/model/impl/pd/font/GFPDType0Font.java`:
- Around line 198-218: Add null guards to the isRegistryCompatible() and
isOrderingCompatible() methods to prevent NullPointerException when
getCIDSystemInfo() or getCMap() return null. Check if getCIDSystemInfo() is null
before calling getStringKey() on it, and check if getCMap() is null before
calling getRegistry() or getOrdering() on it. Return false in these null cases,
consistent with how null checks are handled for fontRegistry and fontOrdering
within each method.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6a6414b6-3c76-4e58-bfa2-548dc6a31d06

📥 Commits

Reviewing files that changed from the base of the PR and between d06ccf7 and 35876f1.

📒 Files selected for processing (1)
  • validation-model/src/main/java/org/verapdf/gf/model/impl/pd/font/GFPDType0Font.java

@MaximPlusov MaximPlusov merged commit 0e86c53 into integration Jun 22, 2026
8 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