Skip to content

Quick fix: remove tabs and unused AI exports#15791

Merged
subhramit merged 1 commit into
JabRef:mainfrom
InAnYan:fix/code-quality-1
May 20, 2026
Merged

Quick fix: remove tabs and unused AI exports#15791
subhramit merged 1 commit into
JabRef:mainfrom
InAnYan:fix/code-quality-1

Conversation

@InAnYan

@InAnYan InAnYan commented May 20, 2026

Copy link
Copy Markdown
Member

Related issues and pull requests

No related issue.

PR Description

Just quick changes:

  1. Remove tabs in build gradle file.
  2. Remove unused exports from jablib related to AI features.

Steps to test

Run checkAllModuleInfo - should be green.

AI usage

No AI usage (though originally discovered not by me, I think by a user that used AI to find this).

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code
  • 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

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Remove unused AI exports and fix formatting

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Remove unused AI-related exports from jablib module-info.java
• Clean up tabs in build.gradle.kts file for consistency
Diagram
flowchart LR
  A["module-info.java"] -->|"Remove 8 unused AI exports"| B["Cleaned exports"]
  C["build.gradle.kts"] -->|"Replace tabs with spaces"| D["Consistent formatting"]

Loading

File Changes

1. jablib/src/main/java/module-info.java Code quality +0/-10

Remove unused AI module exports

• Removed 8 unused AI-related module exports including org.jabref.logic.ai.models,
 org.jabref.logic.ai.ingestion.logic.ingestion, org.jabref.logic.ai.summarization.logic,
 org.jabref.logic.ai.ingestion.tasks, org.jabref.logic.ai.chatting.repositories,
 org.jabref.logic.ai.tokenization.logic, org.jabref.logic.ai.chatting.migrations, and
 org.jabref.logic.ai.summarization.migration
• Removed unused org.jabref.logic.ai.templates export
• Kept all actively used AI module exports intact

jablib/src/main/java/module-info.java


2. build.gradle.kts Formatting +2/-2

Replace tabs with spaces for consistency

• Replaced tab characters with spaces in filteredArtifactTypes assignment (line 56)
• Replaced tab characters with spaces in closing parenthesis (line 64)
• Ensures consistent indentation throughout the file

build.gradle.kts


Grey Divider

Qodo Logo

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

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

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1)

Grey Divider


Action required

1. Hidden chat repository API 🐞 Bug ≡ Correctness
Description
AiService#getChatHistoryRepository() is public but returns ChatHistoryRepository from
org.jabref.logic.ai.chatting.repositories, which is no longer exported by jablib's module-info,
so other modules cannot legally use that return type. Any downstream module calling this method (or
trying to reference its return type) will fail to compile under JPMS.
Code

jablib/src/main/java/module-info.java[140]

Evidence
module-info.java exports many AI packages but does not export
org.jabref.logic.ai.chatting.repositories, while AiService publicly returns
ChatHistoryRepository whose package is org.jabref.logic.ai.chatting.repositories.

jablib/src/main/java/module-info.java[121-155]
jablib/src/main/java/org/jabref/logic/ai/AiService.java[8-15]
jablib/src/main/java/org/jabref/logic/ai/AiService.java[186-188]
jablib/src/main/java/org/jabref/logic/ai/chatting/repositories/ChatHistoryRepository.java[1-22]

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

## Issue description
`jablib` no longer exports `org.jabref.logic.ai.chatting.repositories`, but `org.jabref.logic.ai.AiService` (in an exported package) still exposes `ChatHistoryRepository` in a public method. This makes that method effectively unusable to other modules and is a breaking change for any JPMS consumer relying on it.

## Issue Context
In JPMS, public signatures used across modules must reference types in exported packages, otherwise downstream compilation/access is blocked.

## Fix Focus Areas
Choose one of:
1) Restore the export(s) needed by public signatures.
2) Refactor `AiService` public API to not expose repository types from non-exported packages (e.g., remove the getter, make it package-private, or return an exported abstraction located in an exported package).

