Skip to content

Shorten fully qualified type names to simple names with imports - #183

Closed
tomtourwe wants to merge 2 commits into
develfrom
shorten-qualified-names
Closed

tomtourwe wants to merge 2 commits into
develfrom
shorten-qualified-names

Conversation

@tomtourwe

@tomtourwe tomtourwe commented Nov 4, 2026 •

Copy link
Copy Markdown

Replaces type names written out in full in the code by their simple name plus an import, for example
java.util.List<String> list = new java.util.ArrayList<>() becomes List<String> list = new ArrayList<>()
with import java.util.ArrayList; and import java.util.List;. The change is mechanical, made with an automated
import refactoring.

The two commits

  1. Imports cleaned up (cc1694b6c): unused imports are removed, and every import block is sorted in one order.
    No code line changes.
  2. Qualified names shortened (9adc92436): a type name written in full becomes its simple name and the import
    is added. A nested type keeps its enclosing type (java.util.Map.Entry becomes Map.Entry, importing
    java.util.Map); a static member keeps its class (java.util.Collections.emptyList() becomes
    Collections.emptyList()); no static import is added. Comments, javadoc and string literals are left as they are.

A name stays qualified where its simple name would mean another type in that file: another type of that simple
name is imported, declared or written in the file, or two on-demand imports would both provide it.

Verification

  • Every main, test and test-fixtures Java source set compiles.
  • ./gradlew test passes, with no failures.

Classes that keep qualified names

These classes in maddi-aapi-archive declare stand-ins for types of two libraries that share simple names (for
example java.util.List and io.vavr.collection.List), so one of the two stays qualified:

These other classes keep a qualified name because its simple name already means another type there (for example
org.slf4j.Logger beside an import of ch.qos.logback.classic.Logger):

module-info.java, line 14 writes uses io.codelaser.maddi.analysis.api.AnalysisEngine;, which stays as it is.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


Tom Tourwe seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@tomtourwe

Copy link
Copy Markdown
Author

Replaced by #184, the same change made on the current devel (65c45ad).

@tomtourwe tomtourwe closed this Nov 4, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant