Cleanup (unneeded anonymous classes)

This commit is contained in:
Roman Shevchenko
2016-03-03 13:46:23 +01:00
parent c9c344341b
commit 632ad74ef6
6 changed files with 111 additions and 106 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -21,33 +21,29 @@ package com.intellij.ide.actions;
import com.intellij.execution.actions.EditRunConfigurationsAction;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import javax.swing.*;
public class TemplateProjectSettingsGroup extends DefaultActionGroup {
public TemplateProjectSettingsGroup() {
setPopup(true);
Presentation presentation = getTemplatePresentation();
Presentation presentation = getTemplatePresentation();
presentation.setText("Project Defaults");
presentation.setIcon(AllIcons.General.TemplateProjectSettings);
add(new TemplateProjectPropertiesAction() {{
Presentation p = getTemplatePresentation();
p.setText("Settings");
p.setIcon(AllIcons.General.TemplateProjectSettings);
}});
add(new TemplateProjectStructureAction(){{
Presentation p = getTemplatePresentation();
p.setText("Project Structure");
p.setIcon(AllIcons.General.TemplateProjectStructure);
}});
add(new EditRunConfigurationsAction() {{
Presentation p = getTemplatePresentation();
p.setText("Run Configurations");
p.setIcon(AllIcons.General.CreateNewProjectfromExistingFiles);
}});
add(withTextAndIcon(new TemplateProjectPropertiesAction(), "Settings", AllIcons.General.TemplateProjectSettings));
add(withTextAndIcon(new TemplateProjectStructureAction(), "Project Structure", AllIcons.General.TemplateProjectStructure));
add(withTextAndIcon(new EditRunConfigurationsAction(), "Run Configurations", AllIcons.General.CreateNewProjectfromExistingFiles));
}
}
private static AnAction withTextAndIcon(AnAction action, String text, Icon icon) {
Presentation presentation = action.getTemplatePresentation();
presentation.setText(text);
presentation.setIcon(icon);
return action;
}
}
@@ -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");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package com.intellij.ide.passwordSafe.impl.providers.masterKey.windows;
import com.intellij.ide.passwordSafe.MasterPasswordUnavailableException;
import com.intellij.util.containers.ContainerUtil;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
@@ -25,10 +26,10 @@ import com.sun.jna.win32.W32APIFunctionMapper;
import com.sun.jna.win32.W32APITypeMapper;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.intellij.openapi.util.Pair.pair;
import static com.sun.jna.Library.OPTION_FUNCTION_MAPPER;
import static com.sun.jna.Library.OPTION_TYPE_MAPPER;
@@ -39,10 +40,9 @@ public class WindowsCryptUtils {
/**
* Unicode options for the libraries
*/
static final Map<String, Object> UNICODE_OPTIONS = new HashMap<String, Object>() {{
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
}};
private static final Map<String, Object> UNICODE_OPTIONS = ContainerUtil.newHashMap(
pair(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE),
pair(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE));
private WindowsCryptUtils() { }
@@ -143,4 +143,4 @@ public class WindowsCryptUtils {
Pointer LocalFree(Pointer hMem);
W32API.DWORD GetLastError();
}
}
}
@@ -980,19 +980,21 @@ public class ClassWriter {
}
}
private static final Map<Integer, String> MODIFIERS = new LinkedHashMap<Integer, String>() {{
put(CodeConstants.ACC_PUBLIC, "public");
put(CodeConstants.ACC_PROTECTED, "protected");
put(CodeConstants.ACC_PRIVATE, "private");
put(CodeConstants.ACC_ABSTRACT, "abstract");
put(CodeConstants.ACC_STATIC, "static");
put(CodeConstants.ACC_FINAL, "final");
put(CodeConstants.ACC_STRICT, "strictfp");
put(CodeConstants.ACC_TRANSIENT, "transient");
put(CodeConstants.ACC_VOLATILE, "volatile");
put(CodeConstants.ACC_SYNCHRONIZED, "synchronized");
put(CodeConstants.ACC_NATIVE, "native");
}};
private static final Map<Integer, String> MODIFIERS;
static {
MODIFIERS = new LinkedHashMap<>();
MODIFIERS.put(CodeConstants.ACC_PUBLIC, "public");
MODIFIERS.put(CodeConstants.ACC_PROTECTED, "protected");
MODIFIERS.put(CodeConstants.ACC_PRIVATE, "private");
MODIFIERS.put(CodeConstants.ACC_ABSTRACT, "abstract");
MODIFIERS.put(CodeConstants.ACC_STATIC, "static");
MODIFIERS.put(CodeConstants.ACC_FINAL, "final");
MODIFIERS.put(CodeConstants.ACC_STRICT, "strictfp");
MODIFIERS.put(CodeConstants.ACC_TRANSIENT, "transient");
MODIFIERS.put(CodeConstants.ACC_VOLATILE, "volatile");
MODIFIERS.put(CodeConstants.ACC_SYNCHRONIZED, "synchronized");
MODIFIERS.put(CodeConstants.ACC_NATIVE, "native");
}
private static final int CLASS_ALLOWED =
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");
* 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_UNX = "\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(BYTECODE_SOURCE_MAPPING, "0");
Map<String, Object> DEFAULTS = getDefaults();
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, " ");
put(BANNER, "");
put(UNIT_TEST_MODE, "0");
put(DUMP_ORIGINAL_LINES, "0");
}});
}
static Map<String, Object> getDefaults() {
Map<String, Object> defaults = new HashMap<>();
defaults.put(REMOVE_BRIDGE, "1");
defaults.put(REMOVE_SYNTHETIC, "0");
defaults.put(DECOMPILE_INNER, "1");
defaults.put(DECOMPILE_CLASS_1_4, "1");
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");
* 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.match.MatchEngine;
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.util.InterpreterUtil;
@@ -33,16 +32,18 @@ import java.util.*;
import java.util.Map.Entry;
public class ConstExprent extends Exprent {
private static final Map<Integer, String> ESCAPES = new HashMap<Integer, String>() {{
put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */
put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */
put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */
put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */
put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */
put(new Integer(0x22), "\\\""); /* \u0022: double quote " */
put(new Integer(0x27), "\\\'"); /* \u0027: single quote ' */
put(new Integer(0x5C), "\\\\"); /* \u005c: backslash \ */
}};
private static final Map<Integer, String> ESCAPES;
static {
ESCAPES = new HashMap<>();
ESCAPES.put(new Integer(0x8), "\\b"); /* \u0008: backspace BS */
ESCAPES.put(new Integer(0x9), "\\t"); /* \u0009: horizontal tab HT */
ESCAPES.put(new Integer(0xA), "\\n"); /* \u000a: linefeed LF */
ESCAPES.put(new Integer(0xC), "\\f"); /* \u000c: form feed FF */
ESCAPES.put(new Integer(0xD), "\\r"); /* \u000d: carriage return CR */
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 final Object value;
@@ -432,5 +433,4 @@ public class ConstExprent extends Exprent {
return true;
}
}
}
@@ -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");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.intellij.openapi.util.Pair.pair;
import static com.intellij.openapi.util.text.StringUtil.startsWithIgnoreCase;
public class XmlEmmetParser extends EmmetParser {
@@ -57,23 +58,23 @@ public class XmlEmmetParser extends EmmetParser {
private boolean hasTagContext = false;
private final Stack<String> tagLevel = new Stack<String>();
private static final Map<String, String> parentChildTagMapping = new HashMap<String, String>() {{
put("p", "span");
put("ul", "li");
put("ol", "li");
put("table", "tr");
put("tr", "td");
put("tbody", "tr");
put("thead", "tr");
put("tfoot", "tr");
put("colgroup", "col");
put("select", "option");
put("optgroup", "option");
put("audio", "source");
put("video", "source");
put("object", "param");
put("map", "area");
}};
private static final Map<String, String> parentChildTagMapping = ContainerUtil.newHashMap(
pair("p", "span"),
pair("ul", "li"),
pair("ol", "li"),
pair("table", "tr"),
pair("tr", "td"),
pair("tbody", "tr"),
pair("thead", "tr"),
pair("tfoot", "tr"),
pair("colgroup", "col"),
pair("select", "option"),
pair("optgroup", "option"),
pair("audio", "source"),
pair("video", "source"),
pair("object", "param"),
pair("map", "area"));
private boolean isHtml;
public XmlEmmetParser(List<ZenCodingToken> tokens,