Skip to content

Fix default value for unwanted characters#15743

Merged
koppor merged 20 commits into
mainfrom
fix-unwanted-chars
May 20, 2026
Merged

Fix default value for unwanted characters#15743
koppor merged 20 commits into
mainfrom
fix-unwanted-chars

Conversation

@koppor

@koppor koppor commented May 15, 2026

Copy link
Copy Markdown
Member

Something was wrong with the unwanted characters

  • constant for default appearing twice (!)
  • preference not used in two importers

Steps to test

Difficult

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • [/] I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

(Agentic_describe updated until commit 4419075)

Fix citation key generation and importer preference handling

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Moved DEFAULT_UNWANTED_CHARACTERS constant to CitationKeyPatternPreferences class for proper
  encapsulation
• Added superscript and subscript character normalization (e.g., ¹ → 1, ₂ → 2) in citation key
  generation
• Fixed EndnoteImporter and ReferImporter to respect user citation key preferences instead of
  hardcoded defaults
• Replaced regex-based whitespace removal with Guava's CharMatcher for improved performance in
  cleanKey method
Diagram
flowchart LR
  A["CitationKeyPatternPreferences"] -->|"contains DEFAULT_UNWANTED_CHARACTERS"| B["CitationKeyGenerator"]
  B -->|"normalizes superscripts/subscripts"| C["cleanKey method"]
  D["EndnoteImporter"] -->|"uses preferences"| A
  E["ReferImporter"] -->|"uses preferences"| A
  B -->|"replaces regex with CharMatcher"| F["whitespace removal"]
Loading

Grey Divider

File Changes

1. jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java 🐞 Bug fix +11/-1

Move unwanted characters constant to preferences class

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java


2. jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java ✨ Enhancement +45/-18

Add superscript/subscript normalization and optimize whitespace removal

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java


3. jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java ✨ Enhancement +2/-1

Use inline character removal instead of method call

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java


View more (16)
4. jablib/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java 🐞 Bug fix +8/-1

Accept citation key preferences in constructor

jablib/src/main/java/org/jabref/logic/importer/fileformat/EndnoteImporter.java


5. jablib/src/main/java/org/jabref/logic/importer/fileformat/ReferImporter.java 🐞 Bug fix +8/-1

Accept citation key preferences in constructor

jablib/src/main/java/org/jabref/logic/importer/fileformat/ReferImporter.java


6. jablib/src/main/java/org/jabref/logic/importer/ImportFormatReader.java 🐞 Bug fix +2/-2

Pass preferences to importer constructors

jablib/src/main/java/org/jabref/logic/importer/ImportFormatReader.java


7. jablib/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java 🧪 Tests +28/-8

Add tests for superscript/subscript normalization

jablib/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java


8. jablib/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTestUtils.java 🧪 Tests +0/-0

Update constant import to new location

jablib/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTestUtils.java


9. jablib/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java 🧪 Tests +1/-1

Update constant import to new location

jablib/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithDatabaseTest.java


10. jablib/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithoutDatabaseTest.java 🧪 Tests +1/-1

Update constant import to new location

jablib/src/test/java/org/jabref/logic/citationkeypattern/MakeLabelWithoutDatabaseTest.java


11. jablib/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java 🧪 Tests +2/-2

Update constant import to new location

jablib/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java


12. jablib/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java 🧪 Tests +6/-1

Mock preferences and pass to importer constructor

jablib/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java


13. jablib/src/test/java/org/jabref/logic/importer/fileformat/ReferImporterTest.java 🧪 Tests +6/-1

Mock preferences and pass to importer constructor

jablib/src/test/java/org/jabref/logic/importer/fileformat/ReferImporterTest.java


14. jablib/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java 🧪 Tests +3/-1

Mock and configure citation key preferences

jablib/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java


15. jablib/src/test/java/org/jabref/logic/importer/ImporterTest.java 🧪 Tests +4/-1

Mock preferences and pass to importer constructors

jablib/src/test/java/org/jabref/logic/importer/ImporterTest.java


16. jabgui/src/test/java/org/jabref/gui/externalfiles/AutoRenameFileOnEntryChangeTest.java 🧪 Tests +1/-1

