Skip to content

Kotlin/Java 重编译、环境依赖管理与编辑器增强#2

Merged
Bkm016 merged 38 commits into
Bkm016:masterfrom
TheFloodDragon:master
May 26, 2026
Merged

Kotlin/Java 重编译、环境依赖管理与编辑器增强#2
Bkm016 merged 38 commits into
Bkm016:masterfrom
TheFloodDragon:master

Conversation

@TheFloodDragon
Copy link
Copy Markdown
Contributor

@TheFloodDragon TheFloodDragon commented May 16, 2026

注意

此PR已将版本号提升至0.2.0,所有相关修改部分请仔细审查

概要

本 PR 汇总 f94a48effe792900483bfcf6d23dec75f3111590..HEAD 范围内的 0.2.0 功能更新与清理工作,重点包括 Java/Kotlin 反编译、源码重编译、字节码编辑、环境依赖下载、编辑器体验和发布元数据同步。

主要改动

Java / Kotlin 工具链

  • 新增 Kotlin 源码重编译链路:
    • ClassForge 新增 --compile-kt 入口
    • 通过 kotlin-compiler-embeddable 编译 Kotlin 源码
    • 支持 Kotlin stdlib / compiler runtime 依赖解析与下载
  • Java 源码重编译链路增强:
    • 支持 classpath、target、debug 等编译选项
    • 编译诊断回传到编辑器并显示 gutter 标记
  • ClassForge 从 1.0 升级到 1.1
    • 内置 JAR 更新为 classforge-1.1.jar
    • Gradle 构建补充 Kotlin compileOnly 依赖和 manifest 信息
  • 移除内置 Vineflower JAR:
    • Vineflower 改为按环境配置解析并按需下载
    • 可执行文件同目录下的匹配版本 JAR 仍可作为本地/离线覆盖

环境与依赖管理

  • 新增 environment / deps 模块:
    • 管理 Vineflower / Kotlin 版本和依赖目录
    • 从 Maven 镜像下载所需 JAR
    • 支持 SHA-256 校验、POM 依赖递归解析、跳过无 JAR 工件
  • 新增下载进度状态栏:
    • 下载文件名、已下载大小、总大小展示
    • 文案已接入中英文 i18n
  • 设置页新增环境相关配置:
    • Java 路径
    • Vineflower 版本与目录
    • Kotlin 版本与依赖目录
    • Kotlin 反编译输出模式
    • 缓存状态与缓存列表展示

反编译与缓存

  • Vineflower 更新到 1.12.0
  • Kotlin 类支持两种反编译输出模式:
    • Vineflower Kotlin 输出 .kt
    • Java 输出模式 .java
  • 反编译缓存按 Kotlin 输出模式分目录:
    • decompiled/kotlin/<hash>
    • decompiled/java/<hash>
  • 缓存元数据增加 Kotlin 模式、缓存大小等信息
  • 支持缓存刷新、缓存大小统计和缓存状态展示

源码编辑与保存/导出

  • 反编译源码支持解锁编辑后重新编译:
    • Java 使用 JDK javax.tools.JavaCompiler
    • Kotlin 使用 Kotlin compiler embeddable
  • 编译成功后将生成的 .class 写回内存 JAR
  • 支持保存/覆盖当前源 JAR
  • 导出流程增强:
    • 导出 JAR
    • 导出反编译源码
    • 导出/保存进度显示

Explorer 与 Classpath

  • Explorer 增强:
    • 归档树状态、修改状态、反编译状态实时展示
    • Speed Search / 过滤优化
  • 新增 Classpath 面板:
    • 可添加 JAR / ZIP / WAR / EAR / 目录到当前会话 classpath
    • 面板高度可拖拽调整
    • 用于源码重编译和依赖解析

编辑器与语法高亮

  • Kotlin 高亮大幅增强:
    • 类型、软关键字、字符串插值
    • JVM $ 名称
    • 反引号特殊方法名
    • 特殊方法声明/调用识别
  • Java 高亮调整字段/常量处理
  • YAML key 高亮调整
  • Bytecode 高亮增强
  • 搜索增强:
    • 全词匹配将 $ 视为 JVM 名称字符
    • 支持更准确的 Kotlin/JVM 名称搜索
  • 大文本 viewport 渲染增强:
    • 支持只读 viewport
    • 编辑后窗口范围处理更稳健
  • 导航增强:
    • Ctrl+Click / Cmd+Click 支持 Kotlin 反引号和 $ 特殊方法名

UI / 平台 / 发布

  • 状态栏增加:
    • 反编译进度
    • 编译进度
    • 导出进度
    • 搜索索引进度
    • 下载进度
  • macOS 标题栏 / traffic light 适配更新
  • release workflow 升级 GitHub Actions 版本
  • macOS plist 版本更新为 0.2.0
  • 所有第一方 Rust crate 版本统一为 0.2.0
  • README / README_CN / 子 crate README 同步当前功能与构建说明

Keep JVM synthetic Kotlin names highlighted correctly and prevent long classpath paths from hiding controls.
Delay Kotlin dependency downloads until compile time, prepare Vineflower immediately after settings changes, and make classpath management easier from the explorer.
This simplifies classpath UI flow while making drop targets clearer and avoids failing Kotlin dependency downloads on non-JAR Maven artifacts.
This improves JVM/Kotlin identifier handling around '$' while reducing repeated UI and dependency helper logic without changing behavior.
This restores the Java path helper used by settings and scopes shell-only titlebar symbols to the platforms that actually use them.
This syncs the docs with the current Java/tooling behavior and makes YAML mapping keys stand out more clearly in the editor.
Keep drag-adding classpath entries responsive across external drops and make Kotlin/JVM dependency handling tolerate cached metadata and compiler entrypoint differences.
Remove the classpath drag/drop decision flow to keep file drops consistent, and restore clearer Java/Kotlin import coloring while improving JVM synthetic method highlighting.
Treat multi-segment $-separated identifiers as one synthetic symbol so accessor and delegate helper calls stay highlighted as method invocations.
Align the bundled ClassForge 1.1 toolchain with Kotlin 2.3.0 so recompilation uses the compatible compiler entrypoint, and render Java/Kotlin class names as plain text to avoid misleading type coloring.
Align Kotlin token detection with VS Code-style type/call heuristics while making classpath entries revealable and removing the toast copy hint.
Allow Kotlin classes to open and recompile as either Kotlin or Java while isolating cache entries by mode and restoring plain class-name coloring.
Keep decompiled Kotlin and Java outputs under dedicated cache subdirectories, and stop tinting single-letter Recaf labels as type descriptors in bytecode views.
Keep the recent Kotlin and classpath changes aligned with the branch's simpler control-flow style while removing redundant tests and helper duplication.
Keep the recent Kotlin, settings, and loading changes functionally unchanged while reshaping their control flow and helper layout to better match the simpler structure used before f94a48e.
Improve editor highlighting and navigation for Kotlin/JVM special method names, align field/type colors, and bump the app version for the 0.2.0 release.
Remove redundant helpers from the recent feature work, align first-party crate versions and release metadata, and refresh documentation for the 0.2.0 feature set.
@Bkm016 Bkm016 merged commit 3fef14a into Bkm016:master May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants