Conversation
📝 WalkthroughWalkthroughThis pull request introduces support for PDF/A-4 2020 flavour variants alongside the existing PDF/A-4 specification. Changes include new enum constants for PDFA-4 2020 variants, helper methods for flavour classification, updated year constants with public accessibility, and profile path resolution logic for the 2020 variant. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~23 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@core/src/main/java/org/verapdf/pdfa/flavours/PDFAFlavour.java`:
- Around line 89-95: The PDFAFlavour enum entries PDFA_4_2020, PDFA_4_F_2020,
PDFA_4_E_2020 currently share the same implicit IDs as PDFA_4 / PDFA_4_F /
PDFA_4_E causing FLAVOUR_LOOKUP map collisions; fix by giving the 2020 variants
explicit unique IDs (for example "4_2020", "4f_2020", "4e_2020") when
constructing those enum constants so their getId() values differ and the
FLAVOUR_LOOKUP/profile ID maps won’t overwrite; update the enum constant
declarations (PDFA_4_2020, PDFA_4_F_2020, PDFA_4_E_2020) to call the constructor
that accepts an explicit id string (or add such a constructor and set the id
field) and leave existing PDFA_4 variants unchanged.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
core/src/main/java/org/verapdf/metadata/fixer/utils/parser/XMLProcessedObjectsParser.javacore/src/main/java/org/verapdf/pdfa/flavours/PDFAFlavour.javacore/src/main/java/org/verapdf/pdfa/flavours/PDFAFlavours.javacore/src/main/java/org/verapdf/pdfa/flavours/PDFFlavours.javacore/src/main/java/org/verapdf/pdfa/validation/profiles/ProfileDirectoryImpl.java
| PDFA_4_2020(Specification.ISO_19005_4_2020, Level.NO_LEVEL), | ||
| /** 4 PDF Version 4 Level F */ | ||
| PDFA_4_F_2020(Specification.ISO_19005_4_2020, Level.F), | ||
| /** 4 PDF Version 4 Level E */ | ||
| PDFA_4_E_2020(Specification.ISO_19005_4_2020, Level.E), | ||
| /** 4 PDF Version 4 */ | ||
| PDFA_4(Specification.ISO_19005_4, Level.NO_LEVEL), |
There was a problem hiding this comment.
ID collision between 2020 and default PDF/A-4 flavours breaks lookup.
Line 89-Line 95 add new flavours that currently generate the same IDs (4, 4f, 4e) as Line 95-Line 99 variants. This causes map overwrites in ID-based lookup paths (FLAVOUR_LOOKUP, and downstream profile ID maps), so 2020 flavours are not uniquely addressable by ID.
🔧 Proposed fix: assign explicit unique IDs to 2020 variants
- PDFA_4_2020(Specification.ISO_19005_4_2020, Level.NO_LEVEL),
+ PDFA_4_2020("4-2020", Specification.ISO_19005_4_2020, Level.NO_LEVEL),
...
- PDFA_4_F_2020(Specification.ISO_19005_4_2020, Level.F),
+ PDFA_4_F_2020("4f-2020", Specification.ISO_19005_4_2020, Level.F),
...
- PDFA_4_E_2020(Specification.ISO_19005_4_2020, Level.E),
+ PDFA_4_E_2020("4e-2020", Specification.ISO_19005_4_2020, Level.E),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@core/src/main/java/org/verapdf/pdfa/flavours/PDFAFlavour.java` around lines
89 - 95, The PDFAFlavour enum entries PDFA_4_2020, PDFA_4_F_2020, PDFA_4_E_2020
currently share the same implicit IDs as PDFA_4 / PDFA_4_F / PDFA_4_E causing
FLAVOUR_LOOKUP map collisions; fix by giving the 2020 variants explicit unique
IDs (for example "4_2020", "4f_2020", "4e_2020") when constructing those enum
constants so their getId() values differ and the FLAVOUR_LOOKUP/profile ID maps
won’t overwrite; update the enum constant declarations (PDFA_4_2020,
PDFA_4_F_2020, PDFA_4_E_2020) to call the constructor that accepts an explicit
id string (or add such a constructor and set the id field) and leave existing
PDFA_4 variants unchanged.
Summary by CodeRabbit