- jablib/src/main/java/module-info.java[121-155]
- jablib/src/main/java/org/jabref/logic/ai/AiService.java[8-15]
- jablib/src/main/java/org/jabref/logic/ai/AiService.java[186-188]

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


2. Hidden tokenizer return type 🐞 Bug ≡ Correctness
Description
ChatModel#getTokenizer() is public and part of an exported package, but returns TokenEstimator
from org.jabref.logic.ai.tokenization.logic, which is no longer exported by jablib's
module-info. Downstream modules can no longer call or implement this API under JPMS, which is a
breaking change for any consumer that previously used it.
Code

jablib/src/main/java/module-info.java[155]

Evidence
ChatModel is exported via module-info and declares TokenEstimator getTokenizer(), but
TokenEstimator lives in org.jabref.logic.ai.tokenization.logic, which is not among the exported
packages in module-info anymore.

jablib/src/main/java/module-info.java[121-155]
jablib/src/main/java/org/jabref/logic/ai/chatting/ChatModel.java[1-16]
jablib/src/main/java/org/jabref/logic/ai/tokenization/logic/TokenEstimator.java[1-14]

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

## Issue description
`jablib` no longer exports `org.jabref.logic.ai.tokenization.logic`, but `org.jabref.logic.ai.chatting.ChatModel` (exported) exposes `TokenEstimator` in a public method signature. This makes `getTokenizer()` unusable from other modules and breaks any external implementations/callers.

## Issue Context
JPMS requires that types appearing in accessible public signatures across modules reside in exported packages.

## Fix Focus Areas
Choose one of:
1) Re-add `exports org.jabref.logic.ai.tokenization.logic;` (and possibly `...tokenization.util` if needed by the intended public surface).
2) Refactor `ChatModel` to avoid exposing `TokenEstimator` publicly (e.g., move token estimation behind methods on `ChatModel` that only use exported types).

- jablib/src/main/java/module-info.java[121-155]
- jablib/src/main/java/org/jabref/logic/ai/chatting/ChatModel.java[1-16]
- jablib/src/main/java/org/jabref/logic/ai/tokenization/logic/TokenEstimator.java[1-14]

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



Remediation recommended

3. Whitespace-only filteredArtifactTypes edits 📘 Rule violation ⚙ Maintainability
Description
The changes in build.gradle.kts are indentation-only (tab-to-spaces) with no accompanying
functional modification, creating a reformat-only diff. This increases noise and violates the
guideline to avoid reformatting unchanged code.
Code

build.gradle.kts[R55-58]

Evidence
PR Compliance ID 3 forbids reformat-only changes in areas not otherwise being modified. The
filteredArtifactTypes assignment and closing parenthesis were changed only in
indentation/whitespace.

AGENTS.md: Do Not Reformat Unchanged Code; Remove Commented-Out Code
build.gradle.kts[55-64]

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

## Issue description
`build.gradle.kts` contains whitespace-only edits (tabs replaced with spaces) without any functional change in the same region, which violates the "do not reformat unchanged code" rule.

## Issue Context
This PR aims to remove tabs, but the compliance rule requires avoiding reformat-only diffs to reduce noise.

## Fix Focus Areas
- build.gradle.kts[55-64]

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


Grey Divider

Qodo Logo

exports org.jabref.logic.ai.ingestion.repositories;
exports org.jabref.logic.ai.ingestion.logic;
exports org.jabref.logic.ai.chatting.tasks;
exports org.jabref.logic.ai.chatting.repositories;

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. Hidden chat repository api 🐞 Bug ≡ Correctness

AiService#getChatHistoryRepository() is public but returns ChatHistoryRepository from
org.jabref.logic.ai.chatting.repositories, which is no longer exported by jablib's module-info,
so other modules cannot legally use that return type. Any downstream module calling this method (or
trying to reference its return type) will fail to compile under JPMS.
Agent Prompt
## Issue description
`jablib` no longer exports `org.jabref.logic.ai.chatting.repositories`, but `org.jabref.logic.ai.AiService` (in an exported package) still exposes `ChatHistoryRepository` in a public method. This makes that method effectively unusable to other modules and is a breaking change for any JPMS consumer relying on it.

