Cleanup (unneeded anonymous classes)

master
Roman Shevchenko 9 years ago
parent df863df9c1
commit cfe1448b2b
  1. 28
      src/org/jetbrains/java/decompiler/main/ClassWriter.java
  2. 74
      src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java
  3. 28
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java

@ -980,19 +980,21 @@ public class ClassWriter {
} }
} }
private static final Map<Integer, String> MODIFIERS = new LinkedHashMap<Integer, String>() {{ private static final Map<Integer, String> MODIFIERS;
put(CodeConstants.ACC_PUBLIC, "public"); static {
put(CodeConstants.ACC_PROTECTED, "protected"); MODIFIERS = new LinkedHashMap<>();
put(CodeConstants.ACC_PRIVATE, "private"); MODIFIERS.put(CodeConstants.ACC_PUBLIC, "public");
put(CodeConstants.ACC_ABSTRACT, "abstract"); MODIFIERS.put(CodeConstants.ACC_PROTECTED, "protected");
put(CodeConstants.ACC_STATIC, "static"); MODIFIERS.put(CodeConstants.ACC_PRIVATE, "private");
put(CodeConstants.ACC_FINAL, "final"); MODIFIERS.put(CodeConstants.ACC_ABSTRACT, "abstract");
put(CodeConstants.ACC_STRICT, "strictfp"); MODIFIERS.put(CodeConstants.ACC_STATIC, "static");
put(CodeConstants.ACC_TRANSIENT, "transient"); MODIFIERS.put(CodeConstants.ACC_FINAL, "final");
put(CodeConstants.ACC_VOLATILE, "volatile"); MODIFIERS.put(CodeConstants.ACC_STRICT, "strictfp");
put(CodeConstants.ACC_SYNCHRONIZED, "synchronized"); MODIFIERS.put(CodeConstants.ACC_TRANSIENT, "transient");
put(CodeConstants.ACC_NATIVE, "native"); MODIFIERS.put(CodeConstants.ACC_VOLATILE, "volatile");
}}; MODIFIERS.put(CodeConstants.ACC_SYNCHRONIZED, "synchronized");
MODIFIERS.put(CodeConstants.ACC_NATIVE, "native");
}
private static final int CLASS_ALLOWED = private static final int CLASS_ALLOWED =
CodeConstants.ACC_PUBLIC | CodeConstants.ACC_PROTECTED | CodeConstants.ACC_PRIVATE | CodeConstants.ACC_ABSTRACT | CodeConstants.ACC_PUBLIC | CodeConstants.ACC_PROTECTED | CodeConstants.ACC_PRIVATE | CodeConstants.ACC_ABSTRACT |

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2015 JetBrains s.r.o. * Copyright 2000-2016 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.
@ -59,37 +59,43 @@ public interface IFernflowerPreferences {
String LINE_SEPARATOR_WIN = "\r\n"; String LINE_SEPARATOR_WIN = "\r\n";
String LINE_SEPARATOR_UNX = "\n"; String LINE_SEPARATOR_UNX = "\n";
Map<String, Object> DEFAULTS = Collections.unmodifiableMap(new HashMap<String, Object>() {{ Map<String, Object> DEFAULTS = getDefaults();
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(BYTECODE_SOURCE_MAPPING, "0");
put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name()); static Map<String, Object> getDefaults() {
put(MAX_PROCESSING_METHOD, "0"); Map<String, Object> defaults = new HashMap<>();
put(RENAME_ENTITIES, "0");
put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1")); defaults.put(REMOVE_BRIDGE, "1");
put(INDENT_STRING, " "); defaults.put(REMOVE_SYNTHETIC, "0");
put(BANNER, ""); defaults.put(DECOMPILE_INNER, "1");
put(UNIT_TEST_MODE, "0"); defaults.put(DECOMPILE_CLASS_1_4, "1");
put(DUMP_ORIGINAL_LINES, "0"); defaults.put(DECOMPILE_ASSERTIONS, "1");
}}); defaults.put(HIDE_EMPTY_SUPER, "1");
} defaults.put(HIDE_DEFAULT_CONSTRUCTOR, "1");
defaults.put(DECOMPILE_GENERIC_SIGNATURES, "0");
defaults.put(NO_EXCEPTIONS_RETURN, "1");
defaults.put(DECOMPILE_ENUM, "1");
defaults.put(REMOVE_GET_CLASS_NEW, "1");
defaults.put(LITERALS_AS_IS, "0");
defaults.put(BOOLEAN_TRUE_ONE, "1");
defaults.put(ASCII_STRING_CHARACTERS, "0");
defaults.put(SYNTHETIC_NOT_SET, "1");
defaults.put(UNDEFINED_PARAM_TYPE_OBJECT, "1");
defaults.put(USE_DEBUG_VAR_NAMES, "1");
defaults.put(REMOVE_EMPTY_RANGES, "1");
defaults.put(FINALLY_DEINLINE, "1");
defaults.put(IDEA_NOT_NULL_ANNOTATION, "1");
defaults.put(LAMBDA_TO_ANONYMOUS_CLASS, "0");
defaults.put(BYTECODE_SOURCE_MAPPING, "0");
defaults.put(LOG_LEVEL, IFernflowerLogger.Severity.INFO.name());
defaults.put(MAX_PROCESSING_METHOD, "0");
defaults.put(RENAME_ENTITIES, "0");
defaults.put(NEW_LINE_SEPARATOR, (InterpreterUtil.IS_WINDOWS ? "0" : "1"));
defaults.put(INDENT_STRING, " ");
defaults.put(BANNER, "");
defaults.put(UNIT_TEST_MODE, "0");
defaults.put(DUMP_ORIGINAL_LINES, "0");
return Collections.unmodifiableMap(defaults);
}
}

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2014 JetBrains s.r.o. * Copyright 2000-2016 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.
@ -25,7 +25,6 @@ import org.jetbrains.java.decompiler.struct.gen.FieldDescriptor;
import org.jetbrains.java.decompiler.struct.gen.VarType; import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.struct.match.MatchEngine; import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.struct.match.MatchNode; import org.jetbrains.java.decompiler.struct.match.MatchNode;
import org.jetbrains.java.decompiler.struct.match.IMatchable.MatchProperties;
import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue; import org.jetbrains.java.decompiler.struct.match.MatchNode.RuleValue;
import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.InterpreterUtil;
@ -33,16 +32,18 @@ import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
public class ConstExprent extends Exprent { public class ConstExprent extends Exprent {
private static final Map<Integer, String> ESCAPES = new HashMap<Integer, String>() {{ private static final Map<Integer, String> ESCAPES;
put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */ static {
put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */ ESCAPES = new HashMap<>();
put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */ ESCAPES.put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */
put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */ ESCAPES.put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */
put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */ ESCAPES.put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */
put(new Integer(0x22), "\\\""); /* \u0022: double quote " */ ESCAPES.put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */
put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */ ESCAPES.put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */
put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */ ESCAPES.put(new Integer(0x22), "\\\""); /* \u0022: double quote " */
}}; ESCAPES.put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */
ESCAPES.put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */
}
private VarType constType; private VarType constType;
private final Object value; private final Object value;
@ -432,5 +433,4 @@ public class ConstExprent extends Exprent {
return true; return true;
} }
}
}
Loading…
Cancel
Save