diff options
Diffstat (limited to 'plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern')
5 files changed, 228 insertions, 0 deletions
diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java new file mode 100644 index 000000000000..adf32707379e --- /dev/null +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java @@ -0,0 +1,22 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.java.decompiler.main.extern; + +import java.io.IOException; + +public interface IBytecodeProvider { + byte[] getBytecode(String externalPath, String internalPath) throws IOException; +} diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java new file mode 100644 index 000000000000..65b2c6da8641 --- /dev/null +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.java.decompiler.main.extern; + +public abstract class IFernflowerLogger { + + public enum Severity { + TRACE, INFO, WARN, ERROR + } + + private Severity severity = Severity.INFO; + + public boolean accepts(Severity severity) { + return severity.ordinal() >= this.severity.ordinal(); + } + + public void setSeverity(Severity severity) { + this.severity = severity; + } + + public abstract void writeMessage(String message, Severity severity); + + public abstract void writeMessage(String message, Throwable t); + + public void startClass(String className) { } + + public void endClass() { } + + public void startWriteClass(String className) { } + + public void endWriteClass() { } + + public void startMethod(String methodName) { } + + public void endMethod() { } +} diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java new file mode 100644 index 000000000000..69dd218a0340 --- /dev/null +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java @@ -0,0 +1,86 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.java.decompiler.main.extern; + +import org.jetbrains.java.decompiler.util.InterpreterUtil; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public interface IFernflowerPreferences { + String REMOVE_BRIDGE = "rbr"; + String REMOVE_SYNTHETIC = "rsy"; + String DECOMPILE_INNER = "din"; + String DECOMPILE_CLASS_1_4 = "dc4"; + String DECOMPILE_ASSERTIONS = "das"; + String HIDE_EMPTY_SUPER = "hes"; + String HIDE_DEFAULT_CONSTRUCTOR = "hdc"; + String DECOMPILE_GENERIC_SIGNATURES = "dgs"; + String NO_EXCEPTIONS_RETURN = "ner"; + String DECOMPILE_ENUM = "den"; + String REMOVE_GET_CLASS_NEW = "rgn"; + String LITERALS_AS_IS = "lit"; + String BOOLEAN_TRUE_ONE = "bto"; + String ASCII_STRING_CHARACTERS = "asc"; + String SYNTHETIC_NOT_SET = "nns"; + String UNDEFINED_PARAM_TYPE_OBJECT = "uto"; + String USE_DEBUG_VAR_NAMES = "udv"; + String REMOVE_EMPTY_RANGES = "rer"; + String FINALLY_DEINLINE = "fdi"; + String IDEA_NOT_NULL_ANNOTATION = "inn"; + String LAMBDA_TO_ANONYMOUS_CLASS = "lac"; + + String LOG_LEVEL = "log"; + String MAX_PROCESSING_METHOD = "mpm"; + String RENAME_ENTITIES = "ren"; + String USER_RENAMER_CLASS = "urc"; + String NEW_LINE_SEPARATOR = "nls"; + String INDENT_STRING = "ind"; + + String LINE_SEPARATOR_WIN = "\r\n"; + String LINE_SEPARATOR_LIN = "\n"; + + Map<String, Object> DEFAULTS = Collections.unmodifiableMap(new HashMap<String, Object>() {{ + put(REMOVE_BRIDGE, "1"); + put(REMOVE_SYNTHETIC, "0"); + put(DECOMPILE_INNER, "1"); + put(DECOMPILE_CLASS_1_4, "1"); + put(DECOMPILE_ASSERTIONS, "1"); + put(HIDE_EMPTY_SUPER, "1"); + put(HIDE_DEFAULT_CONSTRUCTOR, "1"); + put(DECOMPILE_GENERIC_SIGNATURES, "0"); + put(NO_EXCEPTIONS_RETURN, "1"); + put(DECOMPILE_ENUM, "1"); + put(REMOVE_GET_CLASS_NEW, "1"); + put(LITERALS_AS_IS, "0"); + put(BOOLEAN_TRUE_ONE, "1"); + put(ASCII_STRING_CHARACTERS, "0"); + put(SYNTHETIC_NOT_SET, "1"); + put(UNDEFINED_PARAM_TYPE_OBJECT, "1"); + put(USE_DEBUG_VAR_NAMES, "1"); + put(REMOVE_EMPTY_RANGES, "1"); + put(FINALLY_DEINLINE, "1"); + put(IDEA_NOT_NULL_ANNOTATION, "1"); + put(LAMBDA_TO_ANONYMOUS_CLASS, "0"); + + put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name()); + put(MAX_PROCESSING_METHOD, "0"); + put(RENAME_ENTITIES, "0"); + put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1")); + put(INDENT_STRING, " "); + }}); +} diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java new file mode 100644 index 000000000000..fc0971e10612 --- /dev/null +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.java.decompiler.main.extern; + + +public interface IIdentifierRenamer { + + int ELEMENT_CLASS = 1; + + int ELEMENT_FIELD = 2; + + int ELEMENT_METHOD = 3; + + + boolean toBeRenamed(int element_type, String classname, String element, String descriptor); + + String getNextClassname(String fullname, String shortname); + + String getNextFieldname(String classname, String field, String descriptor); + + String getNextMethodname(String classname, String method, String descriptor); +} diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java new file mode 100644 index 000000000000..1e6a7d4262a5 --- /dev/null +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/extern/IResultSaver.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.java.decompiler.main.extern; + +import java.util.jar.Manifest; + +public interface IResultSaver { + void saveFolder(String path); + + void copyFile(String source, String path, String entryName); + + void saveClassFile(String path, String qualifiedName, String entryName, String content); + + void createArchive(String path, String archiveName, Manifest manifest); + + void saveDirEntry(String path, String archiveName, String entryName); + + void copyEntry(String source, String path, String archiveName, String entry); + + void saveClassEntry(String path, String archiveName, String qualifiedName, String entryName, String content); + + void closeArchive(String path, String archiveName); +} |