Update constant import to new location

jabgui/src/test/java/org/jabref/gui/externalfiles/AutoRenameFileOnEntryChangeTest.java


17. jabgui/src/test/java/org/jabref/gui/fieldeditors/optioneditors/LanguageEditorViewModelTest.java 🧪 Tests +2/-2

Update constant import to new location

jabgui/src/test/java/org/jabref/gui/fieldeditors/optioneditors/LanguageEditorViewModelTest.java


18. CHANGELOG.md 📝 Documentation +2/-0

Document superscript normalization and importer fixes

CHANGELOG.md


19. jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTestUtils.java Additional files +1/-1

...

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTestUtils.java


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Inline regex in authNofMth 📘 Rule violation ➹ Performance
Description
authNofMth uses String.replaceAll(...), which recompiles the regex on every call and violates
the requirement to use compiled Pattern instances for regex checks/replacements. This can add
avoidable overhead in citation key generation paths.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[975]

+                                    .map(name -> name.replaceAll("[-`ʹ:!;?^$]*", ""))
Evidence
PR Compliance ID 14 requires compiled regex patterns to be reused. The changed code calls
replaceAll("[-ʹ:!;?^$]*", ""), which compiles the pattern each time authNofMth` runs.

AGENTS.md
jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[974-976]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`BracketedPattern.authNofMth` calls `name.replaceAll(...)` with a regex literal. This recompiles the regex per invocation.
## Issue Context
Compliance requires regex usage to prefer reusable compiled `Pattern` instances instead of repeated compilation.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[974-976]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Truncate before normalization ✓ Resolved 🐞 Bug ≡ Correctness
Description
BracketedPattern.authNofMth now truncates the raw family name after a regex replace, before later
key normalization expands characters (e.g., ö→oe), so patterns like [auth3] / [auth4_1] can
yield longer/different prefixes than intended. This contradicts existing expectations (e.g., tests
expecting Köning with [auth3] to produce Koe) and can lead to unexpected key
changes/collisions.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[R975-976]

+                                    .map(name -> name.replaceAll("[-`ʹ:!;?^$]*", ""))
+                                    .orElse("");
Evidence
The new implementation truncates the family name before the later normalization step that expands
certain Unicode characters, which can change both the prefix and resulting length. The repo’s
Unicode mapping explicitly expands ö to oe, and existing citation-key tests assert results
consistent with truncation happening after that expansion.

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[299-360]
jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[960-978]
jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[235-254]
jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[68-85]
jablib/src/main/java/org/jabref/model/strings/UnicodeToReadableCharMap.java[55-65]
jablib/src/test/java/org/jabref/logic/citationkeypattern/CitationKeyGeneratorTest.java[169-209]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`BracketedPattern.authNofMth` truncates the author family name before the citation-key normalization step that expands some Unicode characters (e.g., `ö` → `oe`). This changes the semantics of `[authN]` / `[authN_M]` / `[authIniN]` because truncation is done on the *pre-normalized* string, but normalization happens later and can increase length or alter the prefix.
### Issue Context
- `BracketedPattern.getFieldValue` routes `auth\d+` and `auth\d+_\d+` patterns to `authNofMth`, which performs the truncation.
- `CitationKeyGenerator.expandBracketContent` subsequently calls `removeUnwantedCharacters(...)`, which invokes `StringUtil.replaceSpecialCharacters(...)` using `UnicodeToReadableCharMap` (e.g., `\u00F6` → `oe`).
- Because there is no re-truncation after normalization, the final output can exceed the intended `N` characters and differ from prior behavior.
### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[960-978]
### How to fix
- Ensure the same normalization used for citation keys (at minimum `StringUtil.replaceSpecialCharacters`, and ideally the full unwanted/disallowed filtering logic) is applied **before** taking `substring(0, n)` in `authNofMth`.
- Suggested implementation approach:
- Replace the `replaceAll(...)` with a call that normalizes first, then removes unwanted/disallowed characters, then truncates.
- Prefer reusing existing logic (e.g., extract a shared helper for `removeUnwantedCharacters`-style normalization) rather than hardcoding a regex character class.
- Add/adjust a focused unit test for `[auth3]` / `[auth4_1]` with an umlauted name (e.g., `Köning`, `Gödel`) to lock in the intended behavior (truncate after normalization).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Unwanted chars duplicated in regex ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The unwanted-characters set is hard-coded inside a regex literal in authNofMth, duplicating the
canonical default unwanted-characters definition. This duplication risks future drift/inconsistency
if defaults change.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[975]