## Issue Context
In JPMS, public signatures used across modules must reference types in exported packages, otherwise downstream compilation/access is blocked.

## Fix Focus Areas
Choose one of:
1) Restore the export(s) needed by public signatures.
2) Refactor `AiService` public API to not expose repository types from non-exported packages (e.g., remove the getter, make it package-private, or return an exported abstraction located in an exported package).

- jablib/src/main/java/module-info.java[121-155]
- jablib/src/main/java/org/jabref/logic/ai/AiService.java[8-15]
- jablib/src/main/java/org/jabref/logic/ai/AiService.java[186-188]

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is intended

exports org.jabref.logic.ai.ingestion.tasks.generateembeddingsforseveral;
exports org.jabref.logic.ai.ingestion.tasks.generateembeddings;
exports org.jabref.logic.ai.rag.util;
exports org.jabref.logic.ai.tokenization.logic;

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

2. Hidden tokenizer return type 🐞 Bug ≡ Correctness

ChatModel#getTokenizer() is public and part of an exported package, but returns TokenEstimator
from org.jabref.logic.ai.tokenization.logic, which is no longer exported by jablib's
module-info. Downstream modules can no longer call or implement this API under JPMS, which is a
breaking change for any consumer that previously used it.
Agent Prompt
## Issue description
`jablib` no longer exports `org.jabref.logic.ai.tokenization.logic`, but `org.jabref.logic.ai.chatting.ChatModel` (exported) exposes `TokenEstimator` in a public method signature. This makes `getTokenizer()` unusable from other modules and breaks any external implementations/callers.

## Issue Context
JPMS requires that types appearing in accessible public signatures across modules reside in exported packages.

## Fix Focus Areas
Choose one of:
1) Re-add `exports org.jabref.logic.ai.tokenization.logic;` (and possibly `...tokenization.util` if needed by the intended public surface).
2) Refactor `ChatModel` to avoid exposing `TokenEstimator` publicly (e.g., move token estimation behind methods on `ChatModel` that only use exported types).

- jablib/src/main/java/module-info.java[121-155]
- jablib/src/main/java/org/jabref/logic/ai/chatting/ChatModel.java[1-16]
- jablib/src/main/java/org/jabref/logic/ai/tokenization/logic/TokenEstimator.java[1-14]

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is intended

@subhramit subhramit added this pull request to the merge queue May 20, 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 20, 2026
Merged via the queue into JabRef:main with commit 89c4290 May 20, 2026
81 of 88 checks passed
f0restron07 pushed a commit to f0restron07/jabref that referenced this pull request May 24, 2026
@koppor

koppor commented May 24, 2026

Copy link
Copy Markdown
Member

This is a follow-up to #15688

@koppor koppor deleted the fix/code-quality-1 branch May 24, 2026 11:35
Siedlerchr added a commit that referenced this pull request May 25, 2026
* upstream/main:
  Add github-actions output format to jabkit check (#15789)
  Fixes of some nullaway warnings (#15792)
  Citations: Double click on entry should add and focus it (#15624)
  fix(ai): hide LLM varians if AI is disabled (#15812)
  Initial implementation for OCRmyPDF (#15712)
  fix(null): fix nullable warnings in CSLAdapter (#15803)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15808)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15809)
  New translations jabref_en.properties (Italian) (#15807)
  New Crowdin updates (#15796)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15802)
  Chore(deps): Bump org.openrewrite.recipe:rewrite-recipe-bom (#15800)
  Chore(deps): Bump org.openrewrite.rewrite from 7.32.2 to 7.33.0 (#15801)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15795)
  Chore(deps): Bump com.autonomousapps:dependency-analysis-gradle-plugin (#15794)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (#15793)
  fix: remove tabs and unused AI exports (#15791)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compliance violation status: no-bot-comments 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