java - 在 IntelliJ 的 Kotlin > Java 转换后将源代码恢复为 Java

标签 java git intellij-idea kotlin

所以我想尝试转换我们用 Java 编写的后端 API 源代码并查看它的外观(IIRC 有转换前的预览),但是一旦我这样做它会自动开始转换所选中的所有文件文件夹,最后它要求进行代码更正,我没有回答,因为我想取消它,现在我被一个损坏的代码库困住了,别无选择,除了:

  • 恢复到最后一次 git 提交并重新实现我这边所做的所有更改(我本可以阻止它但在转换之前提交但是哦好吧)
  • 继续使用 Kotlin 编写代码,但我有代码错误,我不知道如何修复

我想问的是,是否可以在 IntelliJ IDEA 中将 Kotlin 转换回 Java?提前谢谢你

最佳答案

Intellij 有一个叫做 Local History 的特性并且它可用于及时返回您未提交给源代码控制系统的事情。在您安装新版本的 IntelliJ IDEA 或使缓存失效之前,此历史记录将一直保留。在 Intellij 中阅读更多信息 help for the feature .

Your source code constantly changes as you edit, test, or compile. Any version control system tracks the differences between the committed versions, but the local changes between commits pass unnoticed. Local History is your personal version control system that tracks changes to your source code on your computer and enables you to compare versions and roll changes back, if necessary. Local History is always at your disposal, no steps are required to enable it.

Local History is independent of external version control systems and works with the directories of your project even when they are not under any VCS control. It applies to any structural artifacts: a project, a directory or package, a file, a class, class members, tags, or selected fragment of text.

关于java - 在 IntelliJ 的 Kotlin > Java 转换后将源代码恢复为 Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39329564/

相关文章:

java - 设置 CSS 样式 Uibinder Gwt

java - 不能在一个简单的例子上使用 JSTL

git - 修改对共享仓库的 Git 提交

java - 如何通过JNI设置Java对象的多维数组字段

java - 读取txt文件。显示每行旁边的整数之和并找到其中最大的和

git - 我可以在 Git 之外使用 Git 的忽略处理吗?

git - 如何忽略 Git 中的现有文件?

java - 通过命令行运行时找不到或加载主类

java - Intellij IDEA SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”

java - 如何解决 JSONParser() 错误?