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

master
Egor.Ushakov 8 years ago
parent 6354fc1211
commit 601cae8cf8
  1. 9
      src/org/jetbrains/java/decompiler/main/ClassWriter.java
  2. 8
      src/org/jetbrains/java/decompiler/main/decompiler/PrintStreamLogger.java
  3. 8
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java
  4. 4
      src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java

@ -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;
} }
} }

@ -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);
} }
} }

@ -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) { }

@ -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;
} }

Loading…
Cancel
Save