diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java index 3c0fac5..5af0b37 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.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"); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java index b044570..e3236c9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java @@ -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; diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index b9a6e4e..148945e 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -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