Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vasily Pisar
2016-04-29 16:56:31 +03:00
464 changed files with 4694 additions and 4385 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
!define PRODUCT_UNINST_ICON_FILE "idea_uninst.ico"
!define PRODUCT_LOGO_FILE "logo.bmp"
!define PRODUCT_HEADER_FILE "headerlogo.bmp"
!define ASSOCIATION ".java,.groovy"
!define ASSOCIATION ".java,.groovy,.kt"
!define UNINSTALL_WEB_PAGE "https://www.jetbrains.com/idea/uninstall/?edition=IU-__VERSION_MAJOR__.__VERSION_MINOR__"
; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDEA build has been installed
+1 -1
View File
@@ -7,7 +7,7 @@
!define PRODUCT_UNINST_ICON_FILE "idea_CEuninst.ico"
!define PRODUCT_LOGO_FILE "logoCE.bmp"
!define PRODUCT_HEADER_FILE "headerlogoCE.bmp"
!define ASSOCIATION ".java,.groovy"
!define ASSOCIATION ".java,.groovy,.kt"
!define UNINSTALL_WEB_PAGE "https://www.jetbrains.com/idea/uninstall/?edition=IC-__VERSION_MAJOR__.__VERSION_MINOR__"
; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDEA build has been installed
+15 -6
View File
@@ -42,25 +42,25 @@ def unpackJdks() {
return
}
unpackJdk(osDir, jdkDir, "jre6")
unpackJdk(osDir, jdkDir, "jbsdk8")
unpackJdk(osDir, jdkDir, "jre6", "1.6")
unpackJdk(osDir, jdkDir, "jbsdk8", "1.8")
}
private void unpackJdk(File osDir, File jdkDir, String majorVersion) {
def jdkFiles = osDir.listFiles().findAll { it.name.startsWith("$majorVersion") }
private void unpackJdk(File osDir, File jdkDir, String archiveFileNamePrefix, String targetDirectoryName) {
def jdkFiles = osDir.listFiles().findAll { it.name.startsWith(archiveFileNamePrefix) }
if (SystemInfo.isWindows) {
def arch = System.getenv("ProgramFiles(x86)") != null ? "x64" : "x86"
jdkFiles = jdkFiles.findAll { it.name.endsWith("_${arch}.tar.gz") }
}
if (jdkFiles.empty) {
projectBuilder.error("Cannot unpack JDK: $majorVersion not found in $osDir")
projectBuilder.error("Cannot unpack JDK: $archiveFileNamePrefix not found in $osDir")
}
if (jdkFiles.size() > 1) {
projectBuilder.error("Cannot unpack JDK: several matching files are found ($jdkFiles)")
}
File jdkFile = jdkFiles.first()
def destDir = new File(jdkDir, ("1." + majorVersion.substring(majorVersion.length()-1, majorVersion.length())))
def destDir = new File(jdkDir, targetDirectoryName)
FileUtil.delete(destDir)
projectBuilder.info("Extracting $jdkFile to $destDir")
ant.mkdir(dir: destDir)
@@ -77,6 +77,15 @@ private void unpackJdk(File osDir, File jdkDir, String majorVersion) {
arg(value: "--directory")
arg(value: destDir)
}
def jdkContents = new File(destDir, "jdk/Contents")
if (SystemInfo.isMac && jdkContents.exists()) {
jdkContents.listFiles().each { file ->
ant.exec(executable: "mv", dir: destDir) {
arg(value: file.absolutePath)
arg(value: destDir)
}
}
}
}
}
else {
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* created at Jan 3, 2002
* @author Jeka
*/
package com.intellij.compiler;
import com.intellij.CommonBundle;
@@ -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.
@@ -14,11 +14,6 @@
* limitations under the License.
*/
/**
* @author: Eugene Zhuravlev
* Date: Jan 17, 2003
* Time: 1:42:26 PM
*/
package com.intellij.compiler.impl;
import com.intellij.CommonBundle;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.compiler.impl.packagingCompiler;
import com.intellij.openapi.fileTypes.FileTypeManager;
@@ -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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.openapi.projectRoots.impl;
import com.intellij.openapi.projectRoots.Sdk;
@@ -1,5 +1,17 @@
/**
* @author cdr
/*
* 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.
* 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 com.intellij.packaging.impl.ui.actions;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* created at Jan 3, 2002
* @author Jeka
*/
package com.intellij.openapi.compiler.options;
import com.intellij.openapi.Disposable;
@@ -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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* class ExportThreadsAction
* @author Jeka
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerManagerEx;
@@ -14,11 +14,6 @@
* limitations under the License.
*/
/**
* class ExportThreadsAction
* @author Eugene Zhuravlev
* @author Sascha Weinreuter
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerBundle;
@@ -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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* class ToggleMethodBreakpointAction
* @author Jeka
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerManagerEx;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,17 +14,10 @@
* limitations under the License.
*/
/**
* class ArrayInitializerEvaluator
* created Jun 28, 2001
* @author Jeka
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
class ArrayInitializerEvaluator implements Evaluator{
private final Evaluator[] myValueEvaluators;
@@ -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.
@@ -14,11 +14,6 @@
* limitations under the License.
*/
/**
* class NewArrayInstanceEvaluator
* created Jun 27, 2001
* @author Jeka
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.DebuggerBundle;
@@ -14,11 +14,6 @@
* limitations under the License.
*/
/**
* class NewArrayInstanceEvaluator
* created Jun 27, 2001
* @author Jeka
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.DebuggerBundle;
@@ -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.
@@ -226,8 +226,8 @@ class Bytecodes {
*/
static final int BSM = 33;
/**
* Computes the instruction types of JVM opcodes.
/*
Computes the instruction types of JVM opcodes.
*/
static {
int i;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* class FieldBreakpointPropertiesPanel
* @author Jeka
*/
package com.intellij.debugger.ui.breakpoints;
import com.intellij.debugger.DebuggerBundle;
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* class FilteredRequestorImpl
* @author Jeka
*/
package com.intellij.debugger.ui.breakpoints;
import com.intellij.debugger.InstanceFilter;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,10 +14,6 @@
* limitations under the License.
*/
/**
* class MethodBreakpointPropertiesPanel
* @author Jeka
*/
package com.intellij.debugger.ui.breakpoints;
import com.intellij.debugger.DebuggerBundle;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 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,10 +21,6 @@ import com.intellij.openapi.util.Pair;
import java.io.File;
import java.util.List;
/**
* @author Maxim.Medvedev
*/
/**
* @deprecated use {@link com.intellij.ide.util.projectWizard.importSources.JavaSourceRootDetector} instead
*/
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,13 +14,6 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 13, 2002
* Time: 3:26:50 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.QuickFixBundle;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,20 +14,20 @@
* limitations under the License.
*/
/**
* Propose to cast one argument to corresponding type
* in the constructor invocation
* E.g.
*
* User: cdr
* Date: Nov 13, 2002
/*
Propose to cast one argument to corresponding type
in the constructor invocation
E.g.
User: cdr
Date: Nov 13, 2002
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;
public class ConstructorParametersFixer {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,28 +14,14 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 13, 2002
* Time: 3:26:50 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.util.RefactoringChangeUtil;
import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.Set;
public class QualifySuperArgumentFix extends QualifyThisOrSuperArgumentFix {
public QualifySuperArgumentFix(@NotNull PsiExpression expression, @NotNull PsiClass psiClass) {
super(expression, psiClass);
@@ -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.
@@ -14,13 +14,6 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 13, 2002
* Time: 3:26:50 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,33 +14,19 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 13, 2002
* Time: 3:26:50 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.util.RefactoringChangeUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.Set;
public abstract class QualifyThisOrSuperArgumentFix implements IntentionAction {
protected static final Logger LOG = Logger.getInstance("#" + QualifyThisOrSuperArgumentFix.class.getName());
protected final PsiExpression myExpression;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.FileModificationService;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -160,8 +160,8 @@ public class VariableArrayTypeFix extends LocalQuickFixOnPsiElement {
final PsiArrayInitializerExpression myInitializer = (PsiArrayInitializerExpression)startElement;
final PsiVariable myVariable = getVariableLocal(myInitializer);
if (myVariable == null) return;
/**
* only for the case when in same statement with initialization
/*
only for the case when in same statement with initialization
*/
final PsiNewExpression myNewExpression = getNewExpressionLocal(myInitializer);
@@ -139,6 +139,15 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
if (inferredType == null) {
return true;
}
PsiType inferenceMethodReturnType = LambdaUtil.getFunctionalInterfaceReturnType(inferredType);
PsiType existingMethodReturnType = method.getReturnType();
if (existingMethodReturnType == null ||
inferenceMethodReturnType != null &&
!PsiType.VOID.equals(inferenceMethodReturnType) && !TypeConversionUtil.isAssignable(existingMethodReturnType, inferenceMethodReturnType)) {
return true;
}
final ForbiddenRefsChecker checker = new ForbiddenRefsChecker(method, aClass, inferredType != PsiType.NULL ? inferredType : null);
final PsiCodeBlock body = method.getBody();
LOG.assertTrue(body != null);
@@ -1,5 +1,5 @@
/*
* 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
@@ -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.
@@ -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
@@ -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.
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -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";
@@ -19,8 +19,6 @@ import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
import com.intellij.codeInspection.dataFlow.instructions.MethodCallInstruction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
@@ -28,8 +26,6 @@ import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.Function;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.siyeh.ig.psiutils.SideEffectChecker;
import org.jetbrains.annotations.NotNull;
@@ -52,19 +48,11 @@ public class ContractInference {
return Collections.emptyList();
}
return CachedValuesManager.getCachedValue(method, new CachedValueProvider<List<MethodContract>>() {
@Nullable
@Override
public Result<List<MethodContract>> compute() {
List<MethodContract> result = RecursionManager.doPreventingRecursion(method, true, new Computable<List<MethodContract>>() {
@Override
public List<MethodContract> compute() {
return new ContractInferenceInterpreter(method).inferContracts();
}
});
if (result == null) result = Collections.emptyList();
return Result.create(result, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
return CachedValuesManager.getCachedValue(method, () -> {
List<MethodContract> result = RecursionManager.doPreventingRecursion(method, true, () ->
new ContractInferenceInterpreter(method).inferContracts());
if (result == null) result = Collections.emptyList();
return CachedValueProvider.Result.create(result, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
}
}
@@ -91,14 +79,11 @@ class ContractInferenceInterpreter {
if (referenceTypeReturned) {
contracts = boxReturnValues(contracts);
}
List<MethodContract> compatible = ContainerUtil.filter(contracts, new Condition<MethodContract>() {
@Override
public boolean value(MethodContract contract) {
if (notNull && contract.returnValue == NOT_NULL_VALUE) {
return false;
}
return InferenceFromSourceUtil.isReturnTypeCompatible(returnType, contract.returnValue);
List<MethodContract> compatible = ContainerUtil.filter(contracts, contract -> {
if (notNull && contract.returnValue == NOT_NULL_VALUE) {
return false;
}
return InferenceFromSourceUtil.isReturnTypeCompatible(returnType, contract.returnValue);
});
if (compatible.size() > ContractInference.MAX_CONTRACT_COUNT) {
LOG.debug("Too many contracts for " + PsiUtil.getMemberQualifiedName(myMethod) + ", shrinking the list");
@@ -109,14 +94,11 @@ class ContractInferenceInterpreter {
@NotNull
private static List<MethodContract> boxReturnValues(List<MethodContract> contracts) {
return ContainerUtil.mapNotNull(contracts, new Function<MethodContract, MethodContract>() {
@Override
public MethodContract fun(MethodContract contract) {
if (contract.returnValue == FALSE_VALUE || contract.returnValue == TRUE_VALUE) {
return new MethodContract(contract.arguments, NOT_NULL_VALUE);
}
return contract;
return ContainerUtil.mapNotNull(contracts, contract -> {
if (contract.returnValue == FALSE_VALUE || contract.returnValue == TRUE_VALUE) {
return new MethodContract(contract.arguments, NOT_NULL_VALUE);
}
return contract;
});
}
@@ -168,42 +150,38 @@ class ContractInferenceInterpreter {
final boolean varArgCall = MethodCallInstruction.isVarArgCall(targetMethod, result.getSubstitutor(), arguments, parameters);
final boolean notNull = NullableNotNullManager.isNotNull(targetMethod);
List<MethodContract> fromDelegate = ContainerUtil.mapNotNull(ControlFlowAnalyzer.getMethodContracts(targetMethod), new NullableFunction<MethodContract, MethodContract>() {
@Nullable
@Override
public MethodContract fun(MethodContract delegateContract) {
ValueConstraint[] answer = myEmptyConstraints;
for (int i = 0; i < delegateContract.arguments.length; i++) {
if (i >= arguments.length) return null;
ValueConstraint argConstraint = delegateContract.arguments[i];
if (argConstraint != ANY_VALUE) {
if (varArgCall && i >= parameters.length - 1) {
if (argConstraint == NULL_VALUE) {
return null;
}
break;
List<MethodContract> fromDelegate = ContainerUtil.mapNotNull(ControlFlowAnalyzer.getMethodContracts(targetMethod), delegateContract -> {
ValueConstraint[] answer = myEmptyConstraints;
for (int i = 0; i < delegateContract.arguments.length; i++) {
if (i >= arguments.length) return null;
ValueConstraint argConstraint = delegateContract.arguments[i];
if (argConstraint != ANY_VALUE) {
if (varArgCall && i >= parameters.length - 1) {
if (argConstraint == NULL_VALUE) {
return null;
}
break;
}
int paramIndex = resolveParameter(arguments[i]);
if (paramIndex < 0) {
if (argConstraint != getLiteralConstraint(arguments[i])) {
return null;
}
int paramIndex = resolveParameter(arguments[i]);
if (paramIndex < 0) {
if (argConstraint != getLiteralConstraint(arguments[i])) {
return null;
}
else {
answer = withConstraint(answer, paramIndex, argConstraint);
if (answer == null) {
return null;
}
}
else {
answer = withConstraint(answer, paramIndex, argConstraint);
if (answer == null) {
return null;
}
}
}
ValueConstraint returnValue = negated ? negateConstraint(delegateContract.returnValue) : delegateContract.returnValue;
if (notNull && returnValue != THROW_EXCEPTION) {
returnValue = NOT_NULL_VALUE;
}
return answer == null ? null : new MethodContract(answer, returnValue);
}
ValueConstraint returnValue = negated ? negateConstraint(delegateContract.returnValue) : delegateContract.returnValue;
if (notNull && returnValue != THROW_EXCEPTION) {
returnValue = NOT_NULL_VALUE;
}
return answer == null ? null : new MethodContract(answer, returnValue);
});
if (notNull) {
return ContainerUtil.concat(fromDelegate, Collections.singletonList(new MethodContract(myEmptyConstraints, NOT_NULL_VALUE)));
@@ -230,8 +208,8 @@ class ContractInferenceInterpreter {
if (expr instanceof PsiConditionalExpression) {
List<MethodContract> conditionResults = visitExpression(states, ((PsiConditionalExpression)expr).getCondition());
return ContainerUtil.concat(
visitExpression(antecedentsOf(filterReturning(conditionResults, TRUE_VALUE)), ((PsiConditionalExpression)expr).getThenExpression()),
visitExpression(antecedentsOf(filterReturning(conditionResults, FALSE_VALUE)), ((PsiConditionalExpression)expr).getElseExpression()));
visitExpression(antecedentsReturning(conditionResults, TRUE_VALUE), ((PsiConditionalExpression)expr).getThenExpression()),
visitExpression(antecedentsReturning(conditionResults, FALSE_VALUE), ((PsiConditionalExpression)expr).getElseExpression()));
}
@@ -255,14 +233,7 @@ class ContractInferenceInterpreter {
if (expr instanceof PsiInstanceOfExpression) {
final int parameter = resolveParameter(((PsiInstanceOfExpression)expr).getOperand());
if (parameter >= 0) {
return ContainerUtil.mapNotNull(states, new Function<ValueConstraint[], MethodContract>() {
@Override
public MethodContract fun(ValueConstraint[] state) {
ValueConstraint paramConstraint = NULL_VALUE;
ValueConstraint returnValue = FALSE_VALUE;
return contractWithConstraint(state, parameter, paramConstraint, returnValue);
}
});
return ContainerUtil.mapNotNull(states, state -> contractWithConstraint(state, parameter, NULL_VALUE, FALSE_VALUE));
}
}
@@ -344,14 +315,8 @@ class ContractInferenceInterpreter {
return myMethod.getParameterList().getParameters()[parameter];
}
private static List<MethodContract> toContracts(List<ValueConstraint[]> states,
final ValueConstraint constraint) {
return ContainerUtil.map(states, new Function<ValueConstraint[], MethodContract>() {
@Override
public MethodContract fun(ValueConstraint[] state) {
return new MethodContract(state, constraint);
}
});
private static List<MethodContract> toContracts(List<ValueConstraint[]> states, ValueConstraint constraint) {
return ContainerUtil.map(states, state -> new MethodContract(state, constraint));
}
private List<MethodContract> visitLogicalOperation(PsiExpression[] operands, boolean conjunction, List<ValueConstraint[]> states) {
@@ -359,29 +324,15 @@ class ContractInferenceInterpreter {
List<MethodContract> finalStates = ContainerUtil.newArrayList();
for (PsiExpression operand : operands) {
List<MethodContract> opResults = visitExpression(states, operand);
finalStates.addAll(filterReturning(opResults, breakValue));
states = antecedentsOf(filterReturning(opResults, negateConstraint(breakValue)));
finalStates.addAll(ContainerUtil.filter(opResults, contract -> contract.returnValue == breakValue));
states = antecedentsReturning(opResults, negateConstraint(breakValue));
}
finalStates.addAll(toContracts(states, negateConstraint(breakValue)));
return finalStates;
}
private static List<ValueConstraint[]> antecedentsOf(List<MethodContract> values) {
return ContainerUtil.map(values, new Function<MethodContract, ValueConstraint[]>() {
@Override
public ValueConstraint[] fun(MethodContract contract) {
return contract.arguments;
}
});
}
private static List<MethodContract> filterReturning(List<MethodContract> values, final ValueConstraint result) {
return ContainerUtil.filter(values, new Condition<MethodContract>() {
@Override
public boolean value(MethodContract contract) {
return contract.returnValue == result;
}
});
private static List<ValueConstraint[]> antecedentsReturning(List<MethodContract> values, ValueConstraint result) {
return ContainerUtil.mapNotNull(values, contract -> contract.returnValue == result ? contract.arguments : null);
}
@NotNull
@@ -396,10 +347,10 @@ class ContractInferenceInterpreter {
PsiStatement thenBranch = ((PsiIfStatement)statement).getThenBranch();
if (thenBranch != null) {
result.addAll(visitStatements(antecedentsOf(filterReturning(conditionResults, TRUE_VALUE)), thenBranch));
result.addAll(visitStatements(antecedentsReturning(conditionResults, TRUE_VALUE), thenBranch));
}
List<ValueConstraint[]> falseStates = antecedentsOf(filterReturning(conditionResults, FALSE_VALUE));
List<ValueConstraint[]> falseStates = antecedentsReturning(conditionResults, FALSE_VALUE);
PsiStatement elseBranch = ((PsiIfStatement)statement).getElseBranch();
if (elseBranch != null) {
result.addAll(visitStatements(falseStates, elseBranch));
@@ -416,7 +367,7 @@ class ContractInferenceInterpreter {
}
else if (statement instanceof PsiAssertStatement) {
List<MethodContract> conditionResults = visitExpression(states, ((PsiAssertStatement)statement).getAssertCondition());
result.addAll(toContracts(antecedentsOf(filterReturning(conditionResults, FALSE_VALUE)), THROW_EXCEPTION));
result.addAll(toContracts(antecedentsReturning(conditionResults, FALSE_VALUE), THROW_EXCEPTION));
}
else if (statement instanceof PsiDeclarationStatement && !mayHaveSideEffects((PsiDeclarationStatement)statement)) {
continue;
@@ -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.
@@ -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
@@ -16,7 +16,6 @@
package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.psi.*;
import com.intellij.psi.util.CachedValueProvider;
@@ -24,7 +23,6 @@ import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -44,19 +42,10 @@ public class NullityInference {
return Nullness.UNKNOWN;
}
return CachedValuesManager.getCachedValue(method, new CachedValueProvider<Nullness>() {
@Nullable
@Override
public Result<Nullness> compute() {
Nullness result = RecursionManager.doPreventingRecursion(method, true, new Computable<Nullness>() {
@Override
public Nullness compute() {
return doInferNullity(method);
}
});
if (result == null) result = Nullness.UNKNOWN;
return Result.create(result, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
return CachedValuesManager.getCachedValue(method, () -> {
Nullness result = RecursionManager.doPreventingRecursion(method, true, () -> doInferNullity(method));
if (result == null) result = Nullness.UNKNOWN;
return CachedValueProvider.Result.create(result, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
}
@@ -15,7 +15,6 @@
*/
package com.intellij.codeInspection.dataFlow;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
@@ -25,7 +24,6 @@ import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -43,18 +41,9 @@ public class PurityInference {
return false;
}
return CachedValuesManager.getCachedValue(method, new CachedValueProvider<Boolean>() {
@Nullable
@Override
public Result<Boolean> compute() {
boolean pure = RecursionManager.doPreventingRecursion(method, true, new Computable<Boolean>() {
@Override
public Boolean compute() {
return doInferPurity(method);
}
}) == Boolean.TRUE;
return Result.create(pure, method);
}
return CachedValuesManager.getCachedValue(method, () -> {
boolean pure = RecursionManager.doPreventingRecursion(method, true, () -> doInferPurity(method)) == Boolean.TRUE;
return CachedValueProvider.Result.create(pure, method);
});
}
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -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;
@@ -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.
@@ -118,7 +118,7 @@ public class InheritorsStatisticalDataSearch {
myAllNotAnonymousInheritors = new HashSet<String>();
}
private int myAnonymousInheritorsCount = 0;
private int myAnonymousInheritorsCount;
private Set<String> getAllNotAnonymousInheritors() {
return myAllNotAnonymousInheritors;
@@ -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.
@@ -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;
@@ -1,5 +1,5 @@
/*
* 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() {
@@ -1,5 +1,5 @@
/*
* 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,
@@ -59,7 +59,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.visibility.VisibilityInspection");
public boolean SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS = true;
public boolean SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES = true;
public boolean SUGGEST_PRIVATE_FOR_INNERS = false;
public boolean SUGGEST_PRIVATE_FOR_INNERS;
private static final String DISPLAY_NAME = InspectionsBundle.message("inspection.visibility.display.name");
@NonNls public static final String SHORT_NAME = "WeakerAccess";
private static final String CAN_BE_PRIVATE = InspectionsBundle.message("inspection.visibility.compose.suggestion", VisibilityUtil.toPresentableText(PsiModifier.PRIVATE));
@@ -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.
@@ -26,13 +26,13 @@ import java.util.LinkedHashSet;
* @author peter
*/
public class JavaClassFindUsagesOptions extends JavaFindUsagesOptions {
public boolean isMethodsUsages = false;
public boolean isFieldsUsages = false;
public boolean isDerivedClasses = false;
public boolean isImplementingClasses = false;
public boolean isDerivedInterfaces = false;
public boolean isMethodsUsages;
public boolean isFieldsUsages;
public boolean isDerivedClasses;
public boolean isImplementingClasses;
public boolean isDerivedInterfaces;
public boolean isCheckDeepInheritance = true;
public boolean isIncludeInherited = false;
public boolean isIncludeInherited;
public JavaClassFindUsagesOptions(@NotNull Project project) {
super(project);
@@ -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.
@@ -27,7 +27,7 @@ import java.util.LinkedHashSet;
* @author peter
*/
public abstract class JavaFindUsagesOptions extends FindUsagesOptions {
public boolean isSkipImportStatements = false;
public boolean isSkipImportStatements;
public JavaFindUsagesOptions(@NotNull Project project) {
super(project);
@@ -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.
@@ -26,11 +26,11 @@ import java.util.LinkedHashSet;
* @author peter
*/
public class JavaMethodFindUsagesOptions extends JavaFindUsagesOptions {
public boolean isOverridingMethods = false;
public boolean isImplementingMethods = false;
public boolean isOverridingMethods;
public boolean isImplementingMethods;
public boolean isCheckDeepInheritance = true;
public boolean isIncludeInherited = false;
public boolean isIncludeOverloadUsages = false;
public boolean isIncludeInherited;
public boolean isIncludeOverloadUsages;
public JavaMethodFindUsagesOptions(@NotNull Project project) {
super(project);
@@ -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.
@@ -26,9 +26,9 @@ import java.util.LinkedHashSet;
* @author peter
*/
public class JavaPackageFindUsagesOptions extends JavaFindUsagesOptions {
public boolean isClassesUsages = false;
public boolean isClassesUsages;
public boolean isIncludeSubpackages = true;
public boolean isSkipPackageStatements = false;
public boolean isSkipPackageStatements;
public JavaPackageFindUsagesOptions(@NotNull Project project) {
super(project);
@@ -1,5 +1,5 @@
/*
* 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.
@@ -48,8 +48,8 @@ public class InputVariables {
private ParametersFolder myFolding;
private boolean myFoldingAvailable;
private Set<PsiField> myUsedInstanceFields = null;
private boolean myPassFields = false;
private Set<PsiField> myUsedInstanceFields;
private boolean myPassFields;
public InputVariables(final List<? extends PsiVariable> inputVariables,
Project project,
@@ -1,5 +1,5 @@
/*
* 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,7 +44,7 @@ public class ParametersFolder {
private final Set<String> myUsedNames = new HashSet<String>();
private final Set<PsiVariable> myDeleted = new HashSet<PsiVariable>();
private boolean myFoldingSelectedByDefault = false;
private boolean myFoldingSelectedByDefault;
public void clear() {
@@ -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.
@@ -46,7 +46,7 @@ public class DuplicatesFinder {
private final InputVariables myParameters;
private final List<? extends PsiVariable> myOutputParameters;
private final List<PsiElement> myPatternAsList;
private boolean myMultipleExitPoints = false;
private boolean myMultipleExitPoints;
@Nullable private final ReturnValue myReturnValue;
public DuplicatesFinder(PsiElement[] pattern,
@@ -1,5 +1,5 @@
/*
* 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.
@@ -51,8 +51,8 @@ public final class Match {
private final Map<PsiVariable, List<PsiElement>> myParameterValues = new HashMap<PsiVariable, List<PsiElement>>();
private final Map<PsiVariable, ArrayList<PsiElement>> myParameterOccurrences = new HashMap<PsiVariable, ArrayList<PsiElement>>();
private final Map<PsiElement, PsiElement> myDeclarationCorrespondence = new HashMap<PsiElement, PsiElement>();
private ReturnValue myReturnValue = null;
private Ref<PsiExpression> myInstanceExpression = null;
private ReturnValue myReturnValue;
private Ref<PsiExpression> myInstanceExpression;
final Map<PsiVariable, PsiType> myChangedParams = new HashMap<PsiVariable, PsiType>();
private final boolean myIgnoreParameterTypes;
@@ -21,24 +21,24 @@ package org.jetbrains.java.generate.config;
*/
public class Config {
public boolean useFullyQualifiedName = false;
public boolean useFullyQualifiedName;
public InsertWhere insertNewMethodOption = InsertWhere.AT_CARET;
public DuplicationPolicy whenDuplicatesOption = DuplicationPolicy.ASK;
public boolean filterConstantField = true;
public boolean filterEnumField = false;
public boolean filterTransientModifier = false;
public boolean filterEnumField;
public boolean filterTransientModifier;
public boolean filterStaticModifier = true;
public String filterFieldName = null;
public String filterMethodName = null;
public String filterMethodType = null;
public String filterFieldType = null;
public String filterFieldName;
public String filterMethodName;
public String filterMethodType;
public String filterFieldType;
public boolean filterLoggers = true;
public boolean addImplementSerializable = false;
public boolean enableMethods = false;
public boolean addImplementSerializable;
public boolean enableMethods;
public boolean jumpToMethod = true; // jump cursor to toString method
public int sortElements = 0; // 0 = none, 1 = asc, 2 = desc
public int sortElements; // 0 = none, 1 = asc, 2 = desc
private FilterPattern myPattern = null;
private FilterPattern myPattern;
public boolean isUseFullyQualifiedName() {
return useFullyQualifiedName;
@@ -51,10 +51,10 @@ public class FilterPattern {
private boolean transientModifier;
private boolean enumField;
private boolean loggers;
private Pattern methodNamePattern = null;
private Pattern methodTypePattern = null;
private Pattern fieldNamePattern = null;
private Pattern fieldTypePattern = null;
private Pattern methodNamePattern;
private Pattern methodTypePattern;
private Pattern fieldNamePattern;
private Pattern fieldTypePattern;
public boolean fieldMatches(PsiField field) {
if (isConstantField() && PsiAdapter.isConstantField(field)) {
@@ -53,13 +53,13 @@ public class ClassHasNoToStringMethodInspection extends AbstractToStringInspecti
/** User options for excluded deprecated classes */
public boolean excludeDeprecated = true; // must be public for JDOMSerialization
/** User options for excluded enum classes */
public boolean excludeEnum = false; // must be public for JDOMSerialization
public boolean excludeEnum; // must be public for JDOMSerialization
/** User options for excluded abstract classes */
public boolean excludeAbstract = false; // must be public for JDOMSerialization
public boolean excludeAbstract; // must be public for JDOMSerialization
public boolean excludeTestCode = false;
public boolean excludeTestCode;
public boolean excludeInnerClasses = false;
public boolean excludeInnerClasses;
public ClassHasNoToStringMethodInspection() {
try {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -34,7 +34,7 @@ import java.util.TreeMap;
public class HyperlinksToClassesOption extends PrintOption {
private JCheckBox myCbGenerateHyperlinksToClasses;
private boolean isGenerateHyperlinksToClasses = false;
private boolean isGenerateHyperlinksToClasses;
@Nullable
public TreeMap<Integer, PsiReference> collectReferences(PsiFile psiFile, Map<PsiFile, PsiFile> filesMap) {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -154,7 +154,7 @@ public class AllClassesGetter {
int limit = Registry.intValue("ide.completion.variant.limit");
Processor<PsiClass> processor = new Processor<PsiClass>() {
int count = 0;
int count;
final Set<String> qNames = new THashSet<String>();
final boolean pkgContext = JavaCompletionUtil.inSomePackage(context);
final String packagePrefix = getPackagePrefix(context, parameters.getOffset());
@@ -1,3 +1,18 @@
/*
* 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.
* 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 com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
@@ -16,7 +31,7 @@ public class MemberLookupHelper {
private final PsiMember myMember;
private final boolean myMergedOverloads;
@Nullable private final PsiClass myContainingClass;
private boolean myShouldImport = false;
private boolean myShouldImport;
public MemberLookupHelper(List<PsiMethod> overloads, PsiClass containingClass, boolean shouldImport) {
this(overloads.get(0), containingClass, shouldImport, 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.
@@ -30,7 +30,10 @@ import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* @author peter
@@ -40,7 +43,7 @@ public abstract class StaticMemberProcessor {
private final PsiElement myPosition;
private final Project myProject;
private final PsiResolveHelper myResolveHelper;
private boolean myHintShown = false;
private boolean myHintShown;
private final boolean myPackagedContext;
public StaticMemberProcessor(final PsiElement position) {
@@ -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.
@@ -50,8 +50,8 @@ import java.util.Set;
public class JavaCompletionProcessor extends BaseScopeProcessor implements ElementClassHint {
private final boolean myInJavaDoc;
private boolean myStatic = false;
private PsiElement myDeclarationHolder = null;
private boolean myStatic;
private PsiElement myDeclarationHolder;
private final Map<CompletionElement, CompletionElement> myResults = new LinkedHashMap<>();
private final Set<CompletionElement> mySecondRateResults = ContainerUtil.newIdentityTroveSet();
private final Set<String> myShadowedNames = ContainerUtil.newHashSet();
@@ -60,10 +60,10 @@ public class JavaCompletionProcessor extends BaseScopeProcessor implements Eleme
private final PsiElement myElement;
private final PsiElement myScope;
private final ElementFilter myFilter;
private boolean myMembersFlag = false;
private boolean myQualified = false;
private PsiType myQualifierType = null;
private PsiClass myQualifierClass = null;
private boolean myMembersFlag;
private boolean myQualified;
private PsiType myQualifierType;
private PsiClass myQualifierClass;
private final Condition<String> myMatcher;
private final Options myOptions;
private final boolean myAllowStaticWithInstanceQualifier;
@@ -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.
@@ -27,7 +27,6 @@ import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.psi.*;
import com.intellij.ui.popup.list.ListPopupImpl;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
@@ -42,7 +41,7 @@ public class AddMethodQualifierFix implements IntentionAction {
private static final boolean UNIT_TEST_MODE = ApplicationManager.getApplication().isUnitTestMode();
private final SmartPsiElementPointer<PsiMethodCallExpression> myMethodCall;
private List<PsiVariable> myCandidates = null;
private List<PsiVariable> myCandidates;
public AddMethodQualifierFix(final PsiMethodCallExpression methodCallExpression) {
myMethodCall = SmartPointerManager.getInstance(methodCallExpression.getProject()).createSmartPsiElementPointer(methodCallExpression);
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.daemon.QuickFixBundle;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,13 +14,6 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 13, 2002
* Time: 3:26:50 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.CodeInsightUtil;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,13 +14,6 @@
* limitations under the License.
*/
/**
* Created by IntelliJ IDEA.
* User: cdr
* Date: Nov 19, 2002
* Time: 12:03:39 PM
* To change this template use Options | File Templates.
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.FileModificationService;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.FileModificationService;
@@ -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.
@@ -102,7 +102,7 @@ public class RenameWrongRefFix implements IntentionAction {
class MyScopeProcessor extends BaseScopeProcessor {
ArrayList<PsiElement> myResult = new ArrayList<PsiElement>();
boolean myFilterMethods;
boolean myFilterStatics = false;
boolean myFilterStatics;
MyScopeProcessor(PsiReferenceExpression refExpression) {
myFilterMethods = refExpression.getParent() instanceof PsiMethodCallExpression;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -39,7 +39,7 @@ import org.jetbrains.annotations.NotNull;
public class SurroundWithTryCatchFix implements IntentionAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.quickfix.SurroundWithTryCatchFix");
private PsiElement myStatement = null;
private PsiElement myStatement;
public SurroundWithTryCatchFix(@NotNull PsiElement element) {
final PsiFunctionalExpression functionalExpression = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, false, PsiStatement.class);
@@ -30,8 +30,8 @@ class SwitchStatementBranch {
new ArrayList<PsiElement>(5);
private final List<PsiElement> m_pendingWhiteSpace =
new ArrayList<PsiElement>(2);
private boolean m_default = false;
private boolean m_hasStatements = false;
private boolean m_default;
private boolean m_hasStatements;
public void addCaseValue(String labelString) {
m_caseValues.add(labelString);
@@ -45,7 +45,7 @@ import org.jetbrains.annotations.TestOnly;
import java.util.List;
public class AutoFormatTypedHandler extends TypedActionHandlerBase {
private static boolean myIsEnabledInTests = false;
private static boolean myIsEnabledInTests;
private static char[] NO_SPACE_AFTER = {
'+', '-', '*', '/', '%', '&', '^', '|', '<', '>', '!', '=', ' '
@@ -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.
@@ -38,7 +38,7 @@ import java.util.List;
class DeclarationMover extends LineMover {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.actions.moveUpDown.DeclarationMover");
private PsiEnumConstant myEnumToInsertSemicolonAfter;
private boolean moveEnumConstant = false;
private boolean moveEnumConstant;
@Override
public void beforeMove(@NotNull final Editor editor, @NotNull final MoveInfo info, final boolean down) {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -46,7 +46,7 @@ import java.util.*;
*/
public class GenerateDelegateHandler implements LanguageCodeInsightActionHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.GenerateDelegateHandler");
private boolean myToCopyJavaDoc = false;
private boolean myToCopyJavaDoc;
@Override
public boolean isValidFor(Editor editor, PsiFile file) {
@@ -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.
@@ -37,9 +37,9 @@ import java.util.List;
*/
public class GenerateEqualsHandler extends GenerateMembersHandlerBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.GenerateEqualsHandler");
private PsiField[] myEqualsFields = null;
private PsiField[] myHashCodeFields = null;
private PsiField[] myNonNullFields = null;
private PsiField[] myEqualsFields;
private PsiField[] myHashCodeFields;
private PsiField[] myNonNullFields;
private static final PsiElementClassMember[] DUMMY_RESULT = new PsiElementClassMember[1]; //cannot return empty array, but this result won't be used anyway
public GenerateEqualsHandler() {
@@ -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.
@@ -53,7 +53,7 @@ public abstract class GenerateMembersHandlerBase implements CodeInsightActionHan
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.GenerateMembersHandlerBase");
private final String myChooserTitle;
protected boolean myToCopyJavaDoc = false;
protected boolean myToCopyJavaDoc;
public GenerateMembersHandlerBase(String chooserTitle) {
myChooserTitle = chooserTitle;
@@ -28,10 +28,8 @@ import com.intellij.ide.fileTemplates.FileTemplateManager;
import com.intellij.ide.fileTemplates.FileTemplateUtil;
import com.intellij.ide.fileTemplates.JavaTemplateUtil;
import com.intellij.ide.util.MemberChooser;
import com.intellij.idea.ActionsBundle;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.Result;
@@ -52,6 +50,7 @@ import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
@@ -184,7 +183,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
boolean toCopyJavaDoc,
boolean insertOverrideIfPossible,
PsiMethod result) {
PsiUtil.setModifierProperty(result, PsiModifier.ABSTRACT, aClass.isInterface());
PsiUtil.setModifierProperty(result, PsiModifier.ABSTRACT, aClass.isInterface() && method.hasModifierProperty(PsiModifier.ABSTRACT));
PsiUtil.setModifierProperty(result, PsiModifier.NATIVE, false);
if (!toCopyJavaDoc){
@@ -368,7 +367,7 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
final PsiClass targetClass,
final FileTemplate template) throws IncorrectOperationException {
if (targetClass.isInterface()) {
if (isImplementInterfaceInJava8Interface(targetClass)) {
if (isImplementInterfaceInJava8Interface(targetClass) || originalMethod.hasModifierProperty(PsiModifier.DEFAULT)) {
PsiUtil.setModifierProperty(result, PsiModifier.DEFAULT, true);
}
else {
@@ -424,10 +423,8 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
if (!PsiUtil.isLanguageLevel8OrHigher(targetClass)){
return false;
}
final String implementMethodsName = ActionsBundle.message("action.ImplementMethods.text");
final Presentation presentation = new Presentation();
presentation.setText(implementMethodsName);
return presentation.getText().equals(CommandProcessor.getInstance().getCurrentCommandName());
String commandName = CommandProcessor.getInstance().getCurrentCommandName();
return commandName != null && StringUtil.containsIgnoreCase(commandName, "implement");
}
public static void chooseAndOverrideMethods(Project project, Editor editor, PsiClass aClass){
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,19 +14,16 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.codeInsight.generation.actions;
import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.CodeInsightUtilCore;
import com.intellij.codeInsight.generation.OverrideImplementUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -33,7 +33,7 @@ import java.util.Collections;
* @author ven
*/
public class JavaExpressionSurroundDescriptor implements SurroundDescriptor {
private Surrounder[] mySurrounders = null;
private Surrounder[] mySurrounders;
private static final Surrounder[] SURROUNDERS = {
new JavaWithParenthesesSurrounder(),
@@ -1,5 +1,5 @@
/*
* 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.
@@ -32,7 +32,7 @@ import java.util.Collections;
import java.util.List;
public class JavaWithTryCatchSurrounder extends JavaStatementsSurrounder {
protected boolean myGenerateFinally = false;
protected boolean myGenerateFinally;
@Override
public String getTemplateDescription() {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -40,7 +40,7 @@ public class HighlightImportedElementsHandler extends HighlightUsagesHandlerBase
private final PsiElement myTarget;
private final PsiImportStatementBase myImportStatement;
private final boolean myImportStatic;
private Map<PsiMember,List<PsiElement>> myClassReferenceListMap = null;
private Map<PsiMember,List<PsiElement>> myClassReferenceListMap;
public HighlightImportedElementsHandler(Editor editor, PsiFile file, PsiElement target, PsiImportStatementBase importStatement) {
super(editor, file);
@@ -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.
@@ -146,7 +146,7 @@ public class AddOnDemandStaticImportAction extends BaseElementAtCaretIntentionAc
final TIntArrayList expressionToDequalifyOffsets = new TIntArrayList();
copy.accept(new JavaRecursiveElementWalkingVisitor() {
int delta = 0;
int delta;
@Override
public void visitReferenceElement(PsiJavaCodeReferenceElement expression) {
if (isParameterizedReference(expression)) return;
@@ -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.
@@ -44,7 +44,7 @@ import java.util.List;
public class DeannotateIntentionAction implements IntentionAction, LowPriorityAction {
private static final Logger LOG = Logger.getInstance("#" + DeannotateIntentionAction.class.getName());
private String myAnnotationName = null;
private String myAnnotationName;
@Override
@NotNull
@@ -33,6 +33,7 @@ import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.PsiElementProcessorAdapter;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -120,7 +121,7 @@ public class ImplementAbstractMethodAction extends BaseIntentionAction {
public boolean execute(@NotNull PsiElement element) {
if (element instanceof PsiClass) {
PsiClass aClass = (PsiClass) element;
if (aClass.isInterface()) return true;
if (aClass.isInterface() && !PsiUtil.isLanguageLevel8OrHigher(aClass)) return true;
final PsiMethod existingImplementation = findExistingImplementation(aClass, myMethod);
if (existingImplementation != null && !existingImplementation.hasModifierProperty(PsiModifier.ABSTRACT)) {
myHasExistingImplementations = true;
@@ -41,6 +41,7 @@ import com.intellij.openapi.util.Computable;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.MethodSignatureUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.ui.components.JBList;
@@ -181,7 +182,7 @@ public class ImplementAbstractMethodHandler {
private PsiClass[] getClassImplementations(final PsiClass psiClass) {
ArrayList<PsiClass> list = new ArrayList<PsiClass>();
for (PsiClass inheritor : ClassInheritorsSearch.search(psiClass)) {
if (!inheritor.isInterface()) {
if (!inheritor.isInterface() || PsiUtil.isLanguageLevel8OrHigher(inheritor)) {
final PsiSubstitutor classSubstitutor = TypeConversionUtil.getClassSubstitutor(psiClass, inheritor, PsiSubstitutor.EMPTY);
PsiMethod method = classSubstitutor != null ? MethodSignatureUtil.findMethodBySignature(inheritor, myMethod.getSignature(classSubstitutor), true)
: inheritor.findMethodBySignature(myMethod, true);;
@@ -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.
@@ -116,7 +116,7 @@ public class ReplaceCastWithVariableAction extends PsiElementBaseIntentionAction
scope.accept(
new JavaRecursiveElementWalkingVisitor() {
private boolean inScope = false;
private boolean inScope;
@Override
public void visitElement(PsiElement element) {
@@ -1,5 +1,5 @@
/*
* 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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.codeInsight.intention.impl;
import com.intellij.codeInsight.FileModificationService;
@@ -29,7 +29,6 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vcs.FileStatus;
@@ -75,8 +74,6 @@ import java.util.*;
public class UnusedDeclarationPresentation extends DefaultInspectionToolPresentation {
private final Map<String, Set<RefEntity>> myPackageContents = Collections.synchronizedMap(new HashMap<String, Set<RefEntity>>());
private Map<String, Set<RefEntity>> myOldPackageContents = null;
private final Set<RefEntity> myIgnoreElements = new HashSet<RefEntity>();
private WeakUnreferencedFilter myFilter;
private DeadHTMLComposer myComposer;
@@ -376,27 +373,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@Override
public boolean hasReportedProblems() {
final GlobalInspectionContextImpl context = getContext();
if (!isDisposed() && context.getUIOptions().SHOW_ONLY_DIFF){
return containsOnlyDiff(myPackageContents) ||
myOldPackageContents != null && containsOnlyDiff(myOldPackageContents);
}
if (!myPackageContents.isEmpty()) return true;
return isOldProblemsIncluded() && !myOldPackageContents.isEmpty();
}
private boolean containsOnlyDiff(@NotNull Map<String, Set<RefEntity>> packageContents) {
for (String packageName : packageContents.keySet()) {
final Set<RefEntity> refElements = packageContents.get(packageName);
if (refElements != null){
for (RefEntity refElement : refElements) {
if (getElementStatus(refElement) != FileStatus.NOT_CHANGED){
return true;
}
}
}
}
return false;
return !myPackageContents.isEmpty();
}
@NotNull
@@ -405,11 +382,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
return myPackageContents;
}
@Override
public Map<String, Set<RefEntity>> getOldContent() {
return myOldPackageContents;
}
@Override
public void ignoreCurrentElement(RefEntity refEntity) {
if (refEntity == null) return;
@@ -424,7 +396,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@Override
public void cleanup() {
super.cleanup();
myOldPackageContents = null;
myPackageContents.clear();
myIgnoreElements.clear();
}
@@ -433,7 +404,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@Override
public void finalCleanup() {
super.finalCleanup();
myOldPackageContents = null;
}
@Override
@@ -450,15 +420,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@NotNull
@Override
public FileStatus getElementStatus(final RefEntity element) {
final GlobalInspectionContextImpl context = getContext();
if (!isDisposed() && context.getUIOptions().SHOW_DIFF_WITH_PREVIOUS_RUN){
if (myOldPackageContents != null){
final boolean old = RefUtil.contains(element, collectRefElements(myOldPackageContents));
final boolean current = RefUtil.contains(element, collectRefElements(myPackageContents));
return calcStatus(old, current);
}
return FileStatus.ADDED;
}
return FileStatus.NOT_CHANGED;
}
@@ -468,14 +429,6 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
return myIgnoreElements;
}
private static Set<RefEntity> collectRefElements(Map<String, Set<RefEntity>> packageContents) {
Set<RefEntity> allAvailable = new HashSet<RefEntity>();
for (Set<RefEntity> elements : packageContents.values()) {
allAvailable.addAll(elements);
}
return allAvailable;
}
@Override
@Nullable
public IntentionAction findQuickFixes(@NotNull final CommonProblemDescriptor descriptor, final String hint) {
@@ -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.
@@ -197,7 +197,7 @@ public class InferNullityAnnotationsAction extends BaseAnalysisAction {
@Override
public void run() {
scope.accept(new PsiElementVisitor() {
int myFileCount = 0;
int myFileCount;
@Override
public void visitFile(final PsiFile file) {
@@ -422,10 +422,12 @@ public class MagicConstantInspection extends BaseJavaLocalInspectionTool {
private static AllowedValues parseBeanInfo(@NotNull PsiModifierListOwner owner, @NotNull PsiManager manager) {
PsiFile containingFile = owner.getContainingFile();
GlobalSearchScope sourceFile = GlobalSearchScope.fileScope((PsiFile)containingFile.getNavigationElement());
if (FileBasedIndex.getInstance().getContainingFiles(IdIndex.NAME, new IdIndexEntry("beaninfo", true), sourceFile).isEmpty()) {
// optimisation: do not parse library sources if there are no "beaninfo" text in the file
return null;
if (containingFile != null) {
GlobalSearchScope sourceFile = GlobalSearchScope.fileScope((PsiFile)containingFile.getNavigationElement());
if (FileBasedIndex.getInstance().getContainingFiles(IdIndex.NAME, new IdIndexEntry("beaninfo", true), sourceFile).isEmpty()) {
// optimisation: do not parse library sources if there are no "beaninfo" text in the file
return null;
}
}
PsiMethod method = null;
if (owner instanceof PsiParameter) {
@@ -1,5 +1,5 @@
/*
* 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,7 +44,7 @@ import java.util.List;
public class UnusedReturnValue extends GlobalJavaBatchInspectionTool{
private MakeVoidQuickFix myQuickFix;
public boolean IGNORE_BUILDER_PATTERN = false;
public boolean IGNORE_BUILDER_PATTERN;
@Override
@Nullable
@@ -1,5 +1,5 @@
/*
* 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.
@@ -46,7 +46,7 @@ public class CyclicDependenciesBuilder{
private final Map<PsiPackage, Map<PsiPackage, Set<PsiFile>>> myBackwardFilesInDependentPackages = new HashMap<PsiPackage, Map<PsiPackage, Set<PsiFile>>>();
private final Map<PsiPackage, Set<PsiPackage>> myPackageDependencies = new HashMap<PsiPackage, Set<PsiPackage>>();
private HashMap<PsiPackage, Set<List<PsiPackage>>> myCyclicDependencies = new HashMap<PsiPackage, Set<List<PsiPackage>>>();
private int myFileCount = 0;
private int myFileCount;
private final ForwardDependenciesBuilder myForwardBuilder;
private String myRootNodeNameInUsageView;
@@ -1,5 +1,5 @@
/*
* 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.
@@ -33,7 +33,7 @@ public class CyclicDependenciesUtil{
final TIntArrayList sccs = dfstBuilder.getSCCs();
final List<Chunk<Node>> chunks = new ArrayList<Chunk<Node>>();
sccs.forEach(new TIntProcedure() {
int myTNumber = 0;
int myTNumber;
public boolean execute(int size) {
Set<Node> packs = new LinkedHashSet<Node>();
for (int j = 0; j < size; j++) {
@@ -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.
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.ide.projectView.impl;
import com.intellij.history.LocalHistory;
@@ -28,7 +25,10 @@ import com.intellij.ide.SelectInTarget;
import com.intellij.ide.impl.PackagesPaneSelectInTarget;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.projectView.impl.nodes.*;
import com.intellij.ide.projectView.impl.nodes.PackageElement;
import com.intellij.ide.projectView.impl.nodes.PackageElementNode;
import com.intellij.ide.projectView.impl.nodes.PackageUtil;
import com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode;
import com.intellij.ide.util.DeleteHandler;
import com.intellij.ide.util.treeView.AbstractTreeBuilder;
import com.intellij.ide.util.treeView.AbstractTreeNode;
@@ -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.
@@ -45,7 +45,7 @@ public class TreeViewUtil {
final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap();
map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
if (map == newMap) {
((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
PsiManagerEx.getInstanceEx(project).registerRunnableToRunOnChange(new Runnable() {
@Override
public void run() {
newMap.clear();

Some files were not shown because too many files have changed in this diff Show More