Eclipse 中打開庫類(如 JDK、第三方 JAR)時顯示反編譯的 .class 文件而非 .java 源碼,原因是未配置 Source Attachment。本文說明配置方法。
編輯器顯示:
// Class file editor - Source not found
// The source attachment does not contain the source for the file...
// You can change the source attachment by clicking Change Attached Source below.
jdk-8uxxx-src.zip、spring-framework-5.x.x-sources.jar)Package Explorer → 右鍵 JAR → Properties → Java Source Attachmentsrc.zip-sources 包配置好源碼附件,除方便閱讀實現外,還能在調試時斷點進入庫代碼,大幅提升開發效率。