Commit 59e2d9dd authored by Alexey Kudravtsev's avatar Alexey Kudravtsev
Browse files

minor performance: removed redundant initializers in java analysis

parent 88f7a84c
Branches unavailable Tags unavailable
No related merge requests found
Showing with 74 additions and 70 deletions
+74 -70
/*
* Copyright 2000-2009 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.
......@@ -44,10 +44,10 @@ import java.util.*;
* @author cdr
*/
public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
private BidirectionalMap<String, QuickFix> myQuickFixes = null;
private BidirectionalMap<String, QuickFix> myQuickFixes;
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.RedundantSuppressInspection");
public boolean IGNORE_ALL = false;
public boolean IGNORE_ALL;
@Override
@NotNull
......
/*
* 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.
......@@ -51,7 +51,7 @@ import java.util.List;
public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTool {
private static final Logger LOG = Logger.getInstance("#" + StreamApiMigrationInspection.class.getName());
public boolean REPLACE_TRIVIAL_FOREACH = false;
public boolean REPLACE_TRIVIAL_FOREACH;
@Nullable
@Override
......
/*
* 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.
......@@ -26,9 +26,12 @@ import org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException;
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue;
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.*;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.In;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.InOut;
class AbstractValues {
static final class ParamValue extends BasicValue {
......@@ -213,7 +216,7 @@ abstract class Analysis<Res> {
final protected List<State>[] computed;
final Key aKey;
Res earlyResult = null;
Res earlyResult;
protected Analysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
this.richControlFlow = richControlFlow;
......
/*
* 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.
......@@ -34,8 +34,9 @@ import java.util.List;
import java.util.Set;
import static com.intellij.codeInspection.bytecodeAnalysis.AbstractValues.*;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.InOut;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.Out;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.*;
class InOutAnalysis extends Analysis<Result> {
......@@ -47,8 +48,8 @@ class InOutAnalysis extends Analysis<Result> {
private final Value inValue;
private final int generalizeShift;
private Result internalResult;
private int id = 0;
private int pendingTop = 0;
private int id;
private int pendingTop;
protected InOutAnalysis(RichControlFlow richControlFlow, Direction direction, boolean[] resultOrigins, boolean stable, State[] pending) {
super(richControlFlow, direction, stable);
......@@ -273,7 +274,7 @@ class InOutInterpreter extends BasicInterpreter {
final boolean[] resultOrigins;
final boolean nullAnalysis;
boolean deReferenced = false;
boolean deReferenced;
InOutInterpreter(Direction direction, InsnList insns, boolean[] resultOrigins) {
this.direction = direction;
......
/*
* 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.
......@@ -211,12 +211,12 @@ class NullableMethodInterpreter extends BasicInterpreter implements InterpreterE
private final int[] originsMapping;
final Key[] keys;
Constraint constraint = null;
int delta = 0;
int nullsDelta = 0;
Constraint constraint;
int delta;
int nullsDelta;
int notNullInsn = -1;
int notNullCall = 0;
int notNullNull = 0;
int notNullCall;
int notNullNull;
NullableMethodInterpreter(InsnList insns, boolean[] origins, int[] originsMapping) {
this.insns = insns;
......
/*
* 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.
......@@ -34,9 +34,9 @@ import java.util.List;
import java.util.Set;
import static com.intellij.codeInspection.bytecodeAnalysis.AbstractValues.*;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.In;
import static com.intellij.codeInspection.bytecodeAnalysis.PResults.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
import static com.intellij.codeInspection.bytecodeAnalysis.Direction.*;
abstract class PResults {
// SoP = sum of products
......@@ -211,9 +211,9 @@ class NonNullInAnalysis extends Analysis<PResult> {
}
}
private int id = 0;
private Frame<BasicValue> nextFrame = null;
private PResult subResult = null;
private int id;
private Frame<BasicValue> nextFrame;
private PResult subResult;
@NotNull
protected Equation analyze() throws AnalyzerException {
......@@ -383,7 +383,7 @@ class NonNullInAnalysis extends Analysis<PResult> {
}
private int pendingTop = 0;
private int pendingTop;
private void pendingPush(PendingAction action) throws AnalyzerException {
if (pendingTop >= STEPS_LIMIT) {
......@@ -437,11 +437,11 @@ class NullableInAnalysis extends Analysis<PResult> {
}
}
private int id = 0;
private Frame<BasicValue> nextFrame = null;
private int id;
private Frame<BasicValue> nextFrame;
private PResult myResult = Identity;
private PResult subResult = Identity;
private boolean top = false;
private boolean top;
@NotNull
protected Equation analyze() throws AnalyzerException {
......@@ -573,7 +573,7 @@ class NullableInAnalysis extends Analysis<PResult> {
}
private int pendingTop = 0;
private int pendingTop;
private void pendingPush(State state) throws AnalyzerException {
if (pendingTop >= STEPS_LIMIT) {
......@@ -602,7 +602,7 @@ class NullableInAnalysis extends Analysis<PResult> {
}
abstract class NullityInterpreter extends BasicInterpreter {
boolean top = false;
boolean top;
final boolean nullableAnalysis;
final int nullityMask;
private PResult subResult = Identity;
......
/*
* 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.
......@@ -299,8 +299,8 @@ class ParametersUsage extends Interpreter<ParamsValue> {
class IParametersUsage extends Interpreter<IParamsValue> {
static final IParamsValue val1 = new IParamsValue(0, 1);
static final IParamsValue val2 = new IParamsValue(0, 2);
int leaking = 0;
int nullableLeaking = 0;
int leaking;
int nullableLeaking;
int called = -1;
final int rangeStart;
final int rangeEnd;
......
/*
* 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.
......@@ -47,8 +47,8 @@ import java.awt.*;
public class CanBeFinalInspection extends GlobalJavaBatchInspectionTool {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.canBeFinal.CanBeFinalInspection");
public boolean REPORT_CLASSES = false;
public boolean REPORT_METHODS = false;
public boolean REPORT_CLASSES;
public boolean REPORT_METHODS;
public boolean REPORT_FIELDS = true;
public static final String DISPLAY_NAME = InspectionsBundle.message("inspection.can.be.final.display.name");
@NonNls public static final String SHORT_NAME = "CanBeFinal";
......
/*
* 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.
......@@ -63,10 +63,10 @@ import java.util.*;
public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.dataFlow.DataFlowInspection");
@NonNls private static final String SHORT_NAME = "ConstantConditions";
public boolean SUGGEST_NULLABLE_ANNOTATIONS = false;
public boolean DONT_REPORT_TRUE_ASSERT_STATEMENTS = false;
public boolean TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = false;
public boolean IGNORE_ASSERT_STATEMENTS = false;
public boolean SUGGEST_NULLABLE_ANNOTATIONS;
public boolean DONT_REPORT_TRUE_ASSERT_STATEMENTS;
public boolean TREAT_UNKNOWN_MEMBERS_AS_NULLABLE;
public boolean IGNORE_ASSERT_STATEMENTS;
public boolean REPORT_CONSTANT_REFERENCE_VALUES = true;
@Override
......
......@@ -77,7 +77,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
final List<EntryPoint> myExtensions = ContainerUtil.createLockFreeCopyOnWriteList();
final UnusedSymbolLocalInspectionBase myLocalInspectionBase = createUnusedSymbolLocalInspection();
private Set<RefElement> myProcessedSuspicious = null;
private Set<RefElement> myProcessedSuspicious;
private int myPhase;
private GlobalInspectionContext myContext;
private final boolean myEnabledInEditor;
......
......@@ -34,7 +34,7 @@ import java.util.*;
import java.util.List;
public class DefUseInspectionBase extends BaseJavaBatchLocalInspectionTool {
public boolean REPORT_PREFIX_EXPRESSIONS = false;
public boolean REPORT_PREFIX_EXPRESSIONS;
public boolean REPORT_POSTFIX_EXPRESSIONS = true;
public boolean REPORT_REDUNDANT_INITIALIZER = true;
......
/*
* 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.
......@@ -44,7 +44,7 @@ public class DeprecationInspection extends BaseJavaBatchLocalInspectionTool {
public static final String DISPLAY_NAME = DeprecationUtil.DEPRECATION_DISPLAY_NAME;
public static final String IGNORE_METHODS_OF_DEPRECATED_NAME = "IGNORE_METHODS_OF_DEPRECATED";
public boolean IGNORE_INSIDE_DEPRECATED = false;
public boolean IGNORE_INSIDE_DEPRECATED;
public boolean IGNORE_ABSTRACT_DEPRECATED_OVERRIDES = true;
public boolean IGNORE_IMPORT_STATEMENTS = true;
public boolean IGNORE_METHODS_OF_DEPRECATED = true;
......
/*
* 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.
......@@ -26,7 +26,7 @@ import javax.swing.*;
public class DuplicateThrowsInspection extends BaseJavaBatchLocalInspectionTool implements CleanupLocalInspectionTool {
@SuppressWarnings("PublicField")
public boolean ignoreSubclassing = false;
public boolean ignoreSubclassing;
@Override
@NotNull
......
......@@ -77,7 +77,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
@NonNls private static final String VERSION_ATTR = "version";
@NonNls private static final String ENTRY_POINT_ATTR = "entry_point";
private boolean myAddNonJavaEntries = true;
private boolean myResolved = false;
private boolean myResolved;
protected final Project myProject;
private long myLastModificationCount = -1;
......
/*
* 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.
......@@ -118,7 +118,7 @@ public class InheritorsStatisticalDataSearch {
myAllNotAnonymousInheritors = new HashSet<String>();
}
private int myAnonymousInheritorsCount = 0;
private int myAnonymousInheritorsCount;
private Set<String> getAllNotAnonymousInheritors() {
return myAllNotAnonymousInheritors;
......
/*
* 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.
......@@ -98,7 +98,7 @@ public class Java15APIUsageInspectionBase extends BaseJavaBatchLocalInspectionTo
ourDefaultMethods.add("java.util.Iterator#remove()");
}
protected LanguageLevel myEffectiveLanguageLevel = null;
protected LanguageLevel myEffectiveLanguageLevel;
@Nullable
private static Set<String> getForbiddenApi(@NotNull LanguageLevel languageLevel) {
......
......@@ -78,17 +78,17 @@ public class JavaDocLocalInspectionBase extends BaseJavaBatchLocalInspectionTool
public Options INNER_CLASS_OPTIONS = new Options("none", "");
public Options METHOD_OPTIONS = new Options("none", "@return@param@throws or @exception");
public Options FIELD_OPTIONS = new Options("none", "");
public boolean IGNORE_DEPRECATED = false;
public boolean IGNORE_DEPRECATED;
public boolean IGNORE_JAVADOC_PERIOD = true;
@SuppressWarnings("unused") @Deprecated
public boolean IGNORE_DUPLICATED_THROWS = false;
public boolean IGNORE_POINT_TO_ITSELF = false;
public boolean IGNORE_DUPLICATED_THROWS;
public boolean IGNORE_POINT_TO_ITSELF;
public String myAdditionalJavadocTags = "";
private boolean myIgnoreDuplicatedThrows = true;
private boolean myIgnoreEmptyDescriptions = false;
private boolean myIgnoreSimpleAccessors = false;
private boolean myIgnoreEmptyDescriptions;
private boolean myIgnoreSimpleAccessors;
public void setPackageOption(String modifier, String tags) {
PACKAGE_OPTIONS.ACCESS_JAVADOC_REQUIRED_FOR = modifier;
......@@ -451,7 +451,7 @@ public class JavaDocLocalInspectionBase extends BaseJavaBatchLocalInspectionTool
private class ProblemHolderImpl implements JavadocHighlightUtil.ProblemHolder {
private final InspectionManager myManager;
private final boolean myOnTheFly;
private List<ProblemDescriptor> myProblems = null;
private List<ProblemDescriptor> myProblems;
private ProblemHolderImpl(InspectionManager manager, boolean onTheFly) {
myManager = manager;
......
......@@ -52,9 +52,9 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE = true;
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL = true;
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_GETTER = true;
@SuppressWarnings({"WeakerAccess"}) public boolean IGNORE_EXTERNAL_SUPER_NOTNULL = false;
@SuppressWarnings({"WeakerAccess"}) public boolean IGNORE_EXTERNAL_SUPER_NOTNULL;
@SuppressWarnings({"WeakerAccess"}) public boolean REQUIRE_NOTNULL_FIELDS_INITIALIZED = true;
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED = false;
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED;
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_SETTER_PARAMETER = true;
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true; // remains for test
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NULLS_PASSED_TO_NON_ANNOTATED_METHOD = true;
......
/*
* Copyright 2000-2013 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.
......@@ -46,8 +46,8 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
private static final String DISPLAY_NAME = InspectionsBundle.message("inspection.redundant.cast.display.name");
@NonNls private static final String SHORT_NAME = "RedundantCast";
public boolean IGNORE_ANNOTATED_METHODS = false;
public boolean IGNORE_SUSPICIOUS_METHOD_CALLS = false;
public boolean IGNORE_ANNOTATED_METHODS;
public boolean IGNORE_SUSPICIOUS_METHOD_CALLS;
public RedundantCastInspection() {
......
/*
* Copyright 2000-2013 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.
......@@ -50,11 +50,11 @@ public class UncheckedWarningLocalInspectionBase extends BaseJavaBatchLocalInspe
public static final String DISPLAY_NAME = InspectionsBundle.message("unchecked.warning");
@NonNls private static final String ID = "unchecked";
private static final Logger LOG = Logger.getInstance("#" + UncheckedWarningLocalInspectionBase.class);
public boolean IGNORE_UNCHECKED_ASSIGNMENT = false;
public boolean IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION = false;
public boolean IGNORE_UNCHECKED_CALL = false;
public boolean IGNORE_UNCHECKED_CAST = false;
public boolean IGNORE_UNCHECKED_OVERRIDING = false;
public boolean IGNORE_UNCHECKED_ASSIGNMENT;
public boolean IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION;
public boolean IGNORE_UNCHECKED_CALL;
public boolean IGNORE_UNCHECKED_CAST;
public boolean IGNORE_UNCHECKED_OVERRIDING;
protected static JCheckBox createSetting(final String cbText,
final boolean option,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment