diff --git a/.idea/libraries/sqlite.xml b/.idea/libraries/sqlite.xml
new file mode 100644
index 000000000000..54ed24ede12e
--- /dev/null
+++ b/.idea/libraries/sqlite.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/conf/nsis/strings.nsi b/build/conf/nsis/strings.nsi
index 2efe6fe71ad6..e9a9f30140aa 100644
--- a/build/conf/nsis/strings.nsi
+++ b/build/conf/nsis/strings.nsi
@@ -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
diff --git a/build/conf/nsis/stringsCE.nsi b/build/conf/nsis/stringsCE.nsi
index b3239d1b30c5..98fe712d90bb 100644
--- a/build/conf/nsis/stringsCE.nsi
+++ b/build/conf/nsis/stringsCE.nsi
@@ -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
diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant
index 552032ffd66c..e7d1bd41f2a3 100644
--- a/build/scripts/libLicenses.gant
+++ b/build/scripts/libLicenses.gant
@@ -310,6 +310,7 @@ libraryLicense(name: "Velocity", version: "1.7", license: "Apache 2.0", url: "ht
libraryLicense(name: "winp", version: "1.23", license: "MIT", url: "http://java.net/projects/winp", licenseUrl: "http://opensource.org/licenses/mit-license.php")
libraryLicense(name: "Xalan", libraryName:"Xalan-2.7.1", version: "2.7.1", license: "Apache 2.0", url: "http://xml.apache.org/xalan-j/", licenseUrl: "http://xml.apache.org/xalan-j/")
libraryLicense(name: "Xerces", version: "2.11", license: "Apache 2.0", url: "http://xerces.apache.org/xerces2-j/", licenseUrl: "http://xerces.apache.org/xerces2-j/")
+libraryLicense(name: "Xerial SQLite JDBC", libraryName: "sqlite", version: "3.6.20.1", license: "Apache 2.0", url: "https://github.com/xerial/sqlite-jdbc")
libraryLicense(name: "XML-RPC", libraryName: "XmlRPC", version: "2.0", license: "Apache 2.0", url: "http://ws.apache.org/xmlrpc/xmlrpc2/", licenseUrl: "http://ws.apache.org/xmlrpc/xmlrpc2/license.html")
libraryLicense(name: "XML Commons (xml-apis.jar, resolver.jar)", version: "", license: "Apache 2.0, W3C Software License , public domain", url: "http://xml.apache.org/commons/", licenseUrl: "http://xml.apache.org/commons/licenses.html")
libraryLicense(name: "XMLBeans", libraryName: "XmlBeans", version: "2.3.0", license: "Apache 2.0", url: "http://xmlbeans.apache.org/", licenseUrl: "http://svn.jetbrains.org/idea/Trunk/bundled/WebServices/resources/lib/xmlbeans-2.3.0/xmlbeans.LICENSE")
diff --git a/build/scripts/unpackJdks.gant b/build/scripts/unpackJdks.gant
index 3b71c7e0acda..aace7a167f8e 100644
--- a/build/scripts/unpackJdks.gant
+++ b/build/scripts/unpackJdks.gant
@@ -42,44 +42,48 @@ def unpackJdks() {
return
}
- unpackJdk(osDir, jdkDir, "1.6")
- unpackJdk(osDir, jdkDir, "1.8")
+ 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("jdk$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" : "x32"
- jdkFiles = jdkFiles.findAll { it.name.endsWith("_${arch}.zip") }
+ 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: 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, majorVersion)
+ def destDir = new File(jdkDir, targetDirectoryName)
FileUtil.delete(destDir)
- if (jdkFile.name.endsWith(".zip")) {
- ant.unzip(src: jdkFile, dest: destDir)
- }
- else if (jdkFile.name.endsWith(".tar")) {
- projectBuilder.info("Extracting $jdkFile to $destDir")
- ant.mkdir(dir: destDir)
- //'tar' and 'mv' commands are used instead of Ant tasks to ensure that executable flag and symlink will be preserved
- ant.exec(executable: "tar", dir: jdkFile.getParent()) {
- arg(value: "-xf")
- arg(value: jdkFile.name)
- arg(value: "--directory")
- arg(value: destDir)
+ projectBuilder.info("Extracting $jdkFile to $destDir")
+ ant.mkdir(dir: destDir)
+
+ if (jdkFile.name.endsWith(".tar.gz")) {
+ if (SystemInfo.isWindows) {
+ ant.untar(src: jdkFile, dest: destDir, compression: 'gzip')
}
- if (SystemInfo.isMac && !jdkFile.name.contains("apple")) {
- new File(destDir, "jre/jdk/Contents").listFiles().each { file ->
- ant.exec(executable: "mv", dir: destDir) {
- arg(value: file.absolutePath)
- arg(value: destDir)
+ else {
+ //'tar' and 'mv' commands are used instead of Ant tasks to ensure that executable flag and symlink will be preserved
+ ant.exec(executable: "tar", dir: jdkFile.getParent()) {
+ arg(value: "-xf")
+ arg(value: jdkFile.name)
+ 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)
+ }
}
}
}
@@ -87,5 +91,4 @@ private void unpackJdk(File osDir, File jdkDir, String majorVersion) {
else {
projectBuilder.error("Cannot unpack JDK: unknown extension of file '${jdkFile.name}'")
}
-}
-
+}
\ No newline at end of file
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index bbf5afe448eb..0f2731489601 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -75,8 +75,8 @@ binding.setVariable("isEap", {
return "true" == p("component.version.eap")
})
-binding.setVariable("mem32", "-server -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=240m")
-binding.setVariable("mem64", "-Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=240m")
+binding.setVariable("mem32", "-server -Xms128m -Xmx512m -XX:ReservedCodeCacheSize=240m")
+binding.setVariable("mem64", "-Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m")
binding.setVariable("common_vmoptions", "-XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea " +
"-Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true " +
"-XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow")
@@ -428,7 +428,6 @@ binding.setVariable("platformImplementationModules", [
"vcs-impl",
"vcs-log-graph",
"vcs-log-impl",
- "vcs-tests",
"xdebugger-impl",
"xml-analysis-impl",
"xml-psi-impl",
@@ -885,7 +884,7 @@ binding.setVariable("bundledJDK64s"){
private bundledJDK(boolean win64) {
requireProperty("artifact.linux.no.jdk", "true")
requireProperty("artifact.mac.no.jdk", "true")
- requireProperty("jdk.oracle.win", "jdk1.8")
+ requireProperty("jdk.oracle.win", "jdk8u")
requireProperty("jdk.win", "openjdk.1.8")
requireProperty("jdk.mac", "openjdk.1.8")
requireProperty("jdk.linux", "openjdk.1.8")
@@ -893,19 +892,18 @@ private bundledJDK(boolean win64) {
if (new File("${home}/build/jdk").exists()) {
def jdkDir = new File("${home}/build/jdk/win")
if (p("jdk.oracle.win") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) {
- setProperty("winJDK", getPathToBundledJDK(jdkDir, p("jdk.oracle.win"), (win64 ? "x64.zip": "x32.zip")))
+ setProperty("winJDK", getPathToBundledJDK(jdkDir, p("jdk.oracle.win"), (win64 ? "x64.tar.gz": "x86.tar.gz")))
extractRedistJre(winJDK, "${paths.sandbox}/jdk.oracle.win/jre")
}
- jdkDir = new File("${home}/build/jdk/win/custom")
if (p("jdk.win") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) {
setProperty("winCustomJDKx32", getPathToBundledJDK(jdkDir, p("jdk.win"), (win64 ? "x64.tar.gz": "x32.tar.gz")))
extractRedistJre(winCustomJDKx32, "${paths.sandbox}/jdk.win")
}
- jdkDir = new File("${home}/build/jdk/mac/custom")
+ jdkDir = new File("${home}/build/jdk/mac")
if (p("jdk.mac") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) {
setProperty("macCustomJDK", getPathToBundledJDK(jdkDir, p("jdk.mac"), ".tar.gz"))
}
- jdkDir = new File("${home}/build/jdk/linux/custom")
+ jdkDir = new File("${home}/build/jdk/linux")
if (p("jdk.linux") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) {
setProperty("linuxJDK", getPathToBundledJDK(jdkDir, p("jdk.linux"), ".tar.gz"))
extractRedistJre(linuxJDK, "${paths.sandbox}/jdk.linux")
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
index 7fa8850faee9..4d8bd26f32ee 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/**
- * created at Jan 3, 2002
- * @author Jeka
- */
package com.intellij.compiler;
import com.intellij.CommonBundle;
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index 95c190743443..deec5c2f92f5 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
@@ -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;
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/IgnoredFileFilter.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/IgnoredFileFilter.java
index 5ad3f5a52c13..1522870cec67 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/IgnoredFileFilter.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/IgnoredFileFilter.java
@@ -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;
diff --git a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
index 779df52e49e3..5120843b4e8b 100644
--- a/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
+++ b/java/compiler/impl/src/com/intellij/openapi/projectRoots/impl/MockJdkWrapper.java
@@ -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;
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java b/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
index cd3092fdb35f..9b4cca6aba01 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
@@ -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;
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludeEntryDescription.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludeEntryDescription.java
index b752e8e84dae..b52329c878e3 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludeEntryDescription.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/options/ExcludeEntryDescription.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java
index 25d95ed86292..da6c5fbe9553 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/ExportThreadsAction.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.java
index 1d9b0e2db551..df157425e2bb 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/ThreadDumpAction.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleMethodBreakpointAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleMethodBreakpointAction.java
index 7474f5a42b21..43836ac9549c 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleMethodBreakpointAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleMethodBreakpointAction.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ArrayInitializerEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ArrayInitializerEvaluator.java
index 0fe3395bae7e..786c64c4fa8d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ArrayInitializerEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ArrayInitializerEvaluator.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java
index 6262165fc07d..5b7a731ca116 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewClassInstanceEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewClassInstanceEvaluator.java
index dd699cd7f11d..c3d501096842 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewClassInstanceEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewClassInstanceEvaluator.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java b/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
index 9f82d74a37dd..d6d86c12d32b 100644
--- a/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
+++ b/java/debugger/impl/src/com/intellij/debugger/jdi/Bytecodes.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
index 0b3adea0fb82..7b6968358269 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
@@ -225,9 +225,9 @@ class CompoundRendererConfigurable extends JPanel {
final MyTableModel tableModel = new MyTableModel();
myTable = new JBTable(tableModel);
myListChildrenEditor = new XDebuggerExpressionEditor(myProject, editorsProvider, "NamedChildrenConfigurable", null, XExpressionImpl.EMPTY_EXPRESSION, false, false, false);
+ JComponent editorComponent = myListChildrenEditor.getComponent();
- final TableColumn exprColumn = myTable.getColumnModel().getColumn(EXPRESSION_TABLE_COLUMN);
- exprColumn.setCellEditor(new AbstractTableCellEditor() {
+ AbstractTableCellEditor editor = new AbstractTableCellEditor() {
@Override
public Object getCellEditorValue() {
return TextWithImportsImpl.fromXExpression(myListChildrenEditor.getExpression());
@@ -236,9 +236,16 @@ class CompoundRendererConfigurable extends JPanel {
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
myListChildrenEditor.setExpression(TextWithImportsImpl.toXExpression((TextWithImports)value));
- return myListChildrenEditor.getComponent();
+ return editorComponent;
}
- });
+ };
+ editorComponent.registerKeyboardAction(e -> editor.stopCellEditing(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ editorComponent.registerKeyboardAction(e -> editor.cancelCellEditing(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
+ JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+ TableColumn exprColumn = myTable.getColumnModel().getColumn(EXPRESSION_TABLE_COLUMN);
+ exprColumn.setCellEditor(editor);
exprColumn.setCellRenderer(new DefaultTableCellRenderer() {
@NotNull
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpointPropertiesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpointPropertiesPanel.java
index 41f5417799b6..b81d81c688fe 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpointPropertiesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpointPropertiesPanel.java
@@ -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;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
index 4e25cf4ac7b1..349396284cea 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/**
- * class FilteredRequestorImpl
- * @author Jeka
- */
package com.intellij.debugger.ui.breakpoints;
import com.intellij.debugger.InstanceFilter;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpointPropertiesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpointPropertiesPanel.java
index c9026d152e99..289d9d20a94e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpointPropertiesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpointPropertiesPanel.java
@@ -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;
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourceRootFinder.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourceRootFinder.java
index c0a340ebe0ea..c1bbd5adc9dc 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourceRootFinder.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourceRootFinder.java
@@ -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
*/
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CastMethodArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CastMethodArgumentFix.java
index 0bdc0a5f1c03..2e6971a3ea9c 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CastMethodArgumentFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CastMethodArgumentFix.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConstructorParametersFixer.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConstructorParametersFixer.java
index 28acb28257a7..327c54e59180 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConstructorParametersFixer.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConstructorParametersFixer.java
@@ -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 {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java
index 0a3048f23273..6219d0e12fe3 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
index c5bba7888154..0375eb834407 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisOrSuperArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisOrSuperArgumentFix.java
index 2ea59ccadb91..9f3cae83b5e2 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisOrSuperArgumentFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisOrSuperArgumentFix.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java
index 96d90b24c256..914cc34cfc4d 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SimplifyBooleanExpressionFix.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/VariableArrayTypeFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/VariableArrayTypeFix.java
index 1087e2ec29ef..c4257b06cdb2 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/VariableArrayTypeFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/VariableArrayTypeFix.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index 6b3afbe6d968..7c6067ca278e 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
index 388e66022cce..7304094495c6 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
@@ -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 myQuickFixes = null;
+ private BidirectionalMap myQuickFixes;
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.RedundantSuppressInspection");
- public boolean IGNORE_ALL = false;
+ public boolean IGNORE_ALL;
@Override
@NotNull
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
index 02d49d6cab9a..e868a10530a4 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
@@ -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
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
index 90ae880310bd..f06b1bda7065 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Analysis.java
@@ -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 {
final protected List[] computed;
final Key aKey;
- Res earlyResult = null;
+ Res earlyResult;
protected Analysis(RichControlFlow richControlFlow, Direction direction, boolean stable) {
this.richControlFlow = richControlFlow;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
index 9d71d4218939..08a529c5a098 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Contracts.java
@@ -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 {
@@ -47,8 +48,8 @@ class InOutAnalysis extends Analysis {
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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/NullableMethodAnalysis.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/NullableMethodAnalysis.java
index 2e2924c044ed..b865a9a4af34 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/NullableMethodAnalysis.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/NullableMethodAnalysis.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
index 52106534d8a7..ad52d2f8a7bb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/Parameters.java
@@ -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 {
}
}
- private int id = 0;
- private Frame nextFrame = null;
- private PResult subResult = null;
+ private int id;
+ private Frame nextFrame;
+ private PResult subResult;
@NotNull
protected Equation analyze() throws AnalyzerException {
@@ -383,7 +383,7 @@ class NonNullInAnalysis extends Analysis {
}
- 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 {
}
}
- private int id = 0;
- private Frame nextFrame = null;
+ private int id;
+ private Frame 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 {
}
- 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 {
}
abstract class NullityInterpreter extends BasicInterpreter {
- boolean top = false;
+ boolean top;
final boolean nullableAnalysis;
final int nullityMask;
private PResult subResult = Identity;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/asm/LeakingParameters.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/asm/LeakingParameters.java
index 42ee796d4bcf..6b7ba379f769 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/asm/LeakingParameters.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/asm/LeakingParameters.java
@@ -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 {
class IParametersUsage extends Interpreter {
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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalInspection.java
index 3582ce1a293c..9ca3844e0987 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/canBeFinal/CanBeFinalInspection.java
@@ -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";
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
index 4fdc7f5842c0..b05b41ce7211 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
@@ -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>() {
- @Nullable
- @Override
- public Result> compute() {
- List result = RecursionManager.doPreventingRecursion(method, true, new Computable>() {
- @Override
- public List 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 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 compatible = ContainerUtil.filter(contracts, new Condition() {
- @Override
- public boolean value(MethodContract contract) {
- if (notNull && contract.returnValue == NOT_NULL_VALUE) {
- return false;
- }
- return InferenceFromSourceUtil.isReturnTypeCompatible(returnType, contract.returnValue);
+ List 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 boxReturnValues(List contracts) {
- return ContainerUtil.mapNotNull(contracts, new Function() {
- @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 fromDelegate = ContainerUtil.mapNotNull(ControlFlowAnalyzer.getMethodContracts(targetMethod), new NullableFunction() {
- @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 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 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() {
- @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 toContracts(List states,
- final ValueConstraint constraint) {
- return ContainerUtil.map(states, new Function() {
- @Override
- public MethodContract fun(ValueConstraint[] state) {
- return new MethodContract(state, constraint);
- }
- });
+ private static List toContracts(List states, ValueConstraint constraint) {
+ return ContainerUtil.map(states, state -> new MethodContract(state, constraint));
}
private List visitLogicalOperation(PsiExpression[] operands, boolean conjunction, List states) {
@@ -359,29 +324,15 @@ class ContractInferenceInterpreter {
List finalStates = ContainerUtil.newArrayList();
for (PsiExpression operand : operands) {
List 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 antecedentsOf(List values) {
- return ContainerUtil.map(values, new Function() {
- @Override
- public ValueConstraint[] fun(MethodContract contract) {
- return contract.arguments;
- }
- });
- }
-
- private static List filterReturning(List values, final ValueConstraint result) {
- return ContainerUtil.filter(values, new Condition() {
- @Override
- public boolean value(MethodContract contract) {
- return contract.returnValue == result;
- }
- });
+ private static List antecedentsReturning(List 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 falseStates = antecedentsOf(filterReturning(conditionResults, FALSE_VALUE));
+ List 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 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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
index add2fbeced8d..231fbebfbc53 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
@@ -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
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullityInference.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullityInference.java
index d7f265808af1..e27fd76421f1 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullityInference.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/NullityInference.java
@@ -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() {
- @Nullable
- @Override
- public Result compute() {
- Nullness result = RecursionManager.doPreventingRecursion(method, true, new Computable() {
- @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);
});
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/PurityInference.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/PurityInference.java
index 38c921825469..c62feff2f812 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/PurityInference.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/PurityInference.java
@@ -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() {
- @Nullable
- @Override
- public Result compute() {
- boolean pure = RecursionManager.doPreventingRecursion(method, true, new Computable() {
- @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);
});
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspectionBase.java
index c253cb159aa8..47fb7a64bca7 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspectionBase.java
@@ -77,7 +77,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
final List myExtensions = ContainerUtil.createLockFreeCopyOnWriteList();
final UnusedSymbolLocalInspectionBase myLocalInspectionBase = createUnusedSymbolLocalInspection();
- private Set myProcessedSuspicious = null;
+ private Set myProcessedSuspicious;
private int myPhase;
private GlobalInspectionContext myContext;
private final boolean myEnabledInEditor;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
index f3880bfef990..d7ef822d828f 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
index b02c02657532..081053a6ed53 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java
index c49057015244..5a8665a534c8 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/duplicateThrows/DuplicateThrowsInspection.java
@@ -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
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
index ab23d803aa57..1a5e464551eb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java b/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
index 4266b66cb6ed..c28ccc2d6096 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/inheritance/search/InheritorsStatisticalDataSearch.java
@@ -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();
}
- private int myAnonymousInheritorsCount = 0;
+ private int myAnonymousInheritorsCount;
private Set getAllNotAnonymousInheritors() {
return myAllNotAnonymousInheritors;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
index ab764a1f518e..a95ad064e8bf 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
@@ -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 getForbiddenApi(@NotNull LanguageLevel languageLevel) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspectionBase.java
index b263fc278ffe..04167ce144a4 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspectionBase.java
@@ -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 myProblems = null;
+ private List myProblems;
private ProblemHolderImpl(InspectionManager manager, boolean onTheFly) {
myManager = manager;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
index 229979ca347d..44a28e2c7062 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java
@@ -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;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/redundantCast/RedundantCastInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/redundantCast/RedundantCastInspection.java
index 930485558c20..2e4e80599c1b 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/redundantCast/RedundantCastInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/redundantCast/RedundantCastInspection.java
@@ -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() {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
index accdc0b2b17b..b938eef5f260 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/uncheckedWarnings/UncheckedWarningLocalInspectionBase.java
@@ -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,
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java
index e4d3b33a5cfc..6fb30d7070d5 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java
@@ -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));
diff --git a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java
index 4339d36ffb38..a36824cebe36 100644
--- a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java
+++ b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaFindUsagesOptions.java b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaFindUsagesOptions.java
index 60b650ce293a..a990879fafff 100644
--- a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaFindUsagesOptions.java
+++ b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaFindUsagesOptions.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaMethodFindUsagesOptions.java b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaMethodFindUsagesOptions.java
index ab39b82d109f..87970138d70a 100644
--- a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaMethodFindUsagesOptions.java
+++ b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaMethodFindUsagesOptions.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaPackageFindUsagesOptions.java b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaPackageFindUsagesOptions.java
index 93cc0db69e9e..081284123e7d 100644
--- a/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaPackageFindUsagesOptions.java
+++ b/java/java-analysis-impl/src/com/intellij/find/findUsages/JavaPackageFindUsagesOptions.java
@@ -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);
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/InputVariables.java b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/InputVariables.java
index ad9897ae8c31..ccab96611fcf 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/InputVariables.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/InputVariables.java
@@ -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 myUsedInstanceFields = null;
- private boolean myPassFields = false;
+ private Set myUsedInstanceFields;
+ private boolean myPassFields;
public InputVariables(final List extends PsiVariable> inputVariables,
Project project,
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ParametersFolder.java b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ParametersFolder.java
index b7e0e48f8c4b..3cf591b9d34a 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ParametersFolder.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/extractMethod/ParametersFolder.java
@@ -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 myUsedNames = new HashSet();
private final Set myDeleted = new HashSet();
- private boolean myFoldingSelectedByDefault = false;
+ private boolean myFoldingSelectedByDefault;
public void clear() {
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
index c34982debacf..99d7bdeb25fa 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
@@ -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 myPatternAsList;
- private boolean myMultipleExitPoints = false;
+ private boolean myMultipleExitPoints;
@Nullable private final ReturnValue myReturnValue;
public DuplicatesFinder(PsiElement[] pattern,
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
index 10a3238ae7b6..5d3cb6f9f802 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
@@ -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> myParameterValues = new HashMap>();
private final Map> myParameterOccurrences = new HashMap>();
private final Map myDeclarationCorrespondence = new HashMap();
- private ReturnValue myReturnValue = null;
- private Ref myInstanceExpression = null;
+ private ReturnValue myReturnValue;
+ private Ref myInstanceExpression;
final Map myChangedParams = new HashMap();
private final boolean myIgnoreParameterTypes;
diff --git a/java/java-analysis-impl/src/org/jetbrains/java/generate/config/Config.java b/java/java-analysis-impl/src/org/jetbrains/java/generate/config/Config.java
index 95b93d9f9028..a10e0d59fdba 100644
--- a/java/java-analysis-impl/src/org/jetbrains/java/generate/config/Config.java
+++ b/java/java-analysis-impl/src/org/jetbrains/java/generate/config/Config.java
@@ -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;
diff --git a/java/java-analysis-impl/src/org/jetbrains/java/generate/config/FilterPattern.java b/java/java-analysis-impl/src/org/jetbrains/java/generate/config/FilterPattern.java
index e56ac4f3d0ee..c91c6abba820 100644
--- a/java/java-analysis-impl/src/org/jetbrains/java/generate/config/FilterPattern.java
+++ b/java/java-analysis-impl/src/org/jetbrains/java/generate/config/FilterPattern.java
@@ -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)) {
diff --git a/java/java-analysis-impl/src/org/jetbrains/java/generate/inspection/ClassHasNoToStringMethodInspection.java b/java/java-analysis-impl/src/org/jetbrains/java/generate/inspection/ClassHasNoToStringMethodInspection.java
index a5359d5a1392..3100c9fca2bb 100644
--- a/java/java-analysis-impl/src/org/jetbrains/java/generate/inspection/ClassHasNoToStringMethodInspection.java
+++ b/java/java-analysis-impl/src/org/jetbrains/java/generate/inspection/ClassHasNoToStringMethodInspection.java
@@ -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 {
diff --git a/java/java-impl/src/com/intellij/codeEditor/printing/HyperlinksToClassesOption.java b/java/java-impl/src/com/intellij/codeEditor/printing/HyperlinksToClassesOption.java
index 3326e97fe2f6..7a22d4754c94 100644
--- a/java/java-impl/src/com/intellij/codeEditor/printing/HyperlinksToClassesOption.java
+++ b/java/java-impl/src/com/intellij/codeEditor/printing/HyperlinksToClassesOption.java
@@ -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 collectReferences(PsiFile psiFile, Map filesMap) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
index 2a87f9fc8e29..99247cfd287f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/AllClassesGetter.java
@@ -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 processor = new Processor() {
- int count = 0;
+ int count;
final Set qNames = new THashSet();
final boolean pkgContext = JavaCompletionUtil.inSomePackage(context);
final String packagePrefix = getPackagePrefix(context, parameters.getOffset());
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/MemberLookupHelper.java b/java/java-impl/src/com/intellij/codeInsight/completion/MemberLookupHelper.java
index f665920528d2..6589f4a815e3 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/MemberLookupHelper.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/MemberLookupHelper.java
@@ -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 overloads, PsiClass containingClass, boolean shouldImport) {
this(overloads.get(0), containingClass, shouldImport, true);
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java
index e79fe27ac5c2..5a152a7c6eaf 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/StaticMemberProcessor.java
@@ -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) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
index 152f82650739..6a681fd182d2 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
@@ -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 myResults = new LinkedHashMap<>();
private final Set mySecondRateResults = ContainerUtil.newIdentityTroveSet();
private final Set 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 myMatcher;
private final Options myOptions;
private final boolean myAllowStaticWithInstanceQualifier;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java
index 1c6fd53e460f..ce0ee8fefe91 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMethodQualifierFix.java
@@ -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 myMethodCall;
- private List myCandidates = null;
+ private List myCandidates;
public AddMethodQualifierFix(final PsiMethodCallExpression methodCallExpression) {
myMethodCall = SmartPointerManager.getInstance(methodCallExpression.getProject()).createSmartPsiElementPointer(methodCallExpression);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java
index dce0d54e405b..1462dc3d2897 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java
index 277342155f61..40093816e2e1 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java
@@ -125,7 +125,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
StringBuilder result = new StringBuilder();
try {
for (ParameterInfoImpl info : infos) {
- PsiType type = info.createType(context, context.getManager());
+ PsiType type = info.createType(context);
if (type == null) return null;
if (result.length() != 0) result.append(", ");
result.append(type.getPresentableText());
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java
index 6d414e5e4750..5e91052a46eb 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeParameterClassFix.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
index 97bb45cb531c..91732b67b6ad 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
@@ -371,7 +371,7 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction {
for (int i = 0; i < newParameters.length; i++) {
if (parameterInfos[i].getOldIndex() == -1) {
final PsiParameter parameter = newParameters[i];
- final PsiType paramType = parameterInfos[i].getTypeWrapper().getType(parameter, parameter.getManager());
+ final PsiType paramType = parameterInfos[i].getTypeWrapper().getType(parameter);
if (type.isAssignableFrom(paramType)){
return parameter;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeferFinalAssignmentFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeferFinalAssignmentFix.java
index dcae6c51d727..08822884965b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeferFinalAssignmentFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeferFinalAssignmentFix.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InsertNewFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InsertNewFix.java
index a418efb4da15..b9dc50f31d78 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InsertNewFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/InsertNewFix.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
index 82cca2862eac..c6ecd4b31013 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
@@ -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 myResult = new ArrayList();
boolean myFilterMethods;
- boolean myFilterStatics = false;
+ boolean myFilterStatics;
MyScopeProcessor(PsiReferenceExpression refExpression) {
myFilterMethods = refExpression.getParent() instanceof PsiMethodCallExpression;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
index b0264dc22c52..5a48b1abb2c9 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithTryCatchFix.java
@@ -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);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SwitchStatementBranch.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SwitchStatementBranch.java
index f361a95e1cf7..cc7602917cc8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SwitchStatementBranch.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SwitchStatementBranch.java
@@ -30,8 +30,8 @@ class SwitchStatementBranch {
new ArrayList(5);
private final List m_pendingWhiteSpace =
new ArrayList(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);
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/AutoFormatTypedHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/AutoFormatTypedHandler.java
index 0e2a3de30933..2a7c9f38283d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/AutoFormatTypedHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/AutoFormatTypedHandler.java
@@ -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 = {
'+', '-', '*', '/', '%', '&', '^', '|', '<', '>', '!', '=', ' '
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/DeclarationMover.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/DeclarationMover.java
index 3b56a946e281..4d2d0e5c56b4 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/DeclarationMover.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/moveUpDown/DeclarationMover.java
@@ -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) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
index 6028ec3d564c..30071b845e9d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
@@ -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) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateEqualsHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateEqualsHandler.java
index b8f5a477097d..55e6aac1da51 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateEqualsHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateEqualsHandler.java
@@ -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() {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
index 8e674adca489..1f9e4a55ad83 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
index 7756b0725055..2ac11993dc07 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
@@ -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){
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateSuperMethodCallHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateSuperMethodCallHandler.java
index 81a98e94a160..d88bb8d5e3e7 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateSuperMethodCallHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/actions/GenerateSuperMethodCallHandler.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaExpressionSurroundDescriptor.java b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaExpressionSurroundDescriptor.java
index 43924d9199c3..691e9a36831e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaExpressionSurroundDescriptor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaExpressionSurroundDescriptor.java
@@ -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(),
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithTryCatchSurrounder.java b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithTryCatchSurrounder.java
index 996d61483451..482ffd851162 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithTryCatchSurrounder.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithTryCatchSurrounder.java
@@ -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() {
diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandler.java
index 71e301aa91f6..9ae19918b5c2 100644
--- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandler.java
@@ -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> myClassReferenceListMap = null;
+ private Map> myClassReferenceListMap;
public HighlightImportedElementsHandler(Editor editor, PsiFile file, PsiElement target, PsiImportStatementBase importStatement) {
super(editor, file);
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java
index cc6687acbcb4..aa36b456f33d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java
index 52deff695f95..60b33eb24b64 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java
@@ -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
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java
index cfb64329f8bd..be518aec68ad 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodHandler.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodHandler.java
index 8c2935c7a714..41b2e6cf456a 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodHandler.java
@@ -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 list = new ArrayList();
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);;
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ReplaceCastWithVariableAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ReplaceCastWithVariableAction.java
index 14a85ef7e348..a612a87b3312 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ReplaceCastWithVariableAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ReplaceCastWithVariableAction.java
@@ -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) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java
index 3ae3ddcf7498..a977ab7202e8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
index 2627ca9417af..639004bf4586 100644
--- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
+++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
@@ -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> myPackageContents = Collections.synchronizedMap(new HashMap>());
- private Map> myOldPackageContents = null;
-
private final Set myIgnoreElements = new HashSet();
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> packageContents) {
- for (String packageName : packageContents.keySet()) {
- final Set 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> 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 collectRefElements(Map> packageContents) {
- Set allAvailable = new HashSet();
- for (Set elements : packageContents.values()) {
- allAvailable.addAll(elements);
- }
- return allAvailable;
- }
-
@Override
@Nullable
public IntentionAction findQuickFixes(@NotNull final CommonProblemDescriptor descriptor, final String hint) {
diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
index 1d29c7308ebc..25d1294818e9 100644
--- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
+++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
@@ -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) {
diff --git a/java/java-impl/src/com/intellij/codeInspection/magicConstant/MagicConstantInspection.java b/java/java-impl/src/com/intellij/codeInspection/magicConstant/MagicConstantInspection.java
index e7a512889014..6b8f0d6edf85 100644
--- a/java/java-impl/src/com/intellij/codeInspection/magicConstant/MagicConstantInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/magicConstant/MagicConstantInspection.java
@@ -37,6 +37,8 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
+import com.intellij.psi.impl.cache.impl.id.IdIndex;
+import com.intellij.psi.impl.cache.impl.id.IdIndexEntry;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.search.GlobalSearchScope;
@@ -46,6 +48,7 @@ import com.intellij.psi.util.*;
import com.intellij.slicer.*;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.indexing.FileBasedIndex;
import gnu.trove.THashSet;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.Nls;
@@ -418,6 +421,14 @@ public class MagicConstantInspection extends BaseJavaLocalInspectionTool {
}
private static AllowedValues parseBeanInfo(@NotNull PsiModifierListOwner owner, @NotNull PsiManager manager) {
+ PsiFile containingFile = owner.getContainingFile();
+ 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) {
PsiParameter parameter = (PsiParameter)owner;
diff --git a/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java b/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
index 2949a79562db..7a8f9d413467 100644
--- a/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
+++ b/java/java-impl/src/com/intellij/codeInspection/unusedReturnValue/UnusedReturnValue.java
@@ -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
diff --git a/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesBuilder.java b/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesBuilder.java
index a38a1485c606..3539683dbacd 100644
--- a/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesBuilder.java
+++ b/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesBuilder.java
@@ -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>> myBackwardFilesInDependentPackages = new HashMap>>();
private final Map> myPackageDependencies = new HashMap>();
private HashMap>> myCyclicDependencies = new HashMap>>();
- private int myFileCount = 0;
+ private int myFileCount;
private final ForwardDependenciesBuilder myForwardBuilder;
private String myRootNodeNameInUsageView;
diff --git a/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesUtil.java b/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesUtil.java
index f15268681cf3..79625827f7c4 100644
--- a/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesUtil.java
+++ b/java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesUtil.java
@@ -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> chunks = new ArrayList>();
sccs.forEach(new TIntProcedure() {
- int myTNumber = 0;
+ int myTNumber;
public boolean execute(int size) {
Set packs = new LinkedHashSet();
for (int j = 0; j < size; j++) {
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java b/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java
index a8e29dedf295..e4967d286908 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/PackageViewPane.java
@@ -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;
diff --git a/java/java-impl/src/com/intellij/ide/util/treeView/TreeViewUtil.java b/java/java-impl/src/com/intellij/ide/util/treeView/TreeViewUtil.java
index 265c50e84e8e..310954c56883 100644
--- a/java/java-impl/src/com/intellij/ide/util/treeView/TreeViewUtil.java
+++ b/java/java-impl/src/com/intellij/ide/util/treeView/TreeViewUtil.java
@@ -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 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();
diff --git a/java/java-impl/src/com/intellij/internal/DupIconsFinder.java b/java/java-impl/src/com/intellij/internal/DupIconsFinder.java
index 63ebcdc759de..43224cfb8e4a 100644
--- a/java/java-impl/src/com/intellij/internal/DupIconsFinder.java
+++ b/java/java-impl/src/com/intellij/internal/DupIconsFinder.java
@@ -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.
@@ -31,8 +31,8 @@ import java.util.Map;
public class DupIconsFinder {
private static final MultiMap hashes = new MultiMap();
- private static int totalClusters = 0;
- private static int totalDups = 0;
+ private static int totalClusters;
+ private static int totalDups;
public static void main(String[] args) throws Exception {
File root = new File("/Users/max/images/icons");
diff --git a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarDescriptors.java b/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarDescriptors.java
index fbb64676422e..f9234abdfcd2 100644
--- a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarDescriptors.java
+++ b/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarDescriptors.java
@@ -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.
@@ -15,10 +15,6 @@
*/
package com.intellij.internal.statistic.libraryJar;
-/**
- * @author Ivan Chirkov
- */
-
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
diff --git a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java b/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java
index 6884216ea597..b4ea358f66f6 100644
--- a/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java
+++ b/java/java-impl/src/com/intellij/internal/statistic/libraryJar/LibraryJarUsagesCollector.java
@@ -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.
@@ -21,8 +21,10 @@ import com.intellij.internal.statistic.beans.GroupDescriptor;
import com.intellij.internal.statistic.beans.UsageDescriptor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JdkUtil;
+import com.intellij.openapi.util.io.JarUtil;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
@@ -44,33 +46,36 @@ public class LibraryJarUsagesCollector extends AbstractApplicationUsagesCollecto
private static final String DIGIT_VERSION_PATTERN_PART = "(\\d+.\\d+|\\d+)";
private static final Pattern JAR_FILE_NAME_PATTERN = Pattern.compile("[\\w|\\-|\\.]+-(" + DIGIT_VERSION_PATTERN_PART + "[\\w|\\.]*)jar");
- private static final Pattern DIGIT_VERSION_PATTERN = Pattern.compile(DIGIT_VERSION_PATTERN_PART + ".*");
@NotNull
@Override
public Set getProjectUsages(@NotNull final Project project) throws CollectUsagesException {
final LibraryJarDescriptor[] descriptors = LibraryJarStatisticsService.getInstance().getTechnologyDescriptors();
final Set result = new HashSet(descriptors.length);
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- for (LibraryJarDescriptor descriptor : descriptors) {
- String className = descriptor.myClass;
- if (className == null) continue;
- PsiClass[] psiClasses = JavaPsiFacade.getInstance(project).findClasses(className, ProjectScope.getLibrariesScope(project));
- for (PsiClass psiClass : psiClasses) {
- if (psiClass == null) continue;
+ ApplicationManager.getApplication().runReadAction(() -> {
+ for (LibraryJarDescriptor descriptor : descriptors) {
+ String className = descriptor.myClass;
+ if (className == null) continue;
- VirtualFile localFile = JarFileSystem.getInstance().getLocalVirtualFileFor(psiClass.getContainingFile().getVirtualFile());
- if (localFile == null) continue;
+ PsiClass[] psiClasses = JavaPsiFacade.getInstance(project).findClasses(className, ProjectScope.getLibrariesScope(project));
+ for (PsiClass psiClass : psiClasses) {
+ if (psiClass == null) continue;
- String version = getVersionByJarManifest(localFile);
- if (version == null) version = getVersionByJarFileName(localFile.getName());
- if (version == null) continue;
+ VirtualFile jarFile = JarFileSystem.getInstance().getLocalVirtualFileFor(psiClass.getContainingFile().getVirtualFile());
+ if (jarFile == null) continue;
- result.add(new UsageDescriptor(descriptor.myName + "_" + version, 1));
+ String version = getVersionByJarManifest(jarFile);
+ if (version == null) {
+ version = getVersionByJarFileName(jarFile.getName());
}
+
+ if (version == null ||
+ !StringUtil.containsChar(version, '.')) {
+ continue;
+ }
+
+ result.add(new UsageDescriptor(descriptor.myName + "_" + version, 1));
}
}
});
@@ -79,21 +84,15 @@ public class LibraryJarUsagesCollector extends AbstractApplicationUsagesCollecto
@Nullable
private static String getVersionByJarManifest(@NotNull VirtualFile file) {
- String version = JdkUtil.getJarMainAttribute(file, Attributes.Name.IMPLEMENTATION_VERSION);
- if (version == null) return null;
-
- Matcher versionMatcher = DIGIT_VERSION_PATTERN.matcher(version);
- if (!versionMatcher.matches()) return null;
-
- return versionMatcher.group(1);
+ return JarUtil.getJarAttribute(VfsUtilCore.virtualToIoFile(file), Attributes.Name.IMPLEMENTATION_VERSION);
}
@Nullable
- public String getVersionByJarFileName(@NotNull String fileName) {
+ private static String getVersionByJarFileName(@NotNull String fileName) {
Matcher fileNameMatcher = JAR_FILE_NAME_PATTERN.matcher(fileName);
if (!fileNameMatcher.matches()) return null;
- return fileNameMatcher.group(2);
+ return StringUtil.trimTrailing(fileNameMatcher.group(1), '.');
}
@NotNull
diff --git a/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java b/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java
index efd6ecfe8f64..e4b333fde599 100644
--- a/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java
+++ b/java/java-impl/src/com/intellij/javadoc/EnterInJavadocParamDescriptionHandler.java
@@ -2,6 +2,7 @@ package com.intellij.javadoc;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
+import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.CaretModel;
@@ -12,6 +13,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiJavaFile;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NotNull;
@@ -28,13 +30,17 @@ public class EnterInJavadocParamDescriptionHandler extends EnterHandlerDelegateA
@Override
public Result postProcessEnter(@NotNull final PsiFile file, @NotNull Editor editor, @NotNull DataContext dataContext) {
- if (!CodeInsightSettings.getInstance().SMART_INDENT_ON_ENTER
- || !CodeStyleSettingsManager.getSettings(file.getProject()).JD_ALIGN_PARAM_COMMENTS)
- {
+ if (!(file instanceof PsiJavaFile)
+ || !CodeInsightSettings.getInstance().SMART_INDENT_ON_ENTER
+ || !CodeStyleSettingsManager.getSettings(file.getProject()).JD_ALIGN_PARAM_COMMENTS) {
return Result.Continue;
}
final CaretModel caretModel = editor.getCaretModel();
final int caretOffset = caretModel.getOffset();
+ if (!isInJavaDoc(editor, caretOffset)) {
+ return Result.Continue;
+ }
+
final Pair> pair
= myHelper.parse(file, editor, caretOffset);
if (pair.first == null || pair.first.parameterDescriptionStartPosition == null) {
@@ -67,4 +73,15 @@ public class EnterInJavadocParamDescriptionHandler extends EnterHandlerDelegateA
myHelper.navigate(desiredPosition, editor, file.getProject());
return Result.Stop;
}
+
+ private static boolean isInJavaDoc(@NotNull Editor editor, int offset) {
+ Document document = editor.getDocument();
+ CharSequence docChars = document.getCharsSequence();
+ int i = CharArrayUtil.lastIndexOf(docChars, "/**", offset);
+ if (i >= 0) {
+ i = CharArrayUtil.indexOf(docChars, "*/", i);
+ return i > offset;
+ }
+ return false;
+ }
}
diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java
index 0a9415f38cc4..a7248ef1694e 100644
--- a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java
+++ b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java
@@ -32,15 +32,15 @@ public class JavadocConfiguration {
public boolean OPTION_NAVIGATOR = true;
public boolean OPTION_INDEX = true;
public boolean OPTION_SEPARATE_INDEX = true;
- public boolean OPTION_DOCUMENT_TAG_USE = false;
- public boolean OPTION_DOCUMENT_TAG_AUTHOR = false;
- public boolean OPTION_DOCUMENT_TAG_VERSION = false;
+ public boolean OPTION_DOCUMENT_TAG_USE;
+ public boolean OPTION_DOCUMENT_TAG_AUTHOR;
+ public boolean OPTION_DOCUMENT_TAG_VERSION;
public boolean OPTION_DOCUMENT_TAG_DEPRECATED = true;
public boolean OPTION_DEPRECATED_LIST = true;
public String OTHER_OPTIONS = "";
public String HEAP_SIZE;
public String LOCALE;
public boolean OPEN_IN_BROWSER = true;
- public boolean OPTION_INCLUDE_LIBS = false;
- public boolean OPTION_LINK_TO_JDK_DOCS = false;
+ public boolean OPTION_INCLUDE_LIBS;
+ public boolean OPTION_LINK_TO_JDK_DOCS;
}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaImportOptimizer.java b/java/java-impl/src/com/intellij/lang/java/JavaImportOptimizer.java
index eddd536d19fb..7601d5dee787 100644
--- a/java/java-impl/src/com/intellij/lang/java/JavaImportOptimizer.java
+++ b/java/java-impl/src/com/intellij/lang/java/JavaImportOptimizer.java
@@ -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.
@@ -47,7 +47,7 @@ public class JavaImportOptimizer implements ImportOptimizer {
if (newImportList == null) return EmptyRunnable.getInstance();
return new CollectingInfoRunnable() {
- private int myImportListLengthDiff = 0;
+ private int myImportListLengthDiff;
@Override
public void run() {
diff --git a/java/java-impl/src/com/intellij/packageDependencies/ui/TreeModelBuilder.java b/java/java-impl/src/com/intellij/packageDependencies/ui/TreeModelBuilder.java
index 994f2dda4796..6a7f23070da2 100644
--- a/java/java-impl/src/com/intellij/packageDependencies/ui/TreeModelBuilder.java
+++ b/java/java-impl/src/com/intellij/packageDependencies/ui/TreeModelBuilder.java
@@ -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.
@@ -71,14 +71,14 @@ public class TreeModelBuilder {
private final Map> myModuleNodes = new HashMap>();
private final Map> myModuleGroupNodes = new HashMap>();
private final Map> myLibraryNodes = new HashMap>();
- private int myScannedFileCount = 0;
- private int myTotalFileCount = 0;
- private int myMarkedFileCount = 0;
- private GeneralGroupNode myAllLibsNode = null;
+ private int myScannedFileCount;
+ private int myTotalFileCount;
+ private int myMarkedFileCount;
+ private GeneralGroupNode myAllLibsNode;
- private GeneralGroupNode mySourceRoot = null;
- private GeneralGroupNode myTestRoot = null;
- private GeneralGroupNode myLibsRoot = null;
+ private GeneralGroupNode mySourceRoot;
+ private GeneralGroupNode myTestRoot;
+ private GeneralGroupNode myLibsRoot;
public static final String PRODUCTION_NAME = AnalysisScopeBundle.message("package.dependencies.production.node.text");
public static final String TEST_NAME = AnalysisScopeBundle.message("package.dependencies.test.node.text");
@@ -166,8 +166,8 @@ public class TreeModelBuilder {
public void run() {
countFiles(project);
myFileIndex.iterateContent(new ContentIterator() {
- PackageDependenciesNode lastParent = null;
- VirtualFile dir = null;
+ PackageDependenciesNode lastParent;
+ VirtualFile dir;
public boolean processFile(VirtualFile fileOrDir) {
if (!fileOrDir.isDirectory()) {
if (lastParent != null && !Comparing.equal(dir, fileOrDir.getParent())) {
@@ -195,7 +195,7 @@ public class TreeModelBuilder {
private void processFilesRecursively(@NotNull VirtualFile file) {
VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() {
- private PackageDependenciesNode parent = null;
+ private PackageDependenciesNode parent;
@Override
public boolean visitFile(@NotNull VirtualFile file) {
diff --git a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java
index d0d7cce6e280..60e72e4c47ed 100644
--- a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java
+++ b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java
@@ -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.
@@ -245,7 +245,7 @@ public abstract class AbstractQualifiedReference myResults = new LinkedHashSet();
@Override
diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java b/java/java-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java
index 9a7268339b7e..d31f94e11175 100644
--- a/java/java-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java
+++ b/java/java-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java
@@ -21,19 +21,19 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings {
super("JavaCodeStyleSettings", container);
}
- public boolean SPACES_WITHIN_ANGLE_BRACKETS = false;
+ public boolean SPACES_WITHIN_ANGLE_BRACKETS;
//Type arguments
- public boolean SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT = false;
+ public boolean SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT;
//Type parameters
- public boolean SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER = false;
+ public boolean SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER;
public boolean SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = true;
- public boolean DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION = false;
+ public boolean DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION;
public int ANNOTATION_PARAMETER_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
- public boolean ALIGN_MULTILINE_ANNOTATION_PARAMETERS = false;
+ public boolean ALIGN_MULTILINE_ANNOTATION_PARAMETERS;
public int BLANK_LINES_AROUND_INITIALIZER = 1;
diff --git a/java/java-impl/src/com/intellij/psi/filters/types/AssignableFromFilter.java b/java/java-impl/src/com/intellij/psi/filters/types/AssignableFromFilter.java
index 23309bd687c0..8cd68e40f2e2 100644
--- a/java/java-impl/src/com/intellij/psi/filters/types/AssignableFromFilter.java
+++ b/java/java-impl/src/com/intellij/psi/filters/types/AssignableFromFilter.java
@@ -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.
@@ -31,8 +31,8 @@ import org.jetbrains.annotations.Nullable;
* To change this template use Options | File Templates.
*/
public class AssignableFromFilter implements ElementFilter{
- private PsiType myType = null;
- private String myClassName = null;
+ private PsiType myType;
+ private String myClassName;
public AssignableFromFilter(PsiType type){
myType = type;
diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
index eb662ce4ddd9..a4ecc6bf3c25 100644
--- a/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
+++ b/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
@@ -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.
@@ -58,9 +58,9 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
private final Indent myIndent;
protected Indent myChildIndent;
protected Alignment myChildAlignment;
- protected boolean myUseChildAttributes = false;
+ protected boolean myUseChildAttributes;
@NotNull protected final AlignmentStrategy myAlignmentStrategy;
- private boolean myIsAfterClassKeyword = false;
+ private boolean myIsAfterClassKeyword;
protected Alignment myReservedAlignment;
protected Alignment myReservedAlignment2;
diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/SyntheticCodeBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/SyntheticCodeBlock.java
index 7cc75fd34bf5..30f1960119e3 100644
--- a/java/java-impl/src/com/intellij/psi/formatter/java/SyntheticCodeBlock.java
+++ b/java/java-impl/src/com/intellij/psi/formatter/java/SyntheticCodeBlock.java
@@ -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.
@@ -42,7 +42,7 @@ public class SyntheticCodeBlock implements Block, JavaBlock{
private final TextRange myTextRange;
private ChildAttributes myChildAttributes;
- private boolean myIsIncomplete = false;
+ private boolean myIsIncomplete;
public SyntheticCodeBlock(List subBlocks,
Alignment alignment,
diff --git a/java/java-impl/src/com/intellij/psi/impl/cache/SmartIntToIntArrayMap.java b/java/java-impl/src/com/intellij/psi/impl/cache/SmartIntToIntArrayMap.java
index 387962a8b03b..04fceda6884e 100644
--- a/java/java-impl/src/com/intellij/psi/impl/cache/SmartIntToIntArrayMap.java
+++ b/java/java-impl/src/com/intellij/psi/impl/cache/SmartIntToIntArrayMap.java
@@ -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.
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
* @author max
*/
public class SmartIntToIntArrayMap {
- @Nullable TIntObjectHashMap myMultipleValuesMap = null;
+ @Nullable TIntObjectHashMap myMultipleValuesMap;
TIntIntHashMap mySingleValueMap = new TIntIntHashMap(10, 0.9f);
public int[] keys() {
diff --git a/java/java-impl/src/com/intellij/psi/impl/migration/PsiMigrationManager.java b/java/java-impl/src/com/intellij/psi/impl/migration/PsiMigrationManager.java
index 5f24dcadfb7d..7a363c9e1462 100644
--- a/java/java-impl/src/com/intellij/psi/impl/migration/PsiMigrationManager.java
+++ b/java/java-impl/src/com/intellij/psi/impl/migration/PsiMigrationManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 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.
@@ -62,6 +62,6 @@ public class PsiMigrationManager {
myCurrentMigration = null;
}
- ((PsiManagerEx)PsiManager.getInstance(myProject)).beforeChange(true);
+ PsiManagerEx.getInstanceEx(myProject).beforeChange(true);
}
}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/PsiCodeFragmentImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/PsiCodeFragmentImpl.java
index 10a30242b606..fa0c7e2fbb95 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/PsiCodeFragmentImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/PsiCodeFragmentImpl.java
@@ -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.
@@ -63,7 +63,7 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment
@Nullable PsiElement context) {
super(TokenType.CODE_FRAGMENT,
contentElementType,
- ((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
+ PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
);
myContext = context;
@@ -93,7 +93,7 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements JavaCodeFragment
return clone;
}
- private FileViewProvider myViewProvider = null;
+ private FileViewProvider myViewProvider;
@Override
@NotNull
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDComment.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDComment.java
index d79c018139d5..2edbf1595e24 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDComment.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDComment.java
@@ -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.
@@ -21,10 +21,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
-/**
- * @author max
- */
-
/**
* @author Dmitry Skavish
*/
diff --git a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/SingleClassHierarchyBuilder.java b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/SingleClassHierarchyBuilder.java
index f4e44af567c5..7127414b5962 100644
--- a/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/SingleClassHierarchyBuilder.java
+++ b/java/java-impl/src/com/intellij/psi/stubsHierarchy/impl/SingleClassHierarchyBuilder.java
@@ -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.
@@ -55,7 +55,7 @@ public class SingleClassHierarchyBuilder {
private final HierarchyService myHierarchyService;
protected final BitSet myProcessedSet = new BitSet();
private final ProjectFileIndex myProjectIndex;
- boolean isInSourceMode = false;
+ boolean isInSourceMode;
private UnitProcessor(Project project, HierarchyService hierarchyService) {
myProject = project;
diff --git a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
index 2e27afaeec6c..ca10fa56307c 100644
--- a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
+++ b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
@@ -60,9 +60,9 @@ public class JavaRefactoringSettings implements PersistentStateComponent 0;
+ }
+
private static PsiClassType[] filterCheckedExceptions(PsiClassType[] exceptions) {
List result = new ArrayList();
for (PsiClassType exceptionType : exceptions) {
@@ -636,7 +649,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
if (defaultValue == null && parameter.getOldIndex() == -1) {
((ParameterInfoImpl)parameter).setDefaultValue("");
if (!ApplicationManager.getApplication().isUnitTestMode()) {
- final PsiType type = ((ParameterInfoImpl)parameter).getTypeWrapper().getType(element, element.getManager());
+ final PsiType type = ((ParameterInfoImpl)parameter).getTypeWrapper().getType(element);
final DefaultValueChooser chooser =
new DefaultValueChooser(project, parameter.getName(), PsiTypesUtil.getDefaultValueOfType(type));
if (chooser.showAndGet()) {
@@ -932,7 +945,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
PsiSubstitutor... substitutor) throws IncorrectOperationException {
final PsiParameterList list = changeInfo.getMethod().getParameterList();
final PsiElementFactory factory = JavaPsiFacade.getInstance(list.getProject()).getElementFactory();
- PsiType type = newParm.createType(list, list.getManager());
+ PsiType type = newParm.createType(list);
for (PsiSubstitutor psiSubstitutor : substitutor) {
type = psiSubstitutor.substitute(type);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java
index b2dd2e8f0dbe..6e533a4ef06d 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java
@@ -18,6 +18,7 @@ package com.intellij.refactoring.changeSignature;
import com.intellij.psi.*;
import com.intellij.refactoring.util.CanonicalTypes;
import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -25,7 +26,12 @@ import org.jetbrains.annotations.Nullable;
*/
public interface JavaParameterInfo extends ParameterInfo {
@Nullable
- PsiType createType(PsiElement context, final PsiManager manager) throws IncorrectOperationException;
+ PsiType createType(@Nullable PsiElement context, final PsiManager manager) throws IncorrectOperationException;
+
+ @Nullable
+ default PsiType createType(@NotNull PsiElement context) {
+ return createType(context, context.getManager());
+ }
String getTypeText();
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodReferenceUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodReferenceUsageInfo.java
index 7866f8631a31..c253b1333a16 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodReferenceUsageInfo.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/MethodReferenceUsageInfo.java
@@ -47,7 +47,16 @@ class MethodReferenceUsageInfo extends UsageInfo {
}
public static boolean needToExpand(JavaChangeInfo changeInfo) {
- return !changeInfo.isGenerateDelegate() && (changeInfo.isParameterSetOrOrderChanged() || changeInfo.isExceptionSetOrOrderChanged());
+ if (!changeInfo.isGenerateDelegate()) {
+ if (changeInfo.isParameterSetOrOrderChanged()) {
+ return true;
+ }
+ else if (changeInfo.isExceptionSetOrOrderChanged()) {
+ return JavaChangeSignatureUsageProcessor.hasNewCheckedExceptions(changeInfo);
+ }
+ }
+
+ return false;
}
@Nullable
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
index 9bc2bba3b570..7fcfc830d6a9 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
@@ -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.
*/
-/**
- * created at Sep 17, 2001
- * @author Jeka
- */
package com.intellij.refactoring.changeSignature;
import com.intellij.openapi.diagnostic.Logger;
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
index d22b60890fd2..45fd55ff4ac0 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java
@@ -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.
@@ -128,8 +128,8 @@ public class ExtractMethodProcessor implements MatchProvider {
protected PsiStatement myFirstExitStatementCopy;
private PsiMethod myExtractedMethod;
private PsiMethodCallExpression myMethodCall;
- protected boolean myNullConditionalCheck = false;
- protected boolean myNotNullConditionalCheck = false;
+ protected boolean myNullConditionalCheck;
+ protected boolean myNotNullConditionalCheck;
private Nullness myNullness;
public ExtractMethodProcessor(Project project,
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectProcessor.java
index d8fd2feb9efa..5bb01dbda9d0 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractMethodObjectProcessor.java
@@ -81,7 +81,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
private PsiField[] myOutputFields;
private PsiMethod myInnerMethod;
- private boolean myMadeStatic = false;
+ private boolean myMadeStatic;
private final Set myUsages = new LinkedHashSet();
private PsiClass myInnerClass;
private boolean myChangeReturnType;
diff --git a/java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java b/java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java
index 31f2d25f1a0b..815f9450a8dc 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractSuperclass/ExtractSuperclassHandler.java
@@ -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.
*/
-/**
- * created at Oct 25, 2001
- * @author Jeka
- */
package com.intellij.refactoring.extractSuperclass;
import com.intellij.history.LocalHistory;
diff --git a/java/java-impl/src/com/intellij/refactoring/extractclass/BackpointerUsageVisitor.java b/java/java-impl/src/com/intellij/refactoring/extractclass/BackpointerUsageVisitor.java
index 06178817fd40..fc4f709344c2 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractclass/BackpointerUsageVisitor.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractclass/BackpointerUsageVisitor.java
@@ -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.
@@ -25,7 +25,7 @@ import com.intellij.psi.*;
import java.util.List;
class BackpointerUsageVisitor extends JavaRecursiveElementWalkingVisitor {
- private PsiMember myCause = null;
+ private PsiMember myCause;
private final List myFields;
private final List myInnerClasses;
diff --git a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java
index 3332ce2ed234..944100216317 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractClassProcessor.java
@@ -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.
@@ -81,7 +81,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
private final String newClassName;
private final String delegateFieldName;
private final boolean requiresBackpointer;
- private boolean delegationRequired = false;
+ private boolean delegationRequired;
private final ExtractEnumProcessor myExtractEnumProcessor;
private final PsiClass myClass;
private boolean extractInnerClass;
diff --git a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractedClassBuilder.java b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractedClassBuilder.java
index 03e7138eee23..4e42bd3cab93 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractedClassBuilder.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractclass/ExtractedClassBuilder.java
@@ -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.
@@ -38,8 +38,8 @@ import java.util.Set;
class ExtractedClassBuilder {
private static final Logger LOGGER = Logger.getInstance("com.siyeh.rpp.extractclass.ExtractedClassBuilder");
- private String className = null;
- private String packageName = null;
+ private String className;
+ private String packageName;
private final List fields = new ArrayList(5);
private final List methods = new ArrayList(5);
private final List initializers = new ArrayList(5);
@@ -48,9 +48,9 @@ class ExtractedClassBuilder {
private final List typeParams = new ArrayList();
private final List interfaces = new ArrayList();
- private boolean requiresBackPointer = false;
- private String originalClassName = null;
- private String backPointerName = null;
+ private boolean requiresBackPointer;
+ private String originalClassName;
+ private String backPointerName;
private Project myProject;
private JavaCodeStyleManager myJavaCodeStyleManager;
private Set myFieldsNeedingSetters;
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldHandler.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldHandler.java
index ebc80a018c3e..8f6fe19b1de6 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldHandler.java
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.inline;
+import com.intellij.codeInsight.PsiEquivalenceUtil;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.lang.StdLanguages;
import com.intellij.openapi.application.ApplicationManager;
@@ -23,12 +24,19 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
+import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.ProjectScope;
import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.HelpID;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.util.CommonRefactoringUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* @author ven
@@ -46,7 +54,7 @@ public class InlineConstantFieldHandler extends JavaInlineActionHandler {
final PsiElement navigationElement = element.getNavigationElement();
final PsiField field = (PsiField)(navigationElement instanceof PsiField ? navigationElement : element);
- if (!field.hasInitializer()) {
+ if (getInitializer(field) == null) {
String message = RefactoringBundle.message("no.initializer.present.for.the.field");
CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.INLINE_FIELD);
return;
@@ -66,23 +74,15 @@ public class InlineConstantFieldHandler extends JavaInlineActionHandler {
if (!field.hasModifierProperty(PsiModifier.FINAL)) {
final Ref hasWriteUsages = new Ref(false);
- if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
- @Override
- public void run() {
- ApplicationManager.getApplication().runReadAction(new Runnable() {
- @Override
- public void run() {
- for (PsiReference reference : ReferencesSearch.search(field)) {
- final PsiElement referenceElement = reference.getElement();
- if (!(referenceElement instanceof PsiExpression && PsiUtil.isAccessedForReading((PsiExpression)referenceElement))) {
- hasWriteUsages.set(true);
- break;
- }
- }
- }
- });
+ if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> {
+ for (PsiReference reference : ReferencesSearch.search(field)) {
+ final PsiElement referenceElement = reference.getElement();
+ if (!(referenceElement instanceof PsiExpression) || PsiUtil.isAccessedForWriting((PsiExpression)referenceElement)) {
+ hasWriteUsages.set(true);
+ break;
+ }
}
- }, "Check if inline is possible...", true, project)) {
+ }), "Check if Inline Is Possible...", true, project)) {
return;
}
if (hasWriteUsages.get()) {
@@ -105,4 +105,40 @@ public class InlineConstantFieldHandler extends JavaInlineActionHandler {
InlineFieldDialog dialog = new InlineFieldDialog(project, field, refExpression);
dialog.show();
}
+
+ @Nullable
+ protected static PsiExpression getInitializer(PsiField field) {
+ if (field.hasInitializer()) {
+ return field.getInitializer();
+ }
+
+ if (field.hasModifierProperty(PsiModifier.FINAL)) {
+ PsiClass containingClass = field.getContainingClass();
+ if (containingClass != null) {
+ PsiMethod[] constructors = containingClass.getConstructors();
+ final List result = new ArrayList<>();
+ for (PsiReference reference : ReferencesSearch.search(field, new LocalSearchScope(constructors))) {
+ final PsiElement element = reference.getElement();
+ if (element instanceof PsiReferenceExpression && PsiUtil.isOnAssignmentLeftHand((PsiExpression)element)) {
+ PsiAssignmentExpression assignmentExpression = PsiTreeUtil.getParentOfType(element, PsiAssignmentExpression.class);
+ if (assignmentExpression != null) {
+ ContainerUtil.addIfNotNull(assignmentExpression.getRExpression(), result);
+ }
+ }
+ }
+
+ if (result.isEmpty()) return null;
+
+ PsiExpression first = result.get(0);
+ for (PsiExpression expr : result) {
+ if (!PsiEquivalenceUtil.areElementsEquivalent(expr, first)) {
+ return null;
+ }
+ }
+ return first;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldProcessor.java
index bbab285e2333..ec722d291feb 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineConstantFieldProcessor.java
@@ -137,7 +137,7 @@ public class InlineConstantFieldProcessor extends BaseRefactoringProcessor {
@Override
protected void performRefactoring(@NotNull UsageInfo[] usages) {
- PsiExpression initializer = myField.getInitializer();
+ PsiExpression initializer = InlineConstantFieldHandler.getInitializer(myField);
LOG.assertTrue(initializer != null);
initializer = normalize ((PsiExpression)initializer.copy());
@@ -190,13 +190,23 @@ public class InlineConstantFieldProcessor extends BaseRefactoringProcessor {
if (myField.isWritable()) {
myField.normalizeDeclaration();
}
+
+ if (isAccessedForWriting(expr)) {
+ PsiAssignmentExpression assignmentExpression = PsiTreeUtil.getParentOfType(expr, PsiAssignmentExpression.class);
+ if (assignmentExpression != null) {
+ assignmentExpression.delete();
+ }
+ return;
+ }
+
if (expr instanceof PsiReferenceExpression) {
PsiExpression qExpression = ((PsiReferenceExpression)expr).getQualifierExpression();
if (qExpression != null) {
PsiReferenceExpression referenceExpression = null;
if (initializer1 instanceof PsiReferenceExpression) {
referenceExpression = (PsiReferenceExpression)initializer1;
- } else if (initializer1 instanceof PsiMethodCallExpression) {
+ }
+ else if (initializer1 instanceof PsiMethodCallExpression) {
referenceExpression = ((PsiMethodCallExpression)initializer1).getMethodExpression();
}
if (referenceExpression != null &&
@@ -242,7 +252,7 @@ public class InlineConstantFieldProcessor extends BaseRefactoringProcessor {
MultiMap conflicts = new MultiMap();
ReferencedElementsCollector collector = new ReferencedElementsCollector();
- PsiExpression initializer = myField.getInitializer();
+ PsiExpression initializer = InlineConstantFieldHandler.getInitializer(myField);
LOG.assertTrue(initializer != null);
initializer.accept(collector);
HashSet referencedWithVisibility = collector.myReferencedMembers;
@@ -250,7 +260,7 @@ public class InlineConstantFieldProcessor extends BaseRefactoringProcessor {
PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(myField.getProject()).getResolveHelper();
for (UsageInfo info : usagesIn) {
PsiElement element = info.getElement();
- if (element instanceof PsiExpression && isAccessedForWriting((PsiExpression)element)) {
+ if (element instanceof PsiExpression && (!myField.hasModifierProperty(PsiModifier.FINAL) || myInlineThisOnly) && isAccessedForWriting((PsiExpression)element)) {
String message = RefactoringBundle.message("0.is.used.for.writing.in.1", RefactoringUIUtil.getDescription(myField, true),
RefactoringUIUtil.getDescription(ConflictsUtil.getContainer(element), true));
conflicts.putValue(element, message);
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
index c006b85ad128..596aa32d15dd 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
@@ -137,7 +137,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
usages.add(new UsageInfo(reference.getElement()));
}
- OverridingMethodsSearch.search(myMethod).forEach(method -> {
+ OverridingMethodsSearch.search(myMethod, false).forEach(method -> {
if (AnnotationUtil.isAnnotated(method, Override.class.getName(), false)) {
usages.add(new UsageInfo(method));
}
@@ -363,8 +363,8 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
private static Map> getInaccessible(HashSet referencedElements,
UsageInfo[] usages,
PsiElement elementToInline) {
- Map> result = new HashMap>();
-
+ final Map> result = new HashMap>();
+ final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(elementToInline.getProject()).getResolveHelper();
for (UsageInfo usage : usages) {
final PsiElement usageElement = usage.getElement();
if (usageElement == null) continue;
@@ -379,7 +379,10 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (PsiTreeUtil.isAncestor(elementToInline, member, false)) continue;
if (elementToInline instanceof PsiClass &&
InheritanceUtil.isInheritorOrSelf((PsiClass)elementToInline, member.getContainingClass(), true)) continue;
- if (!PsiUtil.isAccessible(usage.getProject(), member, usageElement, null)) {
+ PsiElement resolveScope = usageElement instanceof PsiReferenceExpression
+ ? ((PsiReferenceExpression)usageElement).advancedResolve(false).getCurrentFileResolveScope()
+ : null;
+ if (!resolveHelper.isAccessible(member, member.getModifierList(), usageElement, null, resolveScope)) {
inaccessibleReferenced.add(member);
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/ReferencedElementsCollector.java b/java/java-impl/src/com/intellij/refactoring/inline/ReferencedElementsCollector.java
index 0372f065c0cb..0f8ce87c5d04 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/ReferencedElementsCollector.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/ReferencedElementsCollector.java
@@ -35,6 +35,7 @@ public class ReferencedElementsCollector extends JavaRecursiveElementVisitor {
if (psiElement instanceof PsiMember) {
checkAddMember((PsiMember)psiElement);
}
+ super.visitReferenceElement(reference);
}
protected void checkAddMember(@NotNull final PsiMember member) {
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java b/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
index fce4add34e0f..018e61ae48c6 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/BaseExpressionToFieldHandler.java
@@ -713,7 +713,7 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
}
final SmartTypePointer type = SmartTypePointerManager.getInstance(myProject).createSmartTypePointer(myType);
- initializer = IntroduceVariableBase.replaceExplicitWithDiamondWhenApplicable(initializer, myType);
+ initializer = IntroduceVariableBase.simplifyVariableInitializer(initializer, myType);
final PsiMethod enclosingConstructor = getEnclosingConstructor(myParentClass, myAnchorElement);
PsiClass destClass = mySettings.getDestinationClass() == null ? myParentClass : mySettings.getDestinationClass();
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java
index d084cb0ce339..aa2f8bd60c04 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceConstantHandler.java
@@ -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.
@@ -228,7 +228,7 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
}
private static class IsStaticFinalInitializerExpression extends ClassMemberReferencesVisitor {
- private PsiElement myElementReference = null;
+ private PsiElement myElementReference;
private final PsiExpression myInitializer;
public IsStaticFinalInitializerExpression(PsiClass aClass, PsiExpression initializer) {
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/EnclosingMethodSelectionDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/EnclosingMethodSelectionDialog.java
index 346b1571f690..3c92436fd9eb 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/EnclosingMethodSelectionDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/EnclosingMethodSelectionDialog.java
@@ -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.
@@ -29,7 +29,6 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.PsiMethod;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.ui.MethodCellRenderer;
-import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBList;
import org.jetbrains.annotations.NotNull;
@@ -41,7 +40,7 @@ import java.util.List;
public class EnclosingMethodSelectionDialog extends DialogWrapper {
private final List myEnclosingMethods;
- private JList myEnclosingMethodsList = null;
+ private JList myEnclosingMethodsList;
private final JCheckBox myCbReplaceInstanceOf = new JCheckBox(RefactoringBundle.message("use.interface.superclass.in.instanceof"));
private static final String REFACTORING_NAME = RefactoringBundle.message("introduce.parameter.title");
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java
index 1dd601d63801..ec5e04232ee2 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java
@@ -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.
@@ -15,10 +15,12 @@
*/
package com.intellij.refactoring.introduceParameter;
-import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LabeledComponent;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiExpression;
+import com.intellij.psi.PsiLocalVariable;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiParameter;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.IntroduceParameterRefactoring;
@@ -27,6 +29,7 @@ import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduce.inplace.KeyboardComboSwitcher;
import com.intellij.refactoring.ui.TypeSelectorManager;
import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.util.ui.UIUtil;
import gnu.trove.TIntArrayList;
@@ -40,7 +43,7 @@ import java.awt.event.ItemListener;
*/
public abstract class InplaceIntroduceParameterUI extends IntroduceParameterSettingsUI {
private JComboBox myReplaceFieldsCb;
- private boolean myHasWriteAccess = false;
+ private boolean myHasWriteAccess;
private final Project myProject;
private final TypeSelectorManager myTypeSelectorManager;
private final PsiExpression[] myOccurrences;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java
index 51af3a7b7cf3..9850709ba39a 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java
@@ -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.
@@ -60,7 +60,7 @@ public class IntroduceParameterDialog extends RefactoringDialog {
private final boolean myMustBeFinal;
private final PsiExpression myExpression;
private final PsiLocalVariable myLocalVar;
- protected JCheckBox myCbDeclareFinal = null;
+ protected JCheckBox myCbDeclareFinal;
protected JCheckBox myCbCollapseToLambda;
// private JComponent myParameterNameField = null;
@@ -73,7 +73,7 @@ public class IntroduceParameterDialog extends RefactoringDialog {
private NameSuggestionsField.DataChanged myParameterNameChangedListener;
private final IntroduceParameterSettingsPanel myPanel;
- private boolean myHasWriteAccess = false;
+ private boolean myHasWriteAccess;
IntroduceParameterDialog(@NotNull Project project,
@NotNull List classMembersList,
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
index 8951fa5d86e2..6b2d3fa95559 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java
@@ -304,7 +304,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
}
public static class AnySupers extends JavaRecursiveElementWalkingVisitor {
- private boolean myResult = false;
+ private boolean myResult;
@Override public void visitSuperExpression(PsiSuperExpression expression) {
myResult = true;
}
@@ -319,7 +319,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
}
public class AnySameNameVariables extends JavaRecursiveElementWalkingVisitor {
- private Pair conflict = null;
+ private Pair conflict;
public Pair getConflict() {
return conflict;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java
index af4c559bbc80..3daccf8cfd94 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 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.
@@ -43,18 +43,18 @@ public abstract class IntroduceParameterSettingsUI {
protected final boolean myIsInvokedOnDeclaration;
protected final boolean myHasInitializer;
- protected StateRestoringCheckBox myCbDeleteLocalVariable = null;
- protected StateRestoringCheckBox myCbUseInitializer = null;
- protected JRadioButton myReplaceFieldsWithGettersNoneRadio = null;
- protected JRadioButton myReplaceFieldsWithGettersInaccessibleRadio = null;
- protected JRadioButton myReplaceFieldsWithGettersAllRadio = null;
+ protected StateRestoringCheckBox myCbDeleteLocalVariable;
+ protected StateRestoringCheckBox myCbUseInitializer;
+ protected JRadioButton myReplaceFieldsWithGettersNoneRadio;
+ protected JRadioButton myReplaceFieldsWithGettersInaccessibleRadio;
+ protected JRadioButton myReplaceFieldsWithGettersAllRadio;
protected final ButtonGroup myReplaceFieldsWithGettersButtonGroup = new ButtonGroup();
protected final PsiParameter[] myParametersToRemove;
protected final boolean[] myParametersToRemoveChecked;
protected final boolean myIsLocalVariable;
- protected JCheckBox myCbReplaceAllOccurences = null;
- protected JCheckBox myCbGenerateDelegate = null;
+ protected JCheckBox myCbReplaceAllOccurences;
+ protected JCheckBox myCbGenerateDelegate;
public IntroduceParameterSettingsUI(PsiLocalVariable onLocalVariable,
PsiExpression onExpression,
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
index 2fb56af33023..f1b352733fe4 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
@@ -881,13 +881,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
PsiExpression initializer = RefactoringUtil.unparenthesizeExpression(expr1);
final SmartTypePointer selectedType = SmartTypePointerManager.getInstance(project).createSmartTypePointer(
settings.getSelectedType());
- if (expr1 instanceof PsiNewExpression) {
- final PsiNewExpression newExpression = (PsiNewExpression)expr1;
- if (newExpression.getArrayInitializer() != null) {
- initializer = newExpression.getArrayInitializer();
- }
- initializer = replaceExplicitWithDiamondWhenApplicable(initializer, selectedType.getType());
- }
+ initializer = simplifyVariableInitializer(initializer, selectedType.getType());
PsiDeclarationStatement declaration = JavaPsiFacade.getInstance(project).getElementFactory()
.createVariableDeclarationStatement(settings.getEnteredName(), selectedType.getType(), initializer, container);
@@ -991,20 +985,32 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
return false;
}
- public static PsiExpression replaceExplicitWithDiamondWhenApplicable(final PsiExpression initializer,
- final PsiType expectedType) {
- if (initializer instanceof PsiNewExpression) {
+ public static PsiExpression simplifyVariableInitializer(final PsiExpression initializer,
+ final PsiType expectedType) {
+
+ if (initializer instanceof PsiTypeCastExpression) {
+ PsiTypeElement castType = ((PsiTypeCastExpression)initializer).getCastType();
+ if (castType != null && TypeConversionUtil.isAssignable(expectedType, castType.getType())) {
+ return ((PsiTypeCastExpression)initializer).getOperand();
+ }
+ }
+ else if (initializer instanceof PsiNewExpression) {
final PsiNewExpression newExpression = (PsiNewExpression)initializer;
- final PsiExpression tryToDetectDiamondNewExpr = ((PsiVariable)JavaPsiFacade.getElementFactory(initializer.getProject())
- .createVariableDeclarationStatement("x", expectedType, initializer, initializer).getDeclaredElements()[0])
- .getInitializer();
- if (tryToDetectDiamondNewExpr instanceof PsiNewExpression &&
- PsiDiamondTypeUtil.canCollapseToDiamond((PsiNewExpression)tryToDetectDiamondNewExpr,
- (PsiNewExpression)tryToDetectDiamondNewExpr,
- expectedType)) {
- final PsiElement paramList = PsiDiamondTypeUtil
- .replaceExplicitWithDiamond(newExpression.getClassOrAnonymousClassReference().getParameterList());
- return PsiTreeUtil.getParentOfType(paramList, PsiNewExpression.class);
+ if (newExpression.getArrayInitializer() != null) {
+ return newExpression.getArrayInitializer();
+ }
+ else {
+ final PsiExpression tryToDetectDiamondNewExpr = ((PsiVariable)JavaPsiFacade.getElementFactory(initializer.getProject())
+ .createVariableDeclarationStatement("x", expectedType, initializer, initializer).getDeclaredElements()[0])
+ .getInitializer();
+ if (tryToDetectDiamondNewExpr instanceof PsiNewExpression &&
+ PsiDiamondTypeUtil.canCollapseToDiamond((PsiNewExpression)tryToDetectDiamondNewExpr,
+ (PsiNewExpression)tryToDetectDiamondNewExpr,
+ expectedType)) {
+ final PsiElement paramList = PsiDiamondTypeUtil
+ .replaceExplicitWithDiamond(newExpression.getClassOrAnonymousClassReference().getParameterList());
+ return PsiTreeUtil.getParentOfType(paramList, PsiNewExpression.class);
+ }
}
}
return initializer;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java
index 9523408a3a49..2175489557dd 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 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.
@@ -18,7 +18,6 @@ package com.intellij.refactoring.introduceVariable;
import com.intellij.openapi.help.HelpManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.PsiType;
@@ -48,7 +47,7 @@ class IntroduceVariableDialog extends DialogWrapper implements IntroduceVariable
private NameSuggestionsField myNameField;
private JCheckBox myCbReplaceAll;
- private StateRestoringCheckBox myCbReplaceWrite = null;
+ private StateRestoringCheckBox myCbReplaceWrite;
private JCheckBox myCbFinal;
private boolean myCbFinalState;
private TypeSelector myTypeSelector;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableSettings.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableSettings.java
index d6042f399162..a6d564198ec9 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableSettings.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableSettings.java
@@ -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: dsl
- * Date: Nov 15, 2002
- * Time: 4:12:48 PM
- * To change this template use Options | File Templates.
- */
package com.intellij.refactoring.introduceVariable;
import com.intellij.psi.PsiType;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectClassDescriptor.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectClassDescriptor.java
index ef2387ea2f8f..069aa33ab90d 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectClassDescriptor.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectClassDescriptor.java
@@ -16,6 +16,7 @@
package com.intellij.refactoring.introduceparameterobject;
import com.intellij.codeInsight.generation.GenerateMembersUtil;
+import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.ide.util.PackageUtil;
import com.intellij.openapi.diagnostic.Logger;
@@ -31,7 +32,6 @@ import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.refactoring.MoveDestination;
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
import com.intellij.refactoring.introduceParameterObject.IntroduceParameterObjectClassDescriptor;
-import com.intellij.refactoring.introduceParameterObject.IntroduceParameterObjectDelegate;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
@@ -48,8 +48,6 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
private final Map myExistingClassProperties = new HashMap<>();
private final MoveDestination myMoveDestination;
- private PsiMethod myExistingClassCompatibleConstructor;
-
public JavaIntroduceParameterObjectClassDescriptor(String className,
String packageName,
MoveDestination moveDestination,
@@ -76,7 +74,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
}
};
for (ParameterInfoImpl parameterInfo : paramsToMerge) {
- parameterInfo.getTypeWrapper().getType(method, method.getManager()).accept(typeParametersVisitor);
+ parameterInfo.getTypeWrapper().getType(method).accept(typeParametersVisitor);
}
}
@@ -110,27 +108,12 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
return text;
}
- public PsiMethod getExistingClassCompatibleConstructor() {
- return myExistingClassCompatibleConstructor;
- }
-
- public void setExistingClassCompatibleConstructor(PsiMethod existingClassCompatibleConstructor) {
- myExistingClassCompatibleConstructor = existingClassCompatibleConstructor;
- }
@Override
public PsiClass getExistingClass() {
return (PsiClass)super.getExistingClass();
}
- @Override
- public void setExistingClass(PsiElement existingClass) {
- super.setExistingClass(existingClass);
- if (isUseExistingClass()) {
- setExistingClassCompatibleConstructor(existingClassIsCompatible((PsiClass)existingClass));
- }
- }
-
public String getGetter(ParameterInfoImpl param) {
final ParameterBean bean = getBean(param);
return bean != null ? bean.getGetter() : null;
@@ -142,14 +125,14 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
}
@Override
- public String getSetterName(ParameterInfoImpl parameterInfo, PsiElement context) {
+ public String getSetterName(ParameterInfoImpl parameterInfo, @NotNull PsiElement context) {
final ParameterBean bean = getBean(parameterInfo);
@NonNls String setter = bean != null ? bean.getSetter() : null;
if (setter == null) {
setter = bean != null && bean.getField() != null
? GenerateMembersUtil.suggestSetterName(bean.getField())
: GenerateMembersUtil
- .suggestSetterName(parameterInfo.getName(), parameterInfo.getTypeWrapper().getType(context, context.getManager()),
+ .suggestSetterName(parameterInfo.getName(), parameterInfo.getTypeWrapper().getType(context),
context.getProject());
}
@@ -157,24 +140,25 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
}
@Override
- public String getGetterName(ParameterInfoImpl paramInfo, PsiElement context) {
+ public String getGetterName(ParameterInfoImpl paramInfo, @NotNull PsiElement context) {
final ParameterBean bean = getBean(paramInfo);
@NonNls String getter = bean != null ? bean.getGetter() : null;
if (getter == null) {
getter = bean != null && bean.getField() != null ? GenerateMembersUtil.suggestGetterName(bean.getField())
: GenerateMembersUtil
- .suggestGetterName(paramInfo.getName(), paramInfo.getTypeWrapper().getType(context, context.getManager()),
+ .suggestGetterName(paramInfo.getName(), paramInfo.getTypeWrapper().getType(context),
context.getProject());
}
return getter;
}
@Override
- public void initExistingClass(PsiMethod method) {
+ public PsiMethod findCompatibleConstructorInExistingClass(PsiMethod method) {
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(method.getProject());
final String qualifiedName = StringUtil.getQualifiedName(getPackageName(), getClassName());
final PsiClass existingClass = psiFacade.findClass(qualifiedName, method.getResolveScope());
setExistingClass(existingClass);
+ return findCompatibleConstructor(existingClass);
}
@Nullable
@@ -188,25 +172,25 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
}
@Nullable
- private PsiMethod existingClassIsCompatible(@NotNull PsiClass aClass) {
+ private PsiMethod findCompatibleConstructor(@NotNull PsiClass aClass) {
ParameterInfoImpl[] paramsToMerge = getParamsToMerge();
if (paramsToMerge.length == 1) {
final ParameterInfoImpl parameterInfo = paramsToMerge[0];
- final PsiType paramType = parameterInfo.getTypeWrapper().getType(aClass, aClass.getManager());
+ final PsiType paramType = parameterInfo.getTypeWrapper().getType(aClass);
if (TypeConversionUtil.isPrimitiveWrapper(aClass.getQualifiedName())) {
ParameterBean bean = new ParameterBean();
bean.setField(aClass.findFieldByName("value", false));
bean.setGetter(paramType.getCanonicalText() + "Value");
myExistingClassProperties.put(parameterInfo, bean);
for (PsiMethod constructor : aClass.getConstructors()) {
- if (constructorIsCompatible(constructor, new ParameterInfoImpl[]{parameterInfo}, aClass)) return constructor;
+ if (isConstructorCompatible(constructor, new ParameterInfoImpl[]{parameterInfo}, aClass)) return constructor;
}
}
}
final PsiMethod[] constructors = aClass.getConstructors();
PsiMethod compatibleConstructor = null;
for (PsiMethod constructor : constructors) {
- if (constructorIsCompatible(constructor, paramsToMerge, aClass)) {
+ if (isConstructorCompatible(constructor, paramsToMerge, aClass)) {
compatibleConstructor = constructor;
break;
}
@@ -246,7 +230,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
return compatibleConstructor;
}
- private boolean constructorIsCompatible(PsiMethod constructor, ParameterInfoImpl[] paramsToMerge, PsiElement context) {
+ private boolean isConstructorCompatible(PsiMethod constructor, ParameterInfoImpl[] paramsToMerge, PsiElement context) {
final PsiParameterList parameterList = constructor.getParameterList();
final PsiParameter[] constructorParams = parameterList.getParameters();
return areTypesCompatible(paramsToMerge, constructorParams, context);
@@ -257,8 +241,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
return false;
}
for (int i = 0; i < actual.length; i++) {
- if (!TypeConversionUtil.isAssignable(actual[i].getType(),
- getParameterInfo(i).getTypeWrapper().getType(context, context.getManager()))) {
+ if (!TypeConversionUtil.isAssignable(actual[i].getType(), getParameterInfo(i).getTypeWrapper().getType(context))) {
return false;
}
}
@@ -272,7 +255,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
}
@Override
- public PsiClass createClass(PsiMethod method, IntroduceParameterObjectDelegate.Accessor[] accessors) {
+ public PsiClass createClass(PsiMethod method, ReadWriteAccessDetector.Access[] accessors) {
if (isUseExistingClass()) {
return getExistingClass();
}
@@ -287,10 +270,10 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
final ParameterInfoImpl[] parameterInfos = getParamsToMerge();
for (int i = 0; i < parameterInfos.length; i++) {
PsiParameter parameter = parameters[parameterInfos[i].getOldIndex()];
- final boolean setterRequired = accessors[i] == IntroduceParameterObjectDelegate.Accessor.Setter;
+ final boolean setterRequired = accessors[i] == ReadWriteAccessDetector.Access.Write;
final String newName = parameterInfos[i].getName();
beanClassBuilder
- .addField(parameter, newName, parameterInfos[i].getTypeWrapper().getType(method, method.getManager()), setterRequired);
+ .addField(parameter, newName, parameterInfos[i].getTypeWrapper().getType(method), setterRequired);
}
final String classString = beanClassBuilder.buildBeanClass();
@@ -341,7 +324,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
private final PsiParameter param;
- private PsiField fieldAssigned = null;
+ private PsiField fieldAssigned;
ParamAssignmentFinder(PsiParameter param) {
this.param = param;
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectDelegate.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectDelegate.java
index 09ce3b828eaf..064a6c0092f6 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectDelegate.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/JavaIntroduceParameterObjectDelegate.java
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.introduceparameterobject;
+import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -36,7 +37,6 @@ import com.intellij.refactoring.introduceParameterObject.IntroduceParameterObjec
import com.intellij.refactoring.introduceparameterobject.usageInfo.*;
import com.intellij.refactoring.util.CanonicalTypes;
import com.intellij.refactoring.util.FixableUsageInfo;
-import com.intellij.refactoring.util.RefactoringUtil;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.VisibilityUtil;
@@ -182,47 +182,51 @@ public class JavaIntroduceParameterObjectDelegate
}
@Override
- public Accessor collectInternalUsages(Collection usages,
- PsiMethod overridingMethod,
- IntroduceParameterObjectClassDescriptor classDescriptor,
- P1 parameterInfo,
- String mergedParamName) {
+ public ReadWriteAccessDetector.Access collectInternalUsages(Collection usages,
+ PsiMethod overridingMethod,
+ IntroduceParameterObjectClassDescriptor classDescriptor,
+ P1 parameterInfo,
+ String mergedParamName) {
final LocalSearchScope localSearchScope = new LocalSearchScope(overridingMethod);
final PsiParameter[] params = overridingMethod.getParameterList().getParameters();
final PsiParameter parameter = params[parameterInfo.getOldIndex()];
+ final ReadWriteAccessDetector detector = ReadWriteAccessDetector.findDetector(parameter);
+ assert detector != null;
final String setter = classDescriptor.getSetterName(parameterInfo, overridingMethod);
final String getter = classDescriptor.getGetterName(parameterInfo, overridingMethod);
- final Accessor[] accessor = new Accessor[]{null};
+ final ReadWriteAccessDetector.Access[] accessor = new ReadWriteAccessDetector.Access[]{null};
ReferencesSearch.search(parameter, localSearchScope).forEach(reference -> {
- final PsiElement refElement = reference.getElement();
- if (refElement instanceof PsiReferenceExpression) {
- final PsiReferenceExpression paramUsage = (PsiReferenceExpression)refElement;
- if (RefactoringUtil.isPlusPlusOrMinusMinus(paramUsage.getParent())) {
- accessor[0] = Accessor.Setter;
- usages.add(new ReplaceParameterIncrementDecrement(paramUsage, mergedParamName, setter, getter));
- }
- else if (RefactoringUtil.isAssignmentLHS(paramUsage)) {
- accessor[0] = Accessor.Setter;
- usages.add(new ReplaceParameterAssignmentWithCall(paramUsage, mergedParamName, setter, getter));
- }
- else {
- if (accessor[0] == null) {
- accessor[0] = Accessor.Getter;
- }
- usages.add(new ReplaceParameterReferenceWithCall(paramUsage, mergedParamName, getter));
- }
- }
- return true;
- }
+ final PsiElement refElement = reference.getElement();
+ if (refElement instanceof PsiReferenceExpression) {
+ final PsiReferenceExpression paramUsage = (PsiReferenceExpression)refElement;
+ final ReadWriteAccessDetector.Access access = detector.getExpressionAccess(refElement);
+ if (access == ReadWriteAccessDetector.Access.Read) {
+ usages.add(new ReplaceParameterReferenceWithCall(paramUsage, mergedParamName, getter));
+ if (accessor[0] == null) {
+ accessor[0] = ReadWriteAccessDetector.Access.Read;
+ }
+ }
+ else {
+ if (access == ReadWriteAccessDetector.Access.ReadWrite) {
+ usages.add(new ReplaceParameterIncrementDecrement(paramUsage, mergedParamName, setter, getter));
+ }
+ else {
+ usages.add(new ReplaceParameterAssignmentWithCall(paramUsage, mergedParamName, setter, getter));
+ }
+ accessor[0] = ReadWriteAccessDetector.Access.Write;
+ }
+ }
+ return true;
+ }
);
return accessor[0];
}
@Override
- public void collectAccessibilityUsages(Collection usages,
- PsiMethod method,
- JavaIntroduceParameterObjectClassDescriptor descriptor,
- Accessor[] accessors) {
+ public void collectUsagesToGenerateMissedFieldAccessors(Collection usages,
+ PsiMethod method,
+ JavaIntroduceParameterObjectClassDescriptor descriptor,
+ ReadWriteAccessDetector.Access[] accessors) {
final ParameterInfoImpl[] parameterInfos = descriptor.getParamsToMerge();
final PsiClass existingClass = descriptor.getExistingClass();
final boolean useExisting = descriptor.isGenerateAccessors() || !(descriptor.isUseExistingClass() && existingClass != null);
@@ -230,7 +234,7 @@ public class JavaIntroduceParameterObjectDelegate
final PsiParameter[] psiParameters = method.getParameterList().getParameters();
for (int i = 0; i < parameterInfos.length; i++) {
int oldParamIdx = parameterInfos[i].getOldIndex();
- final IntroduceParameterObjectDelegate.Accessor accessor = accessors[i];
+ final ReadWriteAccessDetector.Access accessor = accessors[i];
if (accessor != null) {
final ParameterInfoImpl parameterInfo = parameterInfos[i];
final PsiParameter parameter = psiParameters[oldParamIdx];
@@ -240,20 +244,27 @@ public class JavaIntroduceParameterObjectDelegate
usages.add(new AppendAccessorsUsageInfo(parameter, existingClass, useExisting, parameterInfo, true, field));
}
- if (accessor == IntroduceParameterObjectDelegate.Accessor.Setter && descriptor.getSetter(parameterInfo) == null) {
+ if (accessor == ReadWriteAccessDetector.Access.Write && descriptor.getSetter(parameterInfo) == null) {
usages.add(new AppendAccessorsUsageInfo(parameter, existingClass, useExisting, parameterInfo, false, field));
}
}
}
+ }
+ @Override
+ public void collectAdditionalFixes(Collection usages,
+ final PsiMethod method,
+ final JavaIntroduceParameterObjectClassDescriptor descriptor) {
+
+ if (method.getDocComment() != null) {
+ usages.add(new ConstructorJavadocUsageInfo(method, descriptor));
+ }
final String newVisibility = descriptor.getNewVisibility();
if (newVisibility != null) {
- usages.add(new BeanClassVisibilityUsageInfo(existingClass, usages.toArray(UsageInfo.EMPTY_ARRAY), newVisibility, descriptor));
+ usages.add(new BeanClassVisibilityUsageInfo(descriptor.getExistingClass(), usages.toArray(UsageInfo.EMPTY_ARRAY), newVisibility, descriptor));
}
- usages.add(new ConstructorJavadocUsageInfo(method, descriptor));
-
if (!descriptor.isUseExistingClass()) {
usages.add(new FixableUsageInfo(method) {
@Override
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java
index ac91a848aae8..13510f2de268 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java
@@ -30,8 +30,8 @@ import java.util.Iterator;
import java.util.List;
class ParameterObjectBuilder {
- private String className = null;
- private String packageName = null;
+ private String className;
+ private String packageName;
private final List fields = new ArrayList(5);
private final List typeParams = new ArrayList();
private Project myProject;
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
index d2524b4a03a3..b660567f2c55 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHelper.java
@@ -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.
@@ -60,7 +60,7 @@ public class JavaPullUpHelper implements PullUpHelper {
private final PsiClass myTargetSuperClass;
private final boolean myIsTargetInterface;
private final DocCommentPolicy myJavaDocPolicy;
- private Set myMembersAfterMove = null;
+ private Set myMembersAfterMove;
private final Set myMembersToMove;
private final Project myProject;
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
index 770dd19073aa..cc4faae65b6f 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
@@ -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.
@@ -66,8 +66,8 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
private final PsiClass myTargetSuperClass;
private final MemberInfo[] myMembersToMove;
private final DocCommentPolicy myJavaDocPolicy;
- private Set myMembersAfterMove = null;
- private Set myMovedMembers = null;
+ private Set myMembersAfterMove;
+ private Set myMovedMembers;
private final Map> myProcessors = ContainerUtil.newHashMap();
public PullUpProcessor(PsiClass sourceClass, PsiClass targetSuperClass, MemberInfo[] membersToMove, DocCommentPolicy javaDocPolicy) {
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPushDown/JavaPushDownDelegate.java b/java/java-impl/src/com/intellij/refactoring/memberPushDown/JavaPushDownDelegate.java
index a2a76dfc7d73..c344f6df60a1 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPushDown/JavaPushDownDelegate.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPushDown/JavaPushDownDelegate.java
@@ -45,6 +45,7 @@ import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashSet;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -90,11 +91,21 @@ public class JavaPushDownDelegate extends PushDownDelegate pushDownData,
- MultiMap conflicts) {
+ MultiMap conflicts,
+ NewSubClassData subClassData) {
List toMove = pushDownData.getMembersToMove();
- new PushDownConflicts((PsiClass)pushDownData.getSourceClass(), toMove.toArray(new MemberInfo[0]), conflicts).checkTargetClassConflicts(targetClass, targetClass);
+ PsiElement context = targetClass;
+ if (context == null) {
+ assert subClassData != null;
+ Object newClassContext = subClassData.getContext();
+ if (newClassContext instanceof PsiElement) {
+ context = (PsiElement)newClassContext;
+ }
+ }
+ new PushDownConflicts((PsiClass)pushDownData.getSourceClass(), toMove.toArray(new MemberInfo[0]), conflicts)
+ .checkTargetClassConflicts(targetClass, context);
}
@Override
diff --git a/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java b/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java
index 4c1a640a0e92..1bcc190b45de 100644
--- a/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java
+++ b/java/java-impl/src/com/intellij/refactoring/migration/MigrationMapSet.java
@@ -1,6 +1,6 @@
/*
- * 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.
@@ -40,7 +40,7 @@ import java.util.Iterator;
public class MigrationMapSet {
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.migration.MigrationMapSet");
- private ArrayList myMaps = null;
+ private ArrayList myMaps;
@NonNls private static final String MIGRATION_MAP = "migrationMap";
@NonNls private static final String ENTRY = "entry";
@NonNls private static final String NAME = "name";
diff --git a/java/java-impl/src/com/intellij/refactoring/migration/MigrationUsagesViewDescriptor.java b/java/java-impl/src/com/intellij/refactoring/migration/MigrationUsagesViewDescriptor.java
index 6a6f1d816e45..7e71544ac881 100644
--- a/java/java-impl/src/com/intellij/refactoring/migration/MigrationUsagesViewDescriptor.java
+++ b/java/java-impl/src/com/intellij/refactoring/migration/MigrationUsagesViewDescriptor.java
@@ -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,16 +14,12 @@
* limitations under the License.
*/
-/**
- * created at Nov 24, 2001
- * @author Jeka
- */
package com.intellij.refactoring.migration;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.RefactoringBundle;
-import com.intellij.usageView.UsageViewDescriptor;
import com.intellij.usageView.UsageViewBundle;
+import com.intellij.usageView.UsageViewDescriptor;
import org.jetbrains.annotations.NotNull;
class MigrationUsagesViewDescriptor implements UsageViewDescriptor {
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
index ce19d6bacaa5..2ad63ce6195f 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/AutocreatingSingleSourceRootMoveDestination.java
@@ -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.
@@ -97,7 +97,7 @@ public class AutocreatingSingleSourceRootMoveDestination extends AutocreatingMov
return true;
}
- PsiDirectory myTargetDirectory = null;
+ PsiDirectory myTargetDirectory;
private PsiDirectory getDirectory() throws IncorrectOperationException {
if (myTargetDirectory == null) {
myTargetDirectory = RefactoringUtil.createPackageDirectoryInSourceRoot(myPackage, mySourceRoot);
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java
index 380cfa3596a4..b4fc0a915bb1 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesImpl.java
@@ -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.
*/
-/**
- * created at Nov 27, 2001
- * @author Jeka
- */
package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.history.LocalHistory;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.java
index 305c32752abd..1e41e7188ba3 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerDialog.java
@@ -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,10 +14,6 @@
* limitations under the License.
*/
-/**
- * created at Sep 24, 2001
- * @author Jeka
- */
package com.intellij.refactoring.move.moveInner;
import com.intellij.openapi.application.ApplicationManager;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerImpl.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerImpl.java
index 9b8fc36fbd7f..3eb40a600c9e 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerImpl.java
@@ -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.
*/
-/**
- * created at Nov 12, 2001
- * @author Jeka
- */
package com.intellij.refactoring.move.moveInner;
import com.intellij.ide.util.PackageChooserDialog;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerViewDescriptor.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerViewDescriptor.java
index 04e2400467aa..e90ef34878c0 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerViewDescriptor.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerViewDescriptor.java
@@ -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 Sep 11, 2001
- * @author Jeka
- */
package com.intellij.refactoring.move.moveInner;
import com.intellij.psi.PsiClass;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
index f5eb13ce7376..261a907a6606 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersDialog.java
@@ -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.
@@ -15,7 +15,10 @@
*/
package com.intellij.refactoring.move.moveMembers;
-import com.intellij.ide.util.*;
+import com.intellij.ide.util.ClassFilter;
+import com.intellij.ide.util.PackageUtil;
+import com.intellij.ide.util.TreeClassChooser;
+import com.intellij.ide.util.TreeClassChooserFactory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.event.DocumentAdapter;
@@ -39,7 +42,6 @@ import com.intellij.refactoring.move.MoveDialogBase;
import com.intellij.refactoring.ui.JavaVisibilityPanel;
import com.intellij.refactoring.ui.MemberSelectionPanel;
import com.intellij.refactoring.ui.MemberSelectionTable;
-import com.intellij.refactoring.ui.RefactoringDialog;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.refactoring.util.classMembers.MemberInfo;
import com.intellij.refactoring.util.classMembers.UsesAndInterfacesDependencyMemberInfoModel;
@@ -407,7 +409,7 @@ public class MoveMembersDialog extends MoveDialogBase implements MoveMembersOpti
}
private class MyMemberInfoModel extends UsesAndInterfacesDependencyMemberInfoModel {
- PsiClass myTargetClass = null;
+ PsiClass myTargetClass;
public MyMemberInfoModel() {
super(mySourceClass, null, false, DEFAULT_CONTAINMENT_VERIFIER);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersImpl.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersImpl.java
index 07b76fd13fb9..4c783a4f7fff 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveMembersImpl.java
@@ -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 Nov 21, 2001
- * @author Jeka
- */
package com.intellij.refactoring.move.moveMembers;
import com.intellij.openapi.project.Project;
diff --git a/java/java-impl/src/com/intellij/refactoring/psi/ArrayIterator.java b/java/java-impl/src/com/intellij/refactoring/psi/ArrayIterator.java
index 1fd8875f475f..3d492299baf6 100644
--- a/java/java-impl/src/com/intellij/refactoring/psi/ArrayIterator.java
+++ b/java/java-impl/src/com/intellij/refactoring/psi/ArrayIterator.java
@@ -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.
@@ -20,7 +20,7 @@ import java.util.NoSuchElementException;
class ArrayIterator implements Iterator{
private final T[] contents;
- private int currentIndex = 0;
+ private int currentIndex;
private final Object lock = new Object();
ArrayIterator(T[] contents){
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticUsageRenamer.java b/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticUsageRenamer.java
index ce258c3cd013..009230acd93b 100644
--- a/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticUsageRenamer.java
+++ b/java/java-impl/src/com/intellij/refactoring/rename/naming/AutomaticUsageRenamer.java
@@ -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.
@@ -88,10 +88,10 @@ public abstract class AutomaticUsageRenamer {
return myElements;
}
- @Nullable
/**
* Element source, path. For example, package. Taken into account while sorting.
*/
+ @Nullable
public String getSourceName(T element) {
return null;
}
diff --git a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperDialog.java b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperDialog.java
index e1946746fae1..b3afdb12ab7f 100644
--- a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperDialog.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 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.
@@ -42,7 +42,7 @@ public class TurnRefsToSuperDialog extends RefactoringDialog {
@NotNull private final PsiClass mySubClass;
private final List mySuperClasses;
- private JList mySuperClassesList = null;
+ private JList mySuperClassesList;
private final JCheckBox myCbReplaceInstanceOf = new JCheckBox();
TurnRefsToSuperDialog(Project project, @NotNull PsiClass subClass, List superClasses) {
diff --git a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperHandler.java b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperHandler.java
index 1d546d6280d8..d1678668e745 100644
--- a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperHandler.java
@@ -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,15 +14,10 @@
* limitations under the License.
*/
-/**
- * created at Oct 25, 2001
- * @author Jeka
- */
package com.intellij.refactoring.turnRefsToSuper;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.project.Project;
diff --git a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java
index 95535071b50e..a09e0ec1fa19 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java
@@ -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.*;
* @author db
*/
public class PsiTypeVariableFactory {
- private int myCurrent = 0;
+ private int myCurrent;
private final List> myClusters = new LinkedList>();
private final Map> myVarCluster = new HashMap>();
diff --git a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java
index 14b9a1715050..3e0083e58467 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java
@@ -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.
@@ -481,7 +481,7 @@ public class BindingFactory {
if (type != null) {
class Verifier extends PsiExtendedTypeVisitor {
- boolean myFlag = false;
+ boolean myFlag;
@Override public Void visitTypeVariable(final PsiTypeVariable var) {
if (var.getIndex() == index) {
@@ -565,7 +565,7 @@ public class BindingFactory {
public int getWidth() {
class MyProcecure implements TObjectProcedure {
- int width = 0;
+ int width;
public boolean execute(PsiType type) {
if (substitute(type) != null) width++;
return true;
diff --git a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java
index a58e0561c449..00ec0fd5cc4b 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java
@@ -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,7 +50,7 @@ public class ResolverTree {
private final Project myProject;
private final TObjectIntHashMap myBindingDegree; //How many times this type variable is bound in the system
private final Settings mySettings;
- private boolean mySolutionFound = false;
+ private boolean mySolutionFound;
private Set myConstraints;
@@ -244,7 +244,7 @@ public class ResolverTree {
final Map index = new HashMap();
sccs.forEach(new TIntProcedure() {
- int myTNumber = 0;
+ int myTNumber;
@Override
public boolean execute(int size) {
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
index 7d00278f324d..f93cfcb0e6bc 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
@@ -77,7 +77,7 @@ public class TypeMigrationLabeler {
private final LinkedHashMap myNewExpressionTypeChange;
private final LinkedHashMap myClassTypeArgumentsChange;
- private TypeMigrationUsageInfo[] myMigratedUsages = null;
+ private TypeMigrationUsageInfo[] myMigratedUsages;
private TypeMigrationUsageInfo myCurrentRoot;
private final Map>> myRootsTree =
diff --git a/java/java-impl/src/com/intellij/refactoring/ui/YesNoPreviewUsagesDialog.java b/java/java-impl/src/com/intellij/refactoring/ui/YesNoPreviewUsagesDialog.java
index 7f82cda4a051..5603e277ce36 100644
--- a/java/java-impl/src/com/intellij/refactoring/ui/YesNoPreviewUsagesDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/ui/YesNoPreviewUsagesDialog.java
@@ -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,13 @@
* limitations under the License.
*/
-/**
- * created at Oct 8, 2001
- * @author Jeka
- */
package com.intellij.refactoring.ui;
import com.intellij.openapi.help.HelpManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.MultiLineLabelUI;
import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.ui.MultiLineLabelUI;
import com.intellij.refactoring.RefactoringBundle;
import org.jetbrains.annotations.NotNull;
diff --git a/java/java-impl/src/com/intellij/refactoring/util/ConflictsUtil.java b/java/java-impl/src/com/intellij/refactoring/util/ConflictsUtil.java
index 19d1eb9bfa08..f475a46a64ec 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/ConflictsUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/ConflictsUtil.java
@@ -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 Oct 8, 2001
- * @author Jeka
- */
package com.intellij.refactoring.util;
import com.intellij.lang.findUsages.DescriptiveNameUtil;
diff --git a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
index d37425b05967..0b1f79652c2a 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
@@ -330,7 +330,7 @@ public class RefactoringUtil {
}
public static PsiMethod getEnclosingMethod(PsiElement element) {
- final PsiElement container = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiClass.class);
+ final PsiElement container = PsiTreeUtil.getParentOfType(element, PsiMethod.class, PsiClass.class, PsiLambdaExpression.class);
return container instanceof PsiMethod ? (PsiMethod)container : null;
}
diff --git a/java/java-impl/src/com/intellij/refactoring/util/classMembers/ElementNeedsThis.java b/java/java-impl/src/com/intellij/refactoring/util/classMembers/ElementNeedsThis.java
index 8bcacc8333e9..3f3c7e7479c4 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/classMembers/ElementNeedsThis.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/classMembers/ElementNeedsThis.java
@@ -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.
@@ -22,7 +22,7 @@ import com.intellij.psi.util.PsiUtil;
* @author dsl
*/
public class ElementNeedsThis extends ClassThisReferencesVisitor {
- private boolean myResult = false;
+ private boolean myResult;
private final PsiElement myMember;
public ElementNeedsThis(PsiClass aClass, PsiElement member) {
diff --git a/java/java-impl/src/com/intellij/refactoring/util/classMembers/InterfaceMemberDependencyGraph.java b/java/java-impl/src/com/intellij/refactoring/util/classMembers/InterfaceMemberDependencyGraph.java
index d04b5b7d3c98..741a29b66226 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/classMembers/InterfaceMemberDependencyGraph.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/classMembers/InterfaceMemberDependencyGraph.java
@@ -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.
@@ -26,7 +26,7 @@ import java.util.Iterator;
import java.util.Set;
public class InterfaceMemberDependencyGraph> implements MemberDependencyGraph {
- protected HashSet myInterfaceDependencies = null;
+ protected HashSet myInterfaceDependencies;
protected HashMap> myMembersToInterfacesMap = new HashMap>();
protected HashSet myImplementedInterfaces;
protected HashMap> myMethodsFromInterfaces;
diff --git a/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassReferenceScanner.java b/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassReferenceScanner.java
index 2ee99941aebc..faa9cdc1910d 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassReferenceScanner.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/classRefs/ClassReferenceScanner.java
@@ -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.
@@ -22,7 +22,7 @@ import com.intellij.psi.*;
*/
public abstract class ClassReferenceScanner {
protected PsiClass myClass;
- private PsiReference[] myReferences = null;
+ private PsiReference[] myReferences;
public abstract PsiReference[] findReferences();
diff --git a/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java b/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java
index a6d97af3d961..88c54b97c43e 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/duplicates/MethodDuplicatesHandler.java
@@ -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.
@@ -161,7 +161,7 @@ public class MethodDuplicatesHandler implements RefactoringActionHandler, Contex
}
scope.accept(new PsiRecursiveElementVisitor() {
- private int myFileCount = 0;
+ private int myFileCount;
@Override public void visitFile(final PsiFile file) {
if (progressIndicator != null){
if (progressIndicator.isCanceled()) return;
diff --git a/java/java-impl/src/com/intellij/refactoring/util/occurrences/BaseOccurrenceManager.java b/java/java-impl/src/com/intellij/refactoring/util/occurrences/BaseOccurrenceManager.java
index 4113e2cd6ca1..dd61924b09ce 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/occurrences/BaseOccurrenceManager.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/occurrences/BaseOccurrenceManager.java
@@ -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.
@@ -28,8 +28,8 @@ import java.util.ArrayList;
* @author dsl
*/
public abstract class BaseOccurrenceManager implements OccurrenceManager {
- private PsiExpression[] myOccurrences = null;
- private PsiElement myAnchorStatement = null;
+ private PsiExpression[] myOccurrences;
+ private PsiElement myAnchorStatement;
protected final OccurrenceFilter myFilter;
public BaseOccurrenceManager(OccurrenceFilter filter) {
diff --git a/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/ReturnValueBeanBuilder.java b/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/ReturnValueBeanBuilder.java
index 965083e8ddc0..b880c8402e6a 100644
--- a/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/ReturnValueBeanBuilder.java
+++ b/java/java-impl/src/com/intellij/refactoring/wrapreturnvalue/ReturnValueBeanBuilder.java
@@ -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.
@@ -29,10 +29,10 @@ import java.util.List;
class ReturnValueBeanBuilder {
private final List myTypeParams = new ArrayList();
- private String myClassName = null;
- private String myPackageName = null;
- private Project myProject = null;
- private PsiType myValueType = null;
+ private String myClassName;
+ private String myPackageName;
+ private Project myProject;
+ private PsiType myValueType;
private boolean myStatic;
public void setClassName(String className) {
diff --git a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java
index 8aed8cd985b4..487fbe0987c3 100644
--- a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java
+++ b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzer.java
@@ -29,8 +29,6 @@ import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtil;
-import com.intellij.util.NullableFunction;
-import com.intellij.util.PairProcessor;
import com.intellij.util.WalkingState;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FactoryMap;
@@ -42,7 +40,7 @@ import java.util.*;
/**
* User: cdr
*/
-public class SliceNullnessAnalyzer {
+class SliceNullnessAnalyzer {
private static void groupByNullness(NullAnalysisResult result, SliceRootNode oldRoot, final Map map) {
SliceRootNode root = createNewTree(result, oldRoot, map);
@@ -51,13 +49,13 @@ public class SliceNullnessAnalyzer {
}
@NotNull
- public static SliceRootNode createNewTree(NullAnalysisResult result, SliceRootNode oldRoot, final Map map) {
+ static SliceRootNode createNewTree(NullAnalysisResult result, SliceRootNode oldRoot, final Map map) {
SliceRootNode root = oldRoot.copy();
assert oldRoot.myCachedChildren.size() == 1;
SliceNode oldRootStart = oldRoot.myCachedChildren.get(0);
root.setChanged();
root.targetEqualUsages.clear();
- root.myCachedChildren = new ArrayList();
+ root.myCachedChildren = new ArrayList<>();
createValueRootNode(result, oldRoot, map, root, oldRootStart, "Null Values", NullAnalysisResult.NULLS);
createValueRootNode(result, oldRoot, map, root, oldRootStart, "NotNull Values", NullAnalysisResult.NOT_NULLS);
@@ -80,37 +78,31 @@ public class SliceNullnessAnalyzer {
SliceLeafValueClassNode valueRoot = new SliceLeafValueClassNode(root.getProject(), root, nodeName);
root.myCachedChildren.add(valueRoot);
- Set uniqueValues = new THashSet(groupedByValue, SliceLeafAnalyzer.LEAF_ELEMENT_EQUALITY);
+ Set uniqueValues = new THashSet<>(groupedByValue, SliceLeafAnalyzer.LEAF_ELEMENT_EQUALITY);
for (final PsiElement expression : uniqueValues) {
- SliceNode newRoot = SliceLeafAnalyzer.filterTree(oldRootStart, new NullableFunction() {
- @Override
- public SliceNode fun(SliceNode oldNode) {
- if (oldNode.getDuplicate() != null) {
- return null;
- }
-
- for (PsiElement nullSuspect : group(oldNode, map, group)) {
- if (PsiEquivalenceUtil.areElementsEquivalent(nullSuspect, expression)) {
- return oldNode.copy();
- }
- }
+ SliceNode newRoot = SliceLeafAnalyzer.filterTree(oldRootStart, oldNode -> {
+ if (oldNode.getDuplicate() != null) {
return null;
}
- },new PairProcessor>() {
- @Override
- public boolean process(SliceNode node, List children) {
- if (!children.isEmpty()) return true;
- PsiElement element = node.getValue().getElement();
- if (element == null) return false;
- return PsiEquivalenceUtil.areElementsEquivalent(element, expression); // leaf can be there only if it's filtering expression
+
+ for (PsiElement nullSuspect : group(oldNode, map, group)) {
+ if (PsiEquivalenceUtil.areElementsEquivalent(nullSuspect, expression)) {
+ return oldNode.copy();
+ }
}
+ return null;
+ }, (node, children) -> {
+ if (!children.isEmpty()) return true;
+ PsiElement element = node.getValue().getElement();
+ if (element == null) return false;
+ return PsiEquivalenceUtil.areElementsEquivalent(element, expression); // leaf can be there only if it's filtering expression
});
valueRoot.myCachedChildren.add(new SliceLeafValueRootNode(root.getProject(), expression, valueRoot, Collections.singletonList(newRoot),
oldRoot.getValue().params));
}
}
- public static void startAnalyzeNullness(@NotNull AbstractTreeStructure treeStructure, @NotNull Runnable finish) {
+ static void startAnalyzeNullness(@NotNull AbstractTreeStructure treeStructure, @NotNull Runnable finish) {
final SliceRootNode root = (SliceRootNode)treeStructure.getRootElement();
final Ref leafExpressions = Ref.create(null);
final Map map = createMap();
@@ -151,7 +143,7 @@ public class SliceNullnessAnalyzer {
@Override
protected Map createMap() {
- return ContainerUtil.newIdentityTroveMap();
+ return ContainerUtil.newIdentityTroveMap();
}
};
}
@@ -164,9 +156,9 @@ public class SliceNullnessAnalyzer {
}
@NotNull
- public static NullAnalysisResult calcNullableLeaves(@NotNull final SliceNode root,
- @NotNull AbstractTreeStructure treeStructure,
- @NotNull final Map