IDEA-149077 Default decompiler is chosen for several classes instead of Fernflower - fixes for IDEA-CR-20517

This commit is contained in:
Egor.Ushakov
2017-05-03 15:22:20 +03:00
parent 6354fc1211
commit 601cae8cf8
4 changed files with 20 additions and 9 deletions

View File

@@ -529,7 +529,9 @@ public class ClassWriter {
buffer.append(root.toJava(indent, tracer)); buffer.append(root.toJava(indent, tracer));
} }
catch (Throwable ex) { 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; methodWrapper.decompiledWithErrors = true;
} }
} }
@@ -832,7 +834,10 @@ public class ClassWriter {
buffer.append(code); buffer.append(code);
} }
catch (Throwable ex) { 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; methodWrapper.decompiledWithErrors = true;
} }
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -38,9 +38,9 @@ public class PrintStreamLogger extends IFernflowerLogger {
} }
@Override @Override
public void writeMessage(String message, Throwable t) { public void writeMessage(String message, Severity severity, Throwable t) {
if (accepts(Severity.ERROR)) { if (accepts(severity)) {
writeMessage(message, Severity.ERROR); writeMessage(message, severity);
t.printStackTrace(stream); t.printStackTrace(stream);
} }
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, 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) { } public void startReadingClass(String className) { }

View File

@@ -142,7 +142,9 @@ public class ClassWrapper {
} }
} }
catch (Throwable ex) { 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; isError = true;
} }