+                                    .map(name -> name.replaceAll("[-`ʹ:!;?^$]*", ""))
Evidence
PR Compliance ID 5 requires avoiding introduced duplication. The changed line hard-codes the
unwanted character set inside the regex string, duplicating the same concept already represented by
a dedicated constant/preferences source.

AGENTS.md
jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[974-976]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`BracketedPattern.authNofMth` embeds the unwanted-characters list directly in the regex literal (`[-`ʹ:!;?^$]*`). This duplicates the default unwanted-characters definition maintained elsewhere.
## Issue Context
Duplicated business rules (like "which characters are unwanted") can easily diverge over time and make bug fixes incomplete.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[974-976]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. cleanKey() uses replaceAll ✓ Resolved 📘 Rule violation ➹ Performance
Description
cleanKey calls replaceAll("\\s", ""), which recompiles the regex on every invocation and
violates the compiled-regex requirement for non-trivial/repeated regex usage. This can add avoidable
overhead in citation-key generation paths.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[R151-152]

+    public static String cleanKey(String key, String unwantedCharacters) {
+        return removeUnwantedCharacters(key, unwantedCharacters).replaceAll("\\s", "");
Evidence
PR Compliance ID 9 requires using compiled Pattern instances rather than inline regex operations
when the regex may be used repeatedly. The new/modified cleanKey implementation uses
replaceAll("\\s", ""), which compiles the regex per call.

AGENTS.md
jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[151-152]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CitationKeyGenerator.cleanKey` currently removes whitespace via `String.replaceAll("\\s", "")`, which recompiles the pattern per call.
## Issue Context
The compliance checklist requires using compiled `Pattern` instances for repeated/non-trivial regex operations.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[151-152]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Default constant mis-layered ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
CitationKeyPatternPreferences now sources its default unwanted-characters value from
CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS, even though CitationKeyGenerator documents that
this constant should not be used directly. This increases coupling (preferences depend on generator)
and contradicts the documented contract, making future refactors riskier.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java[68]

+                CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS,                  // unwantedCharacters
Evidence
The default constructor in CitationKeyPatternPreferences now directly references the generator
constant, while the generator’s own comment says it should not be used directly (preferring the
preference accessor). This is a direct contradiction and introduces avoidable coupling.

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java[59-74]
jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[28-36]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`CitationKeyPatternPreferences` now depends on `CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS` for its default value, while `CitationKeyGenerator` explicitly says the constant should not be used directly. This creates an unnecessary dependency from the preferences layer to the generator layer and contradicts the comment.
## Issue Context
The PR goal is to avoid duplicated defaults, but the current direction of dependency makes `CitationKeyPatternPreferences` require the generator class to define its own defaults.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyPatternPreferences.java[59-74]
- jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[28-36]
## Suggested fix
- Move the default unwanted-characters constant into `CitationKeyPatternPreferences` (or a small dedicated `CitationKeyDefaults`/`CitationKeyConstants` class in the same package).
- Update `CitationKeyGenerator` to reference that constant (or remove/rename the misleading comment if the generator is intended to be the source-of-truth).
- Keep only one source-of-truth, but ensure dependencies flow from preferences/constants -> generator, not the reverse.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
6. Superscript handling inconsistent 🐞 Bug ≡ Correctness
Description
CitationKeyGenerator.removeUnwantedCharacters now normalizes superscript/subscript digits (and
strips other superscript/subscript symbols), but citation-key validation still uses
removeUnwantedCharactersWithKeepDiacritics which does not normalize. This can accept/import keys
containing superscript digits while later generation/cleaning transforms them, creating inconsistent
behavior and potential surprises/collisions.
Code

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[R82-86]

