decompiler: do not fail on the invalid bytecode in IDEA

master
Egor Ushakov 6 years ago
parent a74a9d7d25
commit 8be977e76c
  1. 6
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
  2. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java
  3. 3
      test/org/jetbrains/java/decompiler/SingleClassesTest.java

@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.main.extern;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
@ -33,6 +31,7 @@ public interface IFernflowerPreferences {
String IDEA_NOT_NULL_ANNOTATION = "inn";
String LAMBDA_TO_ANONYMOUS_CLASS = "lac";
String BYTECODE_SOURCE_MAPPING = "bsm";
String FAIL_ON_INVALID_BYTECODE = "fib";
String LOG_LEVEL = "log";
String MAX_PROCESSING_METHOD = "mpm";
@ -76,6 +75,7 @@ public interface IFernflowerPreferences {
defaults.put(IDEA_NOT_NULL_ANNOTATION, "1");
defaults.put(LAMBDA_TO_ANONYMOUS_CLASS, "0");
defaults.put(BYTECODE_SOURCE_MAPPING, "0");
defaults.put(FAIL_ON_INVALID_BYTECODE, "1");
defaults.put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name());
defaults.put(MAX_PROCESSING_METHOD, "0");

@ -4,6 +4,7 @@ package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.rels.ClassWrapper;
import org.jetbrains.java.decompiler.main.rels.MethodWrapper;
import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair;
@ -25,7 +26,7 @@ public class ExprUtil {
if (wrapper != null) {
// own class
MethodWrapper methodWrapper = wrapper.getMethodWrapper(CodeConstants.INIT_NAME, descriptor);
if (methodWrapper == null) {
if (methodWrapper == null && !DecompilerContext.getOption(IFernflowerPreferences.FAIL_ON_INVALID_BYTECODE)) {
return null;
}
mask = methodWrapper.synthParameters;

@ -23,7 +23,8 @@ public class SingleClassesTest {
public void setUp() throws IOException {
fixture = new DecompilerTestFixture();
fixture.setUp(IFernflowerPreferences.BYTECODE_SOURCE_MAPPING, "1",
IFernflowerPreferences.DUMP_ORIGINAL_LINES, "1");
IFernflowerPreferences.DUMP_ORIGINAL_LINES, "1",
IFernflowerPreferences.FAIL_ON_INVALID_BYTECODE, "0");
}
@After

Loading…
Cancel
Save