java-import-fqn

java-import-fqn is a cursor rule for Cursor from henryxm/autumn. It costs 0 tokens per session (443 once invoked), scanned A, original, Apache-2.0.

A Java code rule that requires using imports and short class names when class names do not conflict. Fully qualified names remain allowed for documented exceptions such as naming conflicts and certain strings.

In plain words
What is it for?
Checking changed Java files for unnecessary fully qualified class names with the project’s validation script.
Why use it?
It keeps Java code shorter and consistent while avoiding unclear or invalid replacements in cases where the full name is necessary.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/henryxm/autumn/java-import-fqn
Clone the repo
git clone --depth 1 https://github.com/henryxm/autumn

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for java-import-fqn

README.md
[![agentmods](https://agentmods.dev/badge/rules/henryxm/autumn/java-import-fqn.svg)](https://agentmods.dev/rules/henryxm/autumn/java-import-fqn)
Your own site
<a href="https://agentmods.dev/rules/henryxm/autumn/java-import-fqn"><img src="https://agentmods.dev/badge/rules/henryxm/autumn/java-import-fqn.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 443 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00443
Opus 5 $0.00000 $0.00221
Sonnet 5 $0.00000 $0.00089
Haiku 4.5 $0.00000 $0.00044

Measured 4d ago against content hash 259bf0d34859, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

java-import-fqn scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/java-import-fqn.mdc · 35 lines

What it actually says

Java import 优先(禁止 FQN)

规范全文:docs/AI_CODE_STYLE.md §7;CI:bash scripts/check-java-fqn

必须

  • 跨包类型:import + 短类名SysUserEntity,非 cn.org.autumn.modules.sys.entity.SysUserEntity)。
  • 新增/修改 Java 时,不得在方法体、字段、泛型、返回值等处写 FQN,除非下方例外。

允许 FQN 的例外

  1. 类名冲突:同一文件内两个不同包的同名类无法同时 import(如 java.util.Datejava.sql.Date → 保留其一 import,另一用 FQN)。
  2. 同名内部类型与模型类:如 EncryptConfigHandler.RsaConfigcn.org.autumn.model.RsaConfig
  3. MyBatis Configuration 与 Spring @Configuration 等同名冲突
  4. 字符串中的类名Class.forName("…")prop.put("…")、Quartz/自动配置 exclude 列表)——不是 Java 类型引用。
  5. AspectJ @Pointcut 表达式(如 @annotation(cn.org.autumn.annotation.DataFilter))——字符串内不参与 Java import,须写注解 FQN。

禁止

  • 无冲突时写 java.lang.reflect.Methodorg.springframework.web.bind.annotation.GetMapping 等 FQN。
  • 用 FQN 代替 lazy import。
  • 将 AspectJ @Pointcut("@annotation(…)") 里的注解 FQN 改成短类名(Pointcut 字符串不走 import)。

提交前(改 Java 时)

bash scripts/check-java-fqn
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 35 lines · 443 tokens per session scan A 259bf0d34859

Subscribe to this mod's changes

java-import-fqn is a cursor rule published in the GitHub repository henryxm/autumn (49 stars, last pushed 8d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 443 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.