mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-149077 Default decompiler is chosen for several classes instead of Fernflower - fixes for IDEA-CR-20517
This commit is contained in:
+7
-2
@@ -529,7 +529,9 @@ public class ClassWriter {
|
||||
buffer.append(root.toJava(indent, tracer));
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
DecompilerContext.getLogger().writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be written.", ex);
|
||||
DecompilerContext.getLogger().writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be written.",
|
||||
IFernflowerLogger.Severity.WARN,
|
||||
ex);
|
||||
methodWrapper.decompiledWithErrors = true;
|
||||
}
|
||||
}
|
||||
@@ -832,7 +834,10 @@ public class ClassWriter {
|
||||
buffer.append(code);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
DecompilerContext.getLogger().writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be written.", ex);
|
||||
DecompilerContext.getLogger()
|
||||
.writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be written.",
|
||||
IFernflowerLogger.Severity.WARN,
|
||||
ex);
|
||||
methodWrapper.decompiledWithErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,9 +38,9 @@ public class PrintStreamLogger extends IFernflowerLogger {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeMessage(String message, Throwable t) {
|
||||
if (accepts(Severity.ERROR)) {
|
||||
writeMessage(message, Severity.ERROR);
|
||||
public void writeMessage(String message, Severity severity, Throwable t) {
|
||||
if (accepts(severity)) {
|
||||
writeMessage(message, severity);
|
||||
t.printStackTrace(stream);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,11 @@ public abstract class IFernflowerLogger {
|
||||
|
||||
public abstract void writeMessage(String message, Severity severity);
|
||||
|
||||
public abstract void writeMessage(String message, Throwable t);
|
||||
public abstract void writeMessage(String message, Severity severity, Throwable t);
|
||||
|
||||
public void writeMessage(String message, Throwable t) {
|
||||
writeMessage(message, Severity.ERROR, t);
|
||||
}
|
||||
|
||||
public void startReadingClass(String className) { }
|
||||
|
||||
|
||||
+3
-1
@@ -142,7 +142,9 @@ public class ClassWrapper {
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
DecompilerContext.getLogger().writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be decompiled.", ex);
|
||||
DecompilerContext.getLogger().writeMessage("Method " + mt.getName() + " " + mt.getDescriptor() + " couldn't be decompiled.",
|
||||
IFernflowerLogger.Severity.WARN,
|
||||
ex);
|
||||
isError = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.java.decompiler
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger
|
||||
import org.jetbrains.java.decompiler.main.extern.IFernflowerLogger.Severity.*
|
||||
|
||||
class IdeaLogger : IFernflowerLogger() {
|
||||
private val LOG = Logger.getInstance(IdeaDecompiler::class.java)
|
||||
@@ -29,18 +30,29 @@ class IdeaLogger : IFernflowerLogger() {
|
||||
override fun writeMessage(message: String, severity: IFernflowerLogger.Severity) {
|
||||
val text = extendMessage(message)
|
||||
when (severity) {
|
||||
IFernflowerLogger.Severity.ERROR -> LOG.warn(text)
|
||||
IFernflowerLogger.Severity.WARN -> LOG.warn(text)
|
||||
IFernflowerLogger.Severity.INFO -> LOG.info(text)
|
||||
ERROR -> LOG.warn(text)
|
||||
WARN -> LOG.warn(text)
|
||||
INFO -> LOG.info(text)
|
||||
else -> LOG.debug(text)
|
||||
}
|
||||
}
|
||||
|
||||
override fun writeMessage(message: String, t: Throwable) {
|
||||
when (t) {
|
||||
is ProcessCanceledException -> throw t
|
||||
is InterruptedException -> throw ProcessCanceledException(t)
|
||||
else -> LOG.warn(message, t)
|
||||
override fun writeMessage(message: String, severity: IFernflowerLogger.Severity, t: Throwable) {
|
||||
if (severity == ERROR) {
|
||||
when (t) {
|
||||
is InternalException -> throw t
|
||||
is ProcessCanceledException -> throw t
|
||||
is InterruptedException -> throw ProcessCanceledException(t)
|
||||
else -> throw InternalException(extendMessage(message), t)
|
||||
}
|
||||
}
|
||||
else {
|
||||
val text = extendMessage(message)
|
||||
when (severity) {
|
||||
WARN -> LOG.warn(text, t)
|
||||
INFO -> LOG.info(text, t)
|
||||
else -> LOG.debug(text, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user