String newKey = key.chars()
                 .filter(c -> unwantedCharacters.indexOf(c) == -1)
                 .filter(c -> !DISALLOWED_CHARACTERS.contains((char) c))
+                           .map(CitationKeyGenerator::normalizeSuperscriptOrSubscript)
+                           .filter(c -> c != -1)
Evidence
Generation now maps superscript/subscript digits in removeUnwantedCharacters, but the validation
path for citation keys uses removeUnwantedCharactersWithKeepDiacritics (wired via FieldCheckers ->
ValidCitationKeyChecker), which currently does not apply that normalization. This is a concrete,
code-backed divergence in behavior introduced by the PR.

jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[80-97]
jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[99-117]
jablib/src/main/java/org/jabref/logic/integrity/ValidCitationKeyChecker.java[11-32]
jablib/src/main/java/org/jabref/logic/integrity/FieldCheckers.java[45-53]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Citation key *generation/cleaning* now normalizes superscript/subscript digits (e.g., ²→2) via `removeUnwantedCharacters`, but citation key *validation* (and importer key cleanup) uses `removeUnwantedCharactersWithKeepDiacritics`, which currently does not normalize superscripts/subscripts. This leads to inconsistent acceptance vs. output.
## Issue Context
`FieldCheckers` wires `ValidCitationKeyChecker` to citation key fields, and `ValidCitationKeyChecker` uses `removeUnwantedCharactersWithKeepDiacritics`. After this PR, the generator path normalizes while the checker path does not.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/CitationKeyGenerator.java[80-117]
- jablib/src/main/java/org/jabref/logic/integrity/ValidCitationKeyChecker.java[11-32]
- jablib/src/main/java/org/jabref/logic/integrity/FieldCheckers.java[45-53]
## Suggested fix options (pick one)
1) **Normalize in the keep-diacritics path**
- Add the same `.map(CitationKeyGenerator::normalizeSuperscriptOrSubscript).filter(c -> c != -1)` steps to `removeUnwantedCharactersWithKeepDiacritics`.
- Update its Javadoc to reflect that it preserves diacritics but normalizes superscript/subscript digits.
- This keeps validation/import behavior aligned with the generator for superscript/subscript characters.
2) **Normalize in the checker only**
- Update `ValidCitationKeyChecker` to apply a normalization step before comparison (without switching to `cleanKey`, which also transliterates via `replaceSpecialCharacters`).
Also add/adjust a unit test to cover a key containing superscript/subscript digits (e.g., `H₂O` / `x²`) so the intended behavior is locked in.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@koppor

koppor commented May 15, 2026

Copy link
Copy Markdown
Member Author

Haha, we are back in the discussion of - being wanted in a citation key ("BibTeX key") or not....

@Siedlerchr

Siedlerchr commented May 16, 2026

Copy link
Copy Markdown
Member

I think not including minus is okay, that doesn't break anything

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label May 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

/// Maps Unicode superscript and subscript digits to their ASCII counterparts (e.g., ¹ → 1, ₂ → 2).
/// Other characters in the Superscripts and Subscripts block (e.g., ⁿ ⁱ ⁺ ⁻ ⁽ ⁾) are stripped by returning -1.
/// All other code points are returned unchanged.
private static int normalizeSuperscriptOrSubscript(int codePoint) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would suggest moving this to an util class somewhere

"", // keyPatternRegex
"", // keyPatternReplacement
"-`ʹ:!;?^$", // unwantedCharacters
CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS, // unwantedCharacters

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be defined inside the prefs as constant and then used in the places

koppor and others added 4 commits May 19, 2026 22:09
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
CitationKeyGenerator.cleanKey stripped whitespace via String.replaceAll("\s", ""), recompiling the regex on every call. Replace it with Guava's CharMatcher.whitespace().removeFrom(...), which needs no regex engine and matches the existing string-handling idiom used in StringUtil.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@koppor koppor marked this pull request as ready for review May 19, 2026 20:22
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 4419075

}
String lastName = lastAuthor.getFamilyName()
.map(CitationKeyGenerator::removeDefaultUnwantedCharacters).orElse("");
.map(name -> name.replaceAll("[-`ʹ:!;?^$]*", ""))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Inline regex in authnofmth 📘 Rule violation ➹ Performance

