使用方法
- 复制安装命令,在自己的智能体环境安装前先检查源码包。
- 从原始文档核对所需工具、凭据和支持的宿主。
- 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/github/awesome-copilot --skill java-docs开始前需了解
- 安装不包含模型订阅、API 额度或访问文件的权限。
- 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。
Java Documentation (Javadoc) Best Practices
Principles
- Document only what the code actually does: read the implementation, callers and tests first. Never invent behaviour, thresholds, thread-safety, nullability or exceptions you have not verified; if unsure, leave it out or ask.
- Keep the existing documentation style of the project (language, tag order, comment form
/** */vs///). Do not rewrite existing comments, or mass-document a codebase, unless the user asks; limit changes to the requested scope. - Check the JDK level (
maven.compiler.release, toolchain,java -version) before using newer features, and stay within it.
Conventions
@sinceonly with the real version in which the API was introduced;@deprecatedwith a reason and replacement, together with@Deprecated.@authorand@versiononly if the project already uses them.- Code blocks, by JDK level:
- Any JDK:
<pre>{@code ... }</pre>(escape@at line start, balance braces). - JDK 18+:
{@snippet : ... }for inline code, or{@snippet file="Example.java" region="demo"}with files insnippet-files/(preferred for examples;javadocdoes not compile or validate the snippet source, so compile and test the files in a separate build/test source set if you need that guarantee). Use// @highlight substring="x"and// @replacemarkup as needed. - JDK 23+ only (JEP 467): Markdown doc comments with
///, using[Type#member]for links and fenced code blocks. Use them only if the project already does or the user asks, and the build runs a JDK 23+javadoc.
Verify
- Run
mvn -q javadoc:javadoc(or./gradlew javadoc) and for single filesjavadoc -Xdoclint:all -d target/javadoc-check <files>; fix every warning/error you introduced (missing@param, bad HTML, unresolved{@link}, unknown tags). - Report what was documented and the commands run; state any claims you could not verify from the code.

