java-import-fqn

java-import-fqn is a cursor rule for Cursor from henryxm/autumn. It costs 443 tokens per session, 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

Written for Cursor: installed under .cursor/.

Good fit Checking changed Java files for unnecessary fully qualified class names with the project’s validation script.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/henryxm/autumn/java-import-fqn
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for java-import-fqn

Your own site · 80×15
<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="Reviewed on agentmods" width="80" height="20"></a>
Per session 443 This file is loaded in full into every session.
When invoked 443 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00443 $0.00443
Opus 5.5 $0.00177 $0.00177
Sonnet 5.5 $0.00089 $0.00089
Haiku 4.5 $0.00044 $0.00044

Measured 1mo ago against content hash 259bf0d34859, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.Date 与 java.sql.Date → 保留其一 import,另一用 FQN)。
  2. 同名内部类型与模型类:如 EncryptConfigHandler.RsaConfig 与 cn.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.Method、org.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. 1mo 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 3d ago), licensed Apache-2.0. It adds 443 tokens to every session, about $0.0018 per session on Opus 5.5. 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.