authNofMth uses String.replaceAll(...), which recompiles the regex on every call and violates
the requirement to use compiled Pattern instances for regex checks/replacements. This can add
avoidable overhead in citation key generation paths.
Agent Prompt
## Issue description
`BracketedPattern.authNofMth` calls `name.replaceAll(...)` with a regex literal. This recompiles the regex per invocation.

## Issue Context
Compliance requires regex usage to prefer reusable compiled `Pattern` instances instead of repeated compilation.

## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java[974-976]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread jablib/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java Outdated
Siedlerchr
Siedlerchr previously approved these changes May 19, 2026
Siedlerchr
Siedlerchr previously approved these changes May 19, 2026
@koppor koppor added this pull request to the merge queue May 19, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label May 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 19, 2026
@koppor koppor added this pull request to the merge queue May 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 19, 2026
koppor and others added 2 commits May 20, 2026 01:42
The constant lives on CitationKeyPatternPreferences, not
CitationKeyGenerator. Updates the reference and removes the now-unused
import.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@koppor koppor added the automerge PR is tagged with that label will be merged if workflows are green label May 19, 2026
@koppor koppor enabled auto-merge May 19, 2026 23:46
@koppor koppor added this pull request to the merge queue May 20, 2026
@koppor koppor removed this pull request from the merge queue due to a manual request May 20, 2026
@koppor koppor enabled auto-merge May 20, 2026 00:11
@koppor koppor added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit dcec9ed May 20, 2026
54 checks passed
@koppor koppor deleted the fix-unwanted-chars branch May 20, 2026 00:51
Siedlerchr added a commit that referenced this pull request May 20, 2026
* upstream/main:
  Update PULL_REQUEST_TEMPLATE.md (#15788)
  New Crowdin updates (#15787)
  Update heylogs to 0.18.0 and use github-actions format (#15786)
  Grand refactoring of the AI features (#15688)
  Chore(deps): Bump com.fasterxml:aalto-xml in /versions (#15782)
  Chore(deps): Bump org.junit:junit-bom from 6.0.3 to 6.1.0 in /versions (#15783)
  Fix default value for unwanted characters (#15743)
  Fix runner tag
  Fix runner for JBang (PR)
  Fix duplicate finder progress counter incrementing on empty queue polls (#15781)
  Refine JabKit CLI: positional input argument and check command group (#15759)
  Ignore exception in unregisterListener to prevent exception (#15761)
  Fix wrong usage of "key" (#15779)
  Fix Hayagriva export to nest identifiers under serial-number (#15750)
f0restron07 pushed a commit to f0restron07/jabref that referenced this pull request May 24, 2026
* Fix default value for unwanted characters

* Fix visibility

* Remove strange comment

* Add support for streamlining super- and subscripts

* Use citation key preference at EndnoteImporter

* Fix ReferImporter

* Add link to PR to CHANGELOG.md entries

* Fix wrong constant use

Co-authored-by: Christoph <siedlerkiller@gmail.com>

* Move constant

Co-authored-by: Christoph <siedlerkiller@gmail.com>

* Use CharMatcher to strip whitespace in cleanKey

CitationKeyGenerator.cleanKey stripped whitespace via String.replaceAll("\s", ""), recompiling the regex on every call. Replace it with Guava's CharMatcher.whitespace().removeFrom(...), which needs no regex engine and matches the existing string-handling idiom used in StringUtil.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Fix formatting

* Adapt tests

* Fix normalization

* Fix -

* Annotate that its only for testing

* Fix import

* Fix import of DEFAULT_UNWANTED_CHARACTERS in AbstractJabKitTest

The constant lives on CitationKeyPatternPreferences, not
CitationKeyGenerator. Updates the reference and removes the now-unused
import.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge PR is tagged with that label will be merged if workflows are green Compliance violation component: citationkey-generator component: import-load status: changes-required Pull requests that are not yet complete status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants