IJ-CR-108265 [java-decompiler] IDEA-198397 add cancelled checks for java-decompiler. run only under progress

GitOrigin-RevId: 95c98c2dc4a29004e6663489dc9a883133236e74
This commit is contained in:
Mikhail Pyltsin
2023-06-19 16:55:09 +02:00
committed by intellij-monorepo-bot
parent b94f5140c0
commit 0011aa6fd9

View File

@@ -63,7 +63,7 @@ class IdeaDecompiler : ClassFileDecompilers.Light() {
IFernflowerPreferences.BANNER to BANNER,
IFernflowerPreferences.MAX_PROCESSING_METHOD to 60,
IFernflowerPreferences.MAX_BYTES_CLASS_NOT_UNDER_PROGRESS to 20_000, //approximately 2_000 lines
IFernflowerPreferences.MAX_BYTES_CLASS to 80_000, //approximately 8_000 lines
IFernflowerPreferences.MAX_BYTES_CLASS to 150_000, //approximately 15_000 lines
IFernflowerPreferences.INDENT_STRING to indent,
IFernflowerPreferences.IGNORE_INVALID_BYTECODE to "1",
IFernflowerPreferences.VERIFY_ANONYMOUS_CLASSES to "1",
@@ -135,8 +135,9 @@ class IdeaDecompiler : ClassFileDecompilers.Light() {
val maxBytesNotUnderProgress = myOptions.value[IFernflowerPreferences.MAX_BYTES_CLASS_NOT_UNDER_PROGRESS]?.toString()?.toIntOrNull() ?: 0
val maxBytes = myOptions.value[IFernflowerPreferences.MAX_BYTES_CLASS]?.toString()?.toIntOrNull() ?: 0
return if (!ApplicationManager.getApplication().isUnitTestMode &&
(maxBytesNotUnderProgress > 0 && EDT.isCurrentThreadEdt() && file.length > maxBytesNotUnderProgress) ||
(maxBytes > 0 && file.length > maxBytes)
(maxBytesNotUnderProgress > 0 && EDT.isCurrentThreadEdt() &&
file.length > maxBytesNotUnderProgress) ||
(maxBytes > 0 && file.length > maxBytes && !ProgressManager.getInstance().hasProgressIndicator())
) {
ClsFileImpl.decompile(file)
}