Merge remote-tracking branch 'origin/master' into develar/is
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 21 Jul 2016 15:39:09 +0000 (17:39 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 21 Jul 2016 15:39:09 +0000 (17:39 +0200)
168 files changed:
build/groovy/org/jetbrains/intellij/build/ApplicationInfoProperties.groovy
build/groovy/org/jetbrains/intellij/build/BuildContext.groovy
build/groovy/org/jetbrains/intellij/build/BuildTasks.groovy
build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy
build/groovy/org/jetbrains/intellij/build/MacDistributionCustomizer.groovy
build/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/ProductProperties.groovy
build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy
build/groovy/org/jetbrains/intellij/build/WindowsDistributionCustomizer.groovy
build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/LayoutBuilder.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.groovy
build/groovy/org/jetbrains/intellij/build/impl/MacDistributionBuilder.groovy
build/groovy/org/jetbrains/intellij/build/impl/PluginLayout.groovy [new file with mode: 0644]
build/groovy/org/jetbrains/intellij/build/impl/WinExeInstallerBuilder.groovy
build/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy
java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java
java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/source/JavaFileElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaSharedImplUtil.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResourcesWithMultipleCloseInterfaces.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ConstructorReferences.java [new file with mode: 0644]
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/VarargPosition.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/daemon/HighlightStressTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk8Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk9Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/ChangeSignatureTouchLambdaTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/ConstraintsInferenceMiscTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FunctionalExpressionIncompleteHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FunctionalTypeWildcardParameterizationTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/InferencePerformanceTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8ExpressionsCheckTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Java8RegressionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaRedundantCastTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MethodRefHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewInferenceCollectingAdditionalConstraintsTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionFromFieldInitializerToConstructorThrowsTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToCatchTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Anonymous2LambdaInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Anonymous2MethodReferenceInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ChangeMethodSignatureFromUsage8Test.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/GeneralizeCatchTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Lambda2MethodReferenceInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaCodeBlockInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RedundantTypeArgsInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceFromOfNullableFixTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithOfNullableFixTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Simplify2DiamondInspectionsTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/StreamApiMigrationInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/TrivialFunctionalExpressionUsageInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/TrivialMethodReferenceInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapLongWithMathToIntExactFixTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapObjectWithOptionalFixTest.java
java/java-tests/testSrc/com/intellij/codeInsight/intention/MergeFilterChainActionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitFilterActionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/psi/AnnotatedTypeTest.groovy
java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/MagicConstantInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast15Test.java
java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast18Test.java
java/java-tests/testSrc/com/intellij/codeInspection/RedundantThrowTest.java
java/java-tests/testSrc/com/intellij/codeInspection/SimplifyStreamApiCallChainsInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/StringTokenizerDelimiterInspectionTest.java
java/java-tests/testSrc/com/intellij/codeInspection/UnusedReturnValueTest.java
java/java-tests/testSrc/com/intellij/ide/util/JavaSuperMethodTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/AbstractJavaFormatterTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java
java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaIndenterTest.java
java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObject4DebuggerTest.java
java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObjectTest.java
java/java-tests/testSrc/com/intellij/refactoring/IntroduceFunctionalParameterTest.java
java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
java/java-tests/testSrc/com/intellij/refactoring/PushDownTest.java
java/java-tests/testSrc/com/intellij/refactoring/RenameSuggestionsTest.groovy
java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
java/mockJDK-1.8/jre/lib/rt.jar
java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java
json/src/com/jetbrains/jsonSchema/extension/JsonSchemaFileProvider.java
json/src/com/jetbrains/jsonSchema/extension/JsonSchemaImportedProviderFactory.java
json/src/com/jetbrains/jsonSchema/extension/JsonSchemaProjectSelfProviderFactory.java
json/tests/test/com/jetbrains/jsonSchema/JsonSchemaTestProvider.java
lib/annotations/jdk/java/math/annotations.xml [new file with mode: 0644]
platform/boot/src/com/intellij/concurrency/IdeaForkJoinWorkerThreadFactory.java
platform/built-in-server/src/org/jetbrains/builtInWebServer/BuiltInWebServer.kt
platform/diff-api/src/com/intellij/diff/DiffContentFactory.java
platform/diff-impl/src/com/intellij/diff/DiffContentFactoryImpl.java
platform/diff-impl/src/com/intellij/diff/actions/CompareClipboardWithSelectionAction.java
platform/diff-impl/src/com/intellij/diff/actions/DocumentFragmentContent.java
platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java
platform/lang-impl/src/com/intellij/ide/bookmarks/BookmarkManager.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesDialog.java
platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionDifferenceModel.java
platform/platform-api/src/com/intellij/ide/passwordSafe/PasswordSafe.java
platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java
platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfMemoryErrorAction.java
platform/platform-impl/src/com/intellij/ide/CharToVKeyMap.java
platform/platform-impl/src/com/intellij/ide/GeneralSettingsPanel.form
platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeSettings.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtils.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java
platform/platform-impl/src/com/intellij/openapi/util/io/fileUtil.kt
platform/platform-resources-en/src/messages/IdeBundle.properties
platform/platform-tests/testSrc/com/intellij/ide/passwordSafe/impl/providers/masterKey/windows/WindowsCryptUtilTest.java
platform/script-debugger/backend/src/SuspendContextManager.kt
platform/script-debugger/debugger-ui/src/DebugProcessImpl.kt
platform/script-debugger/protocol/protocol-model-generator/src/TypeMap.kt
platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/OutMessage.kt
platform/usageView/src/com/intellij/usages/impl/GroupNode.java
platform/usageView/src/com/intellij/usages/impl/Node.java
platform/usageView/src/com/intellij/usages/impl/SyntaxHighlighterOverEditorHighlighter.java
platform/usageView/src/com/intellij/usages/impl/UsageFilteringRuleProviderImpl.java
platform/usageView/src/com/intellij/usages/impl/UsageGroupingRuleProviderImpl.java
platform/usageView/src/com/intellij/usages/impl/UsageNode.java
platform/usageView/src/com/intellij/usages/impl/UsageNodeTreeBuilder.java
platform/usageView/src/com/intellij/usages/impl/UsageViewImpl.java
platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java
platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
platform/usageView/src/com/intellij/usages/impl/UsageViewTreeModelBuilder.java
platform/util/src/com/intellij/util/containers/SmartHashSet.java
platform/util/src/com/intellij/util/containers/WeakHashMap.java
platform/util/src/com/intellij/util/io/storage/HeavyProcessLatch.java
platform/vcs-impl/src/com/intellij/openapi/vcs/ex/ShowLineStatusRangeDiffAction.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ExceptionUtils.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/SingleStatementInBlockInspection.java
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ElseWithLoop.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/ElseWithLoop.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse3.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfElse3.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfWithLoop.after.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igfixes/single_statement_block/IfWithLoop.java [new file with mode: 0644]
plugins/InspectionGadgets/test/com/siyeh/igtest/naming/standard_variable_names/StandardVariableNames.java
plugins/InspectionGadgets/test/com/siyeh/igtest/naming/standard_variable_names/expected.xml
plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/AssertWithSideEffectsInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/FinalPrivateMethodInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/braces/SingleStatementInBlockFixTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/AbstractMethodOverridesAbstractMethodInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/InterfaceNeverImplementedInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/ProblematicWhitespaceInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryFinalOnLocalVariableOrParameterInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessaryFullyQualifiedNameInspectionTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/visibility/MethodOverloadsParentMethodInspectionTest.java
plugins/commander/src/com/intellij/ide/commander/PsiDiffContentFactory.java
plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java
plugins/terminal/terminal.iml
python/testData/testRunner/env/pytest/test1.py

index ed1055dc6897c8ca2ecf09eea08e79c4ee855142..cb305c8a5eb09e274a2d45cd1d61085c5fe21fbb 100644 (file)
@@ -15,6 +15,8 @@
  */
 package org.jetbrains.intellij.build
 
+import com.intellij.openapi.util.text.StringUtil
+
 import java.text.MessageFormat
 
 /**
@@ -30,6 +32,7 @@ class ApplicationInfoProperties {
   final String minorVersionMainPart
   final String productName
   final String companyName
+  final String shortCompanyName
   final boolean isEAP
 
   @SuppressWarnings(["GrUnresolvedAccess", "GroovyAssignabilityCheck"])
@@ -45,6 +48,7 @@ class ApplicationInfoProperties {
     companyName = root.company.first().@name
     minorVersionMainPart = minorVersion.takeWhile { it != '.' }
     isEAP = Boolean.parseBoolean(root.version.first().@eap)
+    shortCompanyName = StringUtil.trimEnd(companyName, "s.r.o.").trim()
   }
 
   public String getUpperCaseProductName() { shortProductName.toUpperCase() }
index 50fdfa225dddb9252a001ac5db87217aae6a0746..c4c20b20f765e86462bb18926710446fe89c6277 100644 (file)
@@ -64,12 +64,18 @@ abstract class BuildContext {
    */
   List<String> bootClassPathJarNames
 
+  abstract boolean includeBreakGenLibraries()
+
+  abstract String getAdditionalJvmArguments()
+
   abstract void notifyArtifactBuilt(String artifactPath)
 
   abstract File findApplicationInfoInSources()
 
   abstract JpsModule findApplicationInfoModule()
 
+  abstract JpsModule findRequiredModule(String name)
+
   abstract JpsModule findModule(String name)
 
   abstract void signExeFile(String path)
index 1882bc0a20c27bb8b6e1ebbaf68f40afc3b9ec6e..ca8510415a64bcec2652f9096a44eaade736fec0 100644 (file)
@@ -16,6 +16,7 @@
 package org.jetbrains.intellij.build
 
 import org.jetbrains.intellij.build.impl.BuildTasksImpl
+import org.jetbrains.intellij.build.impl.PluginLayout
 
 /**
  * @author nik
@@ -53,10 +54,14 @@ abstract class BuildTasks {
    */
   abstract void buildDistributions()
 
+  abstract void compileModulesAndBuildDistributions(List<PluginLayout> allPlugins)
+
   abstract void cleanOutput()
 
   abstract void compileProjectAndTests(List<String> includingTestsInModules)
 
+  abstract void compileModules(List<String> moduleNames, List<String> includingTestsInModules = [])
+
   public static BuildTasks create(BuildContext context) {
     return new BuildTasksImpl(context)
   }
diff --git a/build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy b/build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy
new file mode 100644 (file)
index 0000000..dab0cb9
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ */
+/*
+ * 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 org.jetbrains.intellij.build
+
+import org.jetbrains.intellij.build.impl.PluginLayout
+
+import static org.jetbrains.intellij.build.impl.PluginLayout.plugin
+
+/**
+ * @author nik
+ */
+class CommunityRepositoryModules {
+  static List<String> PLATFORM_API_MODULES = [
+    "analysis-api",
+    "built-in-server-api",
+    "core-api",
+    "diff-api",
+    "dvcs-api",
+    "editor-ui-api",
+    "external-system-api",
+    "indexing-api",
+    "jps-model-api",
+    "lang-api",
+    "lvcs-api",
+    "platform-api",
+    "projectModel-api",
+    "remote-servers-agent-rt",
+    "remote-servers-api",
+    "usageView",
+    "vcs-api-core",
+    "vcs-api",
+    "vcs-log-api",
+    "vcs-log-graph-api",
+    "xdebugger-api",
+    "xml-analysis-api",
+    "xml-openapi",
+    "xml-psi-api",
+    "xml-structure-view-api"
+  ]
+
+  static List<String> PLATFORM_IMPLEMENTATION_MODULES = [
+    "analysis-impl",
+    "built-in-server",
+    "core-impl",
+    "diff-impl",
+    "dvcs-impl",
+    "editor-ui-ex",
+    "images",
+    "indexing-impl",
+    "jps-model-impl",
+    "jps-model-serialization",
+    "json",
+    "lang-impl",
+    "lvcs-impl",
+    "platform-impl",
+    "projectModel-impl",
+    "protocol-reader-runtime",
+    "RegExpSupport",
+    "relaxng",
+    "remote-servers-impl",
+    "script-debugger-backend",
+    "script-debugger-ui",
+    "smRunner",
+    "spellchecker",
+    "structure-view-impl",
+    "testRunner",
+    "vcs-impl",
+    "vcs-log-graph",
+    "vcs-log-impl",
+    "xdebugger-impl",
+    "xml-analysis-impl",
+    "xml-psi-impl",
+    "xml-structure-view-impl",
+    "xml",
+    "configuration-store-impl",
+  ]
+
+  /**
+   * Specifies layout for all plugins which sources are located in 'community' and 'contrib' repositories
+   */
+  static List<PluginLayout> COMMUNITY_REPOSITORY_PLUGINS = [
+    plugin("copyright"),
+    plugin("java-i18n"),
+    plugin("hg4idea"),
+    plugin("github"),
+    plugin("ant") {
+      mainJarName = "antIntegration.jar"
+      withModule("ant-jps-plugin")
+    },
+    plugin("ui-designer") {
+      directoryName = "uiDesigner"
+      mainJarName = "uiDesigner.jar"
+      withJpsModule("ui-designer-jps-plugin")
+    },
+    plugin("properties") {
+      withModule("properties-psi-api", "properties.jar")
+      withModule("properties-psi-impl", "properties.jar")
+    },
+    plugin("git4idea") {
+      withModule("git4idea-rt", "git4idea-rt.jar", false)
+      withOptionalModule("remote-servers-git")
+      withOptionalModule("remote-servers-git-java", "remote-servers-git.jar")
+    },
+    plugin("svn4idea") {
+      withResource("lib/licenses", "lib/licenses")
+      withResource("lib/sqljetsrc.zip", "lib")
+      withResource("lib/svnkit-javahl16.zip", "lib")
+      withResource("lib/trileadsrc.zip", "lib")
+    },
+    plugin("cvs-plugin") {
+      directoryName = "cvsIntegration"
+      mainJarName = "cvsIntegration.jar"
+      withModule("javacvs-src")
+      withModule("smartcvs-src")
+      withModule("cvs-core", "cvs_util.jar")
+    },
+    plugin("xpath") {
+      withModule("xslt-rt", "rt/xslt-rt.jar")
+    },
+    plugin("tasks-core") {
+      directoryName = "tasks"
+      withModule("tasks-api")
+      withModule("jira")
+      withOptionalModule("tasks-java")
+      doNotCreateSeperateJarForLocalizableResources()
+    },
+    plugin("terminal") {
+      withResource("lib/jediterm.in", "lib")
+    },
+    plugin("editorconfig"),
+    plugin("coverage"),
+    plugin("yaml"),
+    plugin("xslt-debugger") {
+      withModule("xslt-debugger-engine")
+      withModule("xslt-debugger-engine-impl", "rt/xslt-debugger-engine-impl.jar")
+      withModuleLibrary("Saxon-6.5.5", "xslt-debugger-engine-impl", "rt")
+      withModuleLibrary("Saxon-9HE", "xslt-debugger-engine-impl", "rt")
+      withModuleLibrary("Xalan-2.7.1", "xslt-debugger-engine-impl", "rt")
+      //todo[nik] unmark 'lib' directory as source root instead
+      excludeFromModule("xslt-debugger-engine-impl", "rmi-stubs.jar")
+      excludeFromModule("xslt-debugger-engine-impl", "saxon.jar")
+      excludeFromModule("xslt-debugger-engine-impl", "saxon9he.jar")
+      excludeFromModule("xslt-debugger-engine-impl", "serializer.jar")
+      excludeFromModule("xslt-debugger-engine-impl", "xalan.jar")
+    },
+    plugin("settings-repository")
+  ]
+}
\ No newline at end of file
index 080e899b92fcce3986b230cbf9c33a3301ec1470..6e15ed2290c12097fa3716418facb5b09a65dd68 100644 (file)
@@ -29,11 +29,6 @@ class IdeaCommunityProperties extends ProductProperties {
     buildCrossPlatformDistribution = true
   }
 
-  @Override
-  String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) {
-    "IntelliJ IDEA Community Edition"
-  }
-
   @Override
   void copyAdditionalFiles(BuildContext buildContext, String targetDirectory) {
     buildContext.ant.copy(todir: targetDirectory) {
@@ -57,6 +52,12 @@ class IdeaCommunityProperties extends ProductProperties {
       @Override
       String rootDirectoryName(String buildNumber) { "" }
 
+      @Override
+      String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { "IntelliJ IDEA Community Edition" }
+
+      @Override
+      String fullNameIncludingEditionAndVendor(ApplicationInfoProperties applicationInfo) { "IntelliJ IDEA Community Edition" }
+
       @Override
       String uninstallFeedbackPageUrl(ApplicationInfoProperties applicationInfo) {
         "https://www.jetbrains.com/idea/uninstall/?edition=IC-${applicationInfo.majorVersion}.${applicationInfo.minorVersion}"
@@ -82,6 +83,7 @@ class IdeaCommunityProperties extends ProductProperties {
       {
         helpId = "IJ"
         urlSchemes = ["idea"]
+        associateIpr = true
         enableYourkitAgentInEAP = false
         bundleIdentifier = "com.jetbrains.intellij.ce"
         dmgImagePath = "$projectHome/build/conf/mac/communitydmg.png"
index fea25a526f6236eca11ed4871bc615220a67ea4f..72f13f6e71235d73dc8ae6b333bac3474071fa78 100644 (file)
@@ -29,10 +29,15 @@ abstract class MacDistributionCustomizer {
    */
   String minOSXVersion = "10.8"
   String helpId = ""
-  String docTypes = null
+  String additionalDocTypes = ""
   List<String> urlSchemes = []
   List<String> architectures = ["x86_64"]
 
+  /**
+   * If {@code true} *.ipr files will be associated with the product in Info.plist
+   */
+  boolean associateIpr = false
+
   /**
    * If {@code true} YourKit agent will be automatically attached when an EAP build of the product starts under Mac OS. This property is
    * taken into account only if {@link ProductProperties#enableYourkitAgentInEAP} is {@code true}.
@@ -58,6 +63,8 @@ abstract class MacDistributionCustomizer {
 
   abstract String rootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber)
 
+  Map<String, String> customIdeaProperties(ApplicationInfoProperties applicationInfo) { [:] }
+
   void copyAdditionalFiles(BuildContext context, String targetDirectory) {
   }
 }
diff --git a/build/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy b/build/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy
new file mode 100644 (file)
index 0000000..b50770a
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+/*
+ * 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 org.jetbrains.intellij.build
+
+import org.jetbrains.intellij.build.impl.PluginLayout
+
+/**
+ * @author nik
+ */
+class ProductModulesLayout {
+  /**
+   * Name of the main product JAR file. Outputs of {@link #platformImplementationModules} will be packed into it.
+   */
+  String mainJarName
+
+  /**
+   * Names of the modules which need to be packed into openapi.jar in the product's 'lib' directory.
+   * @see CommunityRepositoryModules#PLATFORM_API_MODULES
+   */
+  List<String> platformApiModules = []
+
+  /**
+   * Names of the modules which need to be included into {@link #mainJarName} in the product's 'lib' directory
+   * @see CommunityRepositoryModules#PLATFORM_IMPLEMENTATION_MODULES
+   */
+  List<String> platformImplementationModules = []
+
+  /**
+   * Names of the main modules (containing META-INF/plugin.xml) of the plugins which need to be bundled with the product. It may also
+   * includes names of optional modules from these plugins which need to be included into the plugin distribution for this product.
+   */
+  List<String> bundledPluginModules = []
+
+  /**
+   * Names of the main modules (containing META-INF/plugin.xml) of the plugins which aren't bundled with the product but may be installed
+   * into it. Zip archives of these plugins will be built and placed under 'plugins' directory in the build artifacts.
+   */
+  List<String> pluginModulesToPublish = []
+
+  /**
+   * Paths to JAR files which contents should be extracted into {@link #mainJarName} JAR.
+   */
+  List<String> additionalJarsToUnpackIntoMainJar = []
+
+  /**
+   * Maps names of the modules to names of JARs; these modules will be packed into these JARs and copied to the product's 'lib' directory.
+   */
+  Map<String, String> additionalPlatformModules = [:]
+
+
+  /**
+   * Name of the module which classpath will be used to build searchable options index
+   */
+  String mainModule
+
+  /**
+   * Name of the module containing search/searchableOptions.xml file.
+   * //todo[nik] make this optional
+   */
+  String searchableOptionsModule
+
+  /**
+   * Paths to license files which are required to start IDE in headless mode to generate searchable options index
+   */
+  List<String> licenseFilesToBuildSearchableOptions = []
+
+  /**
+   * @param allPlugins descriptions of layout of all plugins which may be included into the product
+   * @return list of all modules which output is included into the product platform's JARs or the plugin's JARs
+   */
+  List<String> getIncludedModules(List<PluginLayout> allPlugins) {
+    Set<String> enabledPluginModules = getEnabledPluginModules()
+    def allPluginModules = allPlugins.findAll { enabledPluginModules.contains(it.mainModule) }.collectMany { it.getActualModules(enabledPluginModules).values() }
+    ((allPluginModules + platformApiModules + platformImplementationModules + additionalPlatformModules.keySet()) as Set<String>) as List<String>
+  }
+
+  Set<String> getEnabledPluginModules() {
+    (bundledPluginModules + pluginModulesToPublish) as Set<String>
+  }
+}
\ No newline at end of file
index 0e282ab003553189b8475a93d242ac87ab365637..d32f749a3be8ade2064aba03f95bac3d13008336 100644 (file)
@@ -39,6 +39,8 @@ public abstract class ProductProperties {
    */
   String applicationInfoModule
 
+  String brandingModule
+
   /**
    * Name of the sh/bat script (without extension) which will contain the commands to run IDE in 'offline inspections' mode
    */
@@ -54,17 +56,39 @@ public abstract class ProductProperties {
    */
   String additionalIdeJvmArguments = ""
 
-  /**
-   * @return name of the product which will be shown in Windows Installer
-   */
-  String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { applicationInfo.productName }
-
   /**
    * An identifier which will be used to form names for directories where configuration and caches will be stored, usually a product name
    * without spaces with added version ('IntelliJIdea2016.1' for IntelliJ IDEA 2016.1)
    */
   abstract String systemSelector(ApplicationInfoProperties applicationInfo)
 
+  /**
+   * If {@code true} Alt+Button1 shortcut will be removed from 'Quick Evaluate Expression' action and assigned to 'Add/Remove Caret' action
+   * (instead of Alt+Shift+Button1) in the default keymap
+   */
+  boolean reassignAltClickToMultipleCarets = false
+
+  /**
+   * If {@code true} a txt file containing information (in Atlassian Confluence format) about third-party libraries used in the product
+   * will be generated.
+   */
+  boolean generateLibrariesLicensesTable = true
+
+  /**
+   * List of licenses information about all libraries which can be used in the product modules
+   */
+  List<LibraryLicense> allLibraryLicenses = CommunityLibraryLicenses.LICENSES_LIST
+
+  /**
+   * If {@code true} the main product JAR file will be scrambled using {@link BuildContext#scrambleTool}
+   */
+  boolean scrambleMainJar = false
+
+  /**
+   * Described which modules should be included into the product's platform and which plugins should be bundled with the product
+   */
+  ProductModulesLayout productLayout = new ProductModulesLayout()
+
   /**
    * If {@code true} cross-platform ZIP archive containing binaries for all OS will be built
    */
@@ -115,6 +139,12 @@ public abstract class ProductProperties {
 
   List<String> excludedPlugins = []
 
+  /**
+   * Prefix for names of environment variables used by Windows and Linux distributions to allow users customize location of the product JDK
+   * (&lt;PRODUCT&gt;_JDK variable), *.vmoptions file (&lt;PRODUCT&gt;_VM_OPTIONS variable), idea.properties file (&lt;PRODUCT&gt;_PROPERTIES variable)
+   */
+  String environmentVariableBaseName(ApplicationInfoProperties applicationInfo) { applicationInfo.upperCaseProductName }
+
   /**
    * Override this method to copy additional files to distributions of all operating systems.
    */
index 520ae6cdd2766a29a9bd629b7bc2de47b01a7fbd..a885565770f6b5d01dd2cf10872a556d4c01d423 100644 (file)
@@ -22,8 +22,18 @@ package org.jetbrains.intellij.build
  * @author nik
  */
 interface ScrambleTool {
+  /**
+   * @return list of modules used by the tool which need to be compiled before {@link #scramble} method is invoked
+   */
+  List<String> getAdditionalModulesToCompile()
+
   /**
    * Scramble {@code mainJarName} in {@code "$buildContext.paths.distAll/lib"} directory
    */
   void scramble(String mainJarName, BuildContext buildContext)
+
+  /**
+   * @return list of names of JAR files which cannot be included into the product 'lib' directory in plain form
+   */
+  List<String> getNamesOfJarsRequiredToBeScrambled()
 }
\ No newline at end of file
index ef315aaa7dfa520701552923e103b56faa2704b6..cfd30127d2039b9a6d39423c6e7d667eba96664c 100644 (file)
@@ -61,6 +61,16 @@ abstract class WindowsDistributionCustomizer {
    */
   void copyAdditionalFiles(BuildContext context, String targetDirectory) {}
 
+  /**
+   * The returned name will be shown in Windows Installer and used in Registry keys
+   */
+  String fullNameIncludingEdition(ApplicationInfoProperties applicationInfo) { applicationInfo.productName }
+
+  /**
+   * The returned name will be used to create links on Desktop
+   */
+  String fullNameIncludingEditionAndVendor(ApplicationInfoProperties applicationInfo) { applicationInfo.shortCompanyName + " " + applicationInfo.productName }
+
   String uninstallFeedbackPageUrl(ApplicationInfoProperties applicationInfo) {
     return null
   }
index 0563de6aa82cce36e2690e3d7124b1be6fde6706..462928272916e704e82d02f4e96a2fbb941c55e8 100644 (file)
@@ -163,9 +163,14 @@ class BuildContextImpl extends BuildContext {
 
   @Override
   JpsModule findApplicationInfoModule() {
-    def module = findModule(productProperties.applicationInfoModule)
+    return findRequiredModule(productProperties.applicationInfoModule)
+  }
+
+  @Override
+  JpsModule findRequiredModule(String name) {
+    def module = findModule(name)
     if (module == null) {
-      messages.error("Cannot find module '$productProperties.applicationInfoModule' containing ApplicationInfo.xml file")
+      messages.error("Cannot find required module '$name' in the project")
     }
     return module
   }
@@ -196,6 +201,31 @@ class BuildContextImpl extends BuildContext {
     }
   }
 
+  @Override
+  boolean includeBreakGenLibraries() {
+    def productLayout = productProperties.productLayout
+    return productLayout.mainJarName == null || //todo[nik] remove this condition later
+           productLayout.additionalPlatformModules.containsKey("java-runtime")
+  }
+
+  @Override
+  String getAdditionalJvmArguments() {
+    String jvmArgs
+    if (productProperties.platformPrefix != null
+//todo[nik] remove later. This is added to keep the current behavior (platform prefix for CE is set in MainImpl anyway)
+      && productProperties.platformPrefix != "Idea") {
+      jvmArgs = "-Didea.platform.prefix=${productProperties.platformPrefix}"
+    }
+    else {
+      jvmArgs = ""
+    }
+    jvmArgs += " $productProperties.additionalIdeJvmArguments".trim()
+    if (productProperties.toolsJarRequired) {
+      jvmArgs += " -Didea.jre.check=true"
+    }
+    return jvmArgs.trim()
+  }
+
   @Override
   void notifyArtifactBuilt(String artifactPath) {
     if (!underTeamCity) return
index 9423700566422b9f6e0834aa7ec77d8228e3889b..ea9bfdf940e0581af62a66ebdaf8ab8a1e6e57aa 100644 (file)
@@ -19,9 +19,6 @@ import com.intellij.openapi.util.io.FileUtil
 import org.jetbrains.intellij.build.BuildContext
 import org.jetbrains.intellij.build.BuildOptions
 import org.jetbrains.intellij.build.BuildTasks
-import org.jetbrains.intellij.build.LinuxDistributionCustomizer
-import org.jetbrains.intellij.build.MacDistributionCustomizer
-import org.jetbrains.intellij.build.WindowsDistributionCustomizer
 import org.jetbrains.jps.model.java.JavaResourceRootType
 import org.jetbrains.jps.model.java.JavaSourceRootType
 import org.jetbrains.jps.model.module.JpsModule
@@ -86,9 +83,13 @@ class BuildTasksImpl extends BuildTasks {
     }
   }
 
-//todo[nik] do we need 'cp' and 'jvmArgs' parameters?
   @Override
   void buildSearchableOptions(String targetModuleName, List<String> modulesToIndex, List<String> pathsToLicenses) {
+    buildSearchableOptions(new File(buildContext.projectBuilder.moduleOutput(buildContext.findModule(targetModuleName))), modulesToIndex, pathsToLicenses)
+  }
+
+//todo[nik] do we need 'cp' and 'jvmArgs' parameters?
+  void buildSearchableOptions(File targetDirectory, List<String> modulesToIndex, List<String> pathsToLicenses) {
     //todo[nik] create searchableOptions.xml in a separate directory instead of modifying it in the module output
     buildContext.executeStep("Build searchable options index", BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP, {
       def javaRuntimeClasses = "${buildContext.projectBuilder.moduleOutput(buildContext.findModule("java-runtime"))}"
@@ -98,8 +99,7 @@ class BuildTasksImpl extends BuildTasks {
 
       buildContext.messages.progress("Building searchable options for modules $modulesToIndex")
 
-      def targetModuleOutput = buildContext.projectBuilder.moduleOutput(buildContext.findModule(targetModuleName))
-      String targetFile = "$targetModuleOutput/search/searchableOptions.xml"
+      String targetFile = "${targetDirectory.absolutePath}/search/searchableOptions.xml"
       FileUtil.delete(new File(targetFile))
 
       def tempDir = "$buildContext.paths.temp/searchableOptions"
@@ -123,6 +123,9 @@ class BuildTasksImpl extends BuildTasks {
         sysproperty(key: "idea.home.path", value: buildContext.paths.projectHome)
         sysproperty(key: "idea.system.path", value: systemPath)
         sysproperty(key: "idea.config.path", value: configPath)
+        if (buildContext.productProperties.platformPrefix != null) {
+          sysproperty(key: "idea.platform.prefix", value: buildContext.productProperties.platformPrefix)
+        }
         arg(value: "$classpathFile")
         arg(line: "com.intellij.idea.Main traverseUI")
         arg(value: targetFile)
@@ -244,6 +247,26 @@ idea.fatal.error.notification=disabled
     }
   }
 
+  @Override
+  void compileModulesAndBuildDistributions(List<PluginLayout> allPlugins) {
+    def productLayout = buildContext.productProperties.productLayout
+    cleanOutput()
+    def includedModules = productLayout.getIncludedModules(allPlugins)
+    compileModules(includedModules)
+    buildContext.messages.block("Build platform and plugin JARs") {
+      new DistributionJARsBuilder(buildContext, includedModules, allPlugins).buildJARs()
+    }
+    if (buildContext.productProperties.scrambleMainJar) {
+      if (buildContext.scrambleTool != null) {
+        buildContext.scrambleTool.scramble(buildContext.productProperties.productLayout.mainJarName, buildContext)
+      }
+      else {
+        buildContext.messages.warning("Scrambling skipped: 'srambleTool' isn't defined")
+      }
+    }
+    buildDistributions()
+  }
+
   @Override
   void cleanOutput() {
     buildContext.messages.block("Clean output") {
@@ -262,6 +285,11 @@ idea.fatal.error.notification=disabled
 
   @Override
   void compileProjectAndTests(List<String> includingTestsInModules = []) {
+    compileModules(null, includingTestsInModules)
+  }
+
+  @Override
+  void compileModules(List<String> moduleNames, List<String> includingTestsInModules = []) {
     if (buildContext.options.useCompiledClassesFromProjectOutput) {
       buildContext.messages.info("Compilation skipped, the compiled classes from the project output will be used")
       return
@@ -272,7 +300,18 @@ idea.fatal.error.notification=disabled
     }
 
     buildContext.projectBuilder.cleanOutput()
-    buildContext.projectBuilder.buildProduction()
+    if (moduleNames == null) {
+      buildContext.projectBuilder.buildProduction()
+    }
+    else {
+      List<String> modulesToBuild = ((moduleNames as Set<String>) + DistributionJARsBuilder.ADDITIONAL_MODULES_TO_COMPILE
+        + buildContext.scrambleTool?.additionalModulesToCompile ?: []) as List<String>
+      List<String> invalidModules = modulesToBuild.findAll {buildContext.findModule(it) == null}
+      if (!invalidModules.empty) {
+        buildContext.messages.warning("The following modules won't be compiled: $invalidModules")
+      }
+      buildContext.projectBuilder.buildModules(modulesToBuild.collect {buildContext.findModule(it)}.findAll {it != null})
+    }
     for (String moduleName : includingTestsInModules) {
       buildContext.projectBuilder.makeModuleTests(buildContext.findModule(moduleName))
     }
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy b/build/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy
new file mode 100644 (file)
index 0000000..797f44f
--- /dev/null
@@ -0,0 +1,405 @@
+/*
+ * 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.
+ */
+/*
+ * 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 org.jetbrains.intellij.build.impl
+
+import com.intellij.openapi.util.io.FileUtil
+import com.intellij.util.PathUtilRt
+import org.jetbrains.intellij.build.BuildContext
+import org.jetbrains.intellij.build.BuildOptions
+import org.jetbrains.jps.model.java.JpsJavaClasspathKind
+import org.jetbrains.jps.model.java.JpsJavaExtensionService
+import org.jetbrains.jps.model.module.JpsLibraryDependency
+import org.jetbrains.jps.model.module.JpsModule
+import org.jetbrains.jps.util.JpsPathUtil
+
+/**
+ * @author nik
+ */
+class DistributionJARsBuilder {
+  public static final List<String> ADDITIONAL_MODULES_TO_COMPILE = [
+    "java-runtime",//required to build searchable options index
+    "colorSchemes", "platform-resources", "platform-resources-en", "boot", "icons", "forms_rt", "bootstrap"
+  ]
+  private static final boolean COMPRESS_JARS = false
+  private static final String RESOURCES_INCLUDED = "resources.included"
+  private static final String RESOURCES_EXCLUDED = "resources.excluded"
+  private final BuildContext buildContext
+  private final List<PluginLayout> allPlugins
+  private final Set<String> usedModules = new LinkedHashSet<>()
+  private final List<String> includedModules
+
+  DistributionJARsBuilder(BuildContext buildContext, List<String> includedModules, List<PluginLayout> allPlugins) {
+    this.includedModules = includedModules
+    this.buildContext = buildContext
+    this.allPlugins = allPlugins
+    buildContext.ant.patternset(id: RESOURCES_INCLUDED) {
+      include(name: "**/*.properties")
+      include(name: "fileTemplates/**/*")
+      include(name: "inspectionDescriptions/**/*")
+      include(name: "intentionDescriptions/**/*")
+      include(name: "tips/**/*")
+      include(name: "search/**/*")
+    }
+
+    buildContext.ant.patternset(id: RESOURCES_EXCLUDED) {
+      exclude(name: "**/*.properties")
+      exclude(name: "fileTemplates/**/*")
+      exclude(name: "fileTemplates")
+      exclude(name: "inspectionDescriptions/**/*")
+      exclude(name: "inspectionDescriptions")
+      exclude(name: "intentionDescriptions/**/*")
+      exclude(name: "intentionDescriptions")
+      exclude(name: "tips/**/*")
+      exclude(name: "tips")
+    }
+  }
+
+  void buildJARs() {
+    buildLib()
+    buildPlugins()
+
+    def productProperties = buildContext.productProperties
+    if (productProperties.generateLibrariesLicensesTable) {
+      buildContext.messages.block("Generate table of licenses for used third-party libraries") {
+        def generator = new LibraryLicensesListGenerator(buildContext.projectBuilder, buildContext.project, productProperties.allLibraryLicenses)
+        generator.generateLicensesTable("$buildContext.paths.artifacts/${buildContext.applicationInfo.productName}-third-party-libraries.txt", usedModules)
+      }
+    }
+
+    if (productProperties.scrambleMainJar) {
+      createLayoutBuilder().layout(buildContext.paths.artifacts) {
+        jar("internalUtilities.jar") {
+          module("internalUtilities")
+        }
+      }
+    }
+  }
+
+  private void buildLib() {
+    def ant = buildContext.ant
+    def layoutBuilder = createLayoutBuilder()
+    def productLayout = buildContext.productProperties.productLayout
+    def searchableOptionsDir = new File(buildContext.paths.temp, "searchableOptions/result")
+
+    //todo[nik] move buildSearchableOptions and patchedApplicationInfo methods to this class
+    def buildTasks = new BuildTasksImpl(buildContext)
+    buildTasks.buildSearchableOptions(searchableOptionsDir, [productLayout.mainModule], productLayout.licenseFilesToBuildSearchableOptions)
+    if (!buildContext.options.buildStepsToSkip.contains(BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP)) {
+      layoutBuilder.patchModuleOutput(productLayout.searchableOptionsModule, FileUtil.toSystemIndependentName(searchableOptionsDir.absolutePath))
+    }
+
+    def applicationInfoFile = FileUtil.toSystemIndependentName(buildTasks.patchApplicationInfo().absolutePath)
+    def applicationInfoDir = "$buildContext.paths.temp/applicationInfo"
+    ant.copy(file: applicationInfoFile, todir: "$applicationInfoDir/idea")
+    layoutBuilder.patchModuleOutput(buildContext.productProperties.applicationInfoModule, applicationInfoDir)
+
+    if (buildContext.productProperties.reassignAltClickToMultipleCarets) {
+      def patchedKeyMapDir = createKeyMapWithAltClickReassignedToMultipleCarets()
+      layoutBuilder.patchModuleOutput("platform-resources", FileUtil.toSystemIndependentName(patchedKeyMapDir.absolutePath))
+    }
+
+    Set<String> usedJars = collectUsedJars(includedModules, []) - productLayout.additionalJarsToUnpackIntoMainJar.collect {FileUtil.toSystemIndependentName(it)}
+
+    if (buildContext.scrambleTool != null) {
+      def forbiddenJarNames = buildContext.scrambleTool.namesOfJarsRequiredToBeScrambled
+      def forbiddenJars = usedJars.findAll { forbiddenJarNames.contains(PathUtilRt.getFileName(it)) }
+      if (!forbiddenJars.empty) {
+        buildContext.messages.error("The following JARs cannot be included into the product 'lib' directory, they need to be scrambled with the main jar: ${forbiddenJars}")
+      }
+    }
+
+    def communityHome = "$buildContext.paths.communityHome"
+    def resourcesIncluded = RESOURCES_INCLUDED
+    def resourcesExcluded = RESOURCES_EXCLUDED
+
+    layoutBuilder.layout("$buildContext.paths.distAll/lib") {
+      jar("util.jar") {
+        module("util")
+        module("util-rt")
+      }
+      jar("openapi.jar") {
+        productLayout.platformApiModules.each { module it }
+      }
+
+      jar("annotations.jar") {
+        module("annotations-common")
+        module("annotations")
+      }
+      jar("extensions.jar") { module("extensions") }
+      jar("bootstrap.jar") { module("bootstrap") }
+      jar("resources.jar", true) {
+        modulePatches(["platform-resources"])
+        module("colorSchemes")
+        module("platform-resources")
+      }
+
+      jar("forms_rt.jar") { module("forms_rt") }
+
+      productLayout.additionalPlatformModules.entrySet().findAll { it.value != "resources_en.jar" }.each {
+        def moduleName = it.key
+        jar(it.value) {
+          module(moduleName)
+        }
+      }
+
+      jar("resources_en.jar", true) {
+        productLayout.additionalPlatformModules.entrySet().findAll { it.value == "resources_en.jar"}.each {
+          modulePatches([it.key])
+          module(it.key)
+        }
+        module("platform-resources-en")
+        module("coverage-common") {
+          ant.patternset(refid: resourcesIncluded)
+        }
+      }
+
+      jar("icons.jar") { module("icons") }
+      jar("boot.jar") { module("boot") }
+      projectLibrary("KotlinJavaRuntime")
+
+      jar(productLayout.mainJarName, true, false) {
+        modulePatches(productLayout.platformImplementationModules)
+        productLayout.platformImplementationModules.each { module it }
+        module("coverage-common") {
+          ant.patternset(refid: resourcesExcluded)
+        }
+        productLayout.additionalJarsToUnpackIntoMainJar.each {
+          ant.zipfileset(src: it)
+        }
+      }
+
+      usedJars.each {
+        ant.fileset(file: it)
+      }
+
+      dir("libpty") {
+        ant.fileset(dir: "$communityHome/lib/libpty") {
+          exclude(name: "*.txt")
+        }
+      }
+      dir("ext") {//why ext?
+        projectLibrary("CGLIB")
+      }
+
+      dir("src") {
+        ant.fileset(dir: "$communityHome/lib/src") {
+          include(name: "trove4j_changes.txt")
+          include(name: "trove4j_src.jar")
+        }
+      }
+    }
+    usedModules.addAll(layoutBuilder.usedModules)
+  }
+
+  private void buildPlugins() {
+    def ant = buildContext.ant
+    def productLayout = buildContext.productProperties.productLayout
+    def layoutBuilder = createLayoutBuilder()
+
+    if (buildContext.productProperties.setPluginAndIDEVersionInPluginXml) {
+      def pluginsToBuild = getPluginsByModules(productLayout.pluginModulesToPublish)
+      pluginsToBuild.each { plugin ->
+        def moduleOutput = buildContext.projectBuilder.moduleOutput(buildContext.findRequiredModule(plugin.mainModule))
+        def pluginXmlPath = "$moduleOutput/META-INF/plugin.xml"
+        if (!new File(pluginXmlPath)) {
+          buildContext.messages.error("plugin.xml not found in $plugin.mainModule module: $pluginXmlPath")
+        }
+        def patchedPluginXmlDir = "$buildContext.paths.temp/patched-plugin-xml/$plugin.mainModule"
+        ant.copy(file: pluginXmlPath, todir: "$patchedPluginXmlDir/META-INF")
+        setPluginVersionAndSince("$patchedPluginXmlDir/META-INF/plugin.xml", buildContext.buildNumber)
+        layoutBuilder.patchModuleOutput(plugin.mainModule, patchedPluginXmlDir)
+      }
+    }
+
+    buildPlugins(layoutBuilder, getPluginsByModules(productLayout.bundledPluginModules), "$buildContext.paths.distAll/plugins")
+    usedModules.addAll(layoutBuilder.usedModules)
+
+    def pluginsToPublishDir = "$buildContext.paths.temp/plugins-to-publish"
+    def pluginsToPublish = getPluginsByModules(productLayout.pluginModulesToPublish)
+    buildPlugins(layoutBuilder, pluginsToPublish, pluginsToPublishDir)
+    pluginsToPublish.each { plugin ->
+      def directory = plugin.directoryName
+      ant.zip(destfile: "$buildContext.paths.artifacts/plugins/$directory-${buildContext.buildNumber}.zip") {
+        zipfileset(dir: "$pluginsToPublishDir/$directory", prefix: directory)
+      }
+    }
+  }
+
+  private List<PluginLayout> getPluginsByModules(List<String> modules) {
+    def modulesToInclude = modules as Set<String>
+    allPlugins.findAll { modulesToInclude.contains(it.mainModule) }
+  }
+
+  private buildPlugins(LayoutBuilder layoutBuilder, List<PluginLayout> pluginsToInclude, String targetDirectory) {
+    def ant = buildContext.ant
+    def resourceExcluded = RESOURCES_EXCLUDED
+    def resourcesIncluded = RESOURCES_INCLUDED
+    def enabledModulesSet = buildContext.productProperties.productLayout.enabledPluginModules
+    layoutBuilder.layout(targetDirectory) {
+      pluginsToInclude.each { plugin ->
+        dir(plugin.directoryName) {
+          dir("lib") {
+            def actualModuleJars = plugin.getActualModules(enabledModulesSet)
+            actualModuleJars.entrySet().each {
+              def modules = it.value
+              def jarPath = it.key
+              jar(jarPath, true) {
+                modulePatches(modules)
+                modules.each { moduleName ->
+                  module(moduleName) {
+                    if (plugin.packLocalizableResourcesInCommonJar(moduleName)) {
+                      ant.patternset(refid: resourceExcluded)
+                    }
+                    plugin.moduleExcludes.get(moduleName)?.each {
+                      ant.exclude(name: "$it/**")
+                    }
+                  }
+                }
+              }
+            }
+            def modulesWithResources = actualModuleJars.values().findAll { plugin.packLocalizableResourcesInCommonJar(it) }
+            if (!modulesWithResources.empty) {
+              jar("resources_en.jar") {
+                modulesWithResources.each {
+                  module(it) {
+                    ant.patternset(refid: resourcesIncluded)
+                  }
+                }
+              }
+            }
+            plugin.includedProjectLibraries.each {
+              projectLibrary(it)
+            }
+
+            //include all module libraries from the plugin modules added to IDE classpath to layout
+            actualModuleJars.entrySet().findAll {!it.key.contains("/")}.collectMany {it.value}.each { moduleName ->
+              findModule(moduleName).dependenciesList.dependencies.
+                findAll { it instanceof JpsLibraryDependency && it?.libraryReference?.parentReference?.resolve() instanceof JpsModule}.
+                findAll { JpsJavaExtensionService.instance.getDependencyExtension(it)?.scope?.isIncludedIn(JpsJavaClasspathKind.PRODUCTION_RUNTIME) ?: false}.
+                each {
+                  jpsLibrary(((JpsLibraryDependency)it).library)
+                }
+            }
+
+            plugin.includedModuleLibraries.each { data ->
+              dir(data.relativeOutputPath) {
+                moduleLibrary(data.moduleName, data.libraryName)
+              }
+            }
+          }
+          plugin.resourcePaths.entrySet().each {
+            def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
+            def path = "$contentRoot/$it.key"
+            dir(it.value) {
+              if (new File(path).isFile()) {
+                ant.fileset(file: path)
+              }
+              else {
+                ant.fileset(dir: path)
+              }
+            }
+          }
+          plugin.resourceArchivePaths.entrySet().each {
+            def contentRoot = JpsPathUtil.urlToPath(findModule(plugin.mainModule).contentRootsList.urls.first())
+            def path = "$contentRoot/$it.key"
+            zip(it.value) {
+              ant.fileset(dir: path)
+            }
+          }
+        }
+      }
+    }
+  }
+
+  private LayoutBuilder createLayoutBuilder() {
+    new LayoutBuilder(buildContext.ant, buildContext.project, COMPRESS_JARS)
+  }
+
+  private void setPluginVersionAndSince(String pluginXmlPath, String buildNumber) {
+    buildContext.ant.replaceregexp(file: pluginXmlPath,
+                      match: "<version>[\\d.]*</version>",
+                      replace: "<version>${buildNumber}</version>")
+    buildContext.ant.replaceregexp(file: pluginXmlPath,
+                      match: "<idea-version\\s*since-build=\"\\d+\\.\\d+\"",
+                      replace: "<idea-version since-build=\"${buildNumber}\"")
+    buildContext.ant.replaceregexp(file: pluginXmlPath,
+                      match: "<change-notes>\\s*<\\!\\[CDATA\\[\\s*Plugin version: \\\$\\{version\\}",
+                      replace: "<change-notes>\n<![CDATA[\nPlugin version: ${buildNumber}")
+    def file = new File(pluginXmlPath)
+    def text = file.text
+    if (!text.contains("<version>")) {
+      def dotIndex = buildNumber.indexOf('.')
+      def untilBuild = dotIndex > 0 ? Integer.parseInt(buildNumber.substring(0, dotIndex)) + ".*" : buildNumber
+      def anchor = text.contains("</id>") ? "</id>" : "</name>"
+      file.text = text.replace(anchor,
+                               "${anchor}\n  <version>${buildNumber}</version>\n  <idea-version since-build=\"${buildNumber}\" until-build=\"${untilBuild}\"/>\n")
+    }
+  }
+
+  private Set<String> collectUsedJars(List<String> modules, List<String> additionalLibFolders) {
+    def usedJars = new LinkedHashSet<String>();
+    List<String> approvedJars =
+      (["$buildContext.paths.communityHome/lib", "$buildContext.paths.projectHome/lib", "$buildContext.paths.communityHome/xml/relaxng/lib"] as List<String>) +
+      additionalLibFolders
+
+    modules.each {
+      def module = buildContext.findModule(it)
+      if (module != null) {
+        buildContext.projectBuilder.moduleRuntimeClasspath(module, false).each {
+          File file = new File(it)
+          if (file.exists()) {
+            String path = FileUtil.toSystemIndependentName(file.canonicalPath)
+            if (path.endsWith(".jar") && approvedJars.any { FileUtil.startsWith(path, it) }) {
+              if (usedJars.add(path)) {
+                buildContext.messages.info("\tADDED: $path for $module.name")
+              }
+            }
+          }
+        }
+      }
+    }
+
+    return usedJars
+  }
+
+  private File createKeyMapWithAltClickReassignedToMultipleCarets() {
+    def sourceFile = new File("${buildContext.projectBuilder.moduleOutput(buildContext.findModule("platform-resources"))}/idea/Keymap_Default.xml")
+    String defaultKeymapContent = sourceFile.text
+    defaultKeymapContent = defaultKeymapContent.replace("<mouse-shortcut keystroke=\"alt button1\"/>", "")
+    defaultKeymapContent = defaultKeymapContent.replace("<mouse-shortcut keystroke=\"alt shift button1\"/>",
+                                                        "<mouse-shortcut keystroke=\"alt button1\"/>")
+    def patchedKeyMapDir = new File(buildContext.paths.temp, "patched-keymap")
+    def targetFile = new File(patchedKeyMapDir, "idea/Keymap_Default.xml")
+    FileUtil.createParentDirs(targetFile)
+    targetFile.text = defaultKeymapContent
+    return patchedKeyMapDir
+  }
+}
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/LayoutBuilder.groovy b/build/groovy/org/jetbrains/intellij/build/impl/LayoutBuilder.groovy
new file mode 100644 (file)
index 0000000..d51b578
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * 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.
+ */
+/*
+ * 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 org.jetbrains.intellij.build.impl
+
+import com.intellij.openapi.util.MultiValuesMap
+import com.intellij.util.PathUtilRt
+import org.apache.tools.ant.AntClassLoader
+import org.jetbrains.jps.model.JpsProject
+import org.jetbrains.jps.model.library.JpsLibrary
+import org.jetbrains.jps.model.library.JpsOrderRootType
+import org.jetbrains.jps.model.module.JpsModule
+
+/**
+ * This is replacement for {@link org.jetbrains.jps.gant.JpsGantTool} which doesn't depend on Gant. It also allows us to patch a module
+ * output before packing it into JAR.
+ *
+ * @author nik
+ */
+class LayoutBuilder {
+  private final AntBuilder ant
+  private final boolean compressJars
+  final Set<String> usedModules = new LinkedHashSet<>()
+  private final MultiValuesMap<String, String> moduleOutputPatches = new MultiValuesMap<>(true)
+  private final JpsProject project
+
+  LayoutBuilder(AntBuilder ant, JpsProject project, boolean compressJars) {
+    this.project = project
+    this.ant = ant
+    this.compressJars = compressJars
+
+    def contextLoaderRef = "GANT_CONTEXT_CLASS_LOADER";
+    if (!ant.project.hasReference(contextLoaderRef)) {
+      ClassLoader contextLoader = Thread.currentThread().contextClassLoader
+      if (!(contextLoader instanceof AntClassLoader)) {
+        contextLoader = new AntClassLoader(contextLoader, ant.project, null)
+      }
+      ant.project.addReference(contextLoaderRef, contextLoader)
+      ant.taskdef(name: "layout", loaderRef: contextLoaderRef, classname: "jetbrains.antlayout.tasks.LayoutTask")
+    }
+  }
+
+  /**
+   * Contents of {@code pathToDirectoryWithPatchedFiles} will be used to patch the module output. Set 'preserveDuplicates' to {@code true}
+   * when calling {@link LayoutSpec#jar} and call {@link LayoutSpec#modulePatches} from its body to apply the patches to the JAR.
+   */
+  void patchModuleOutput(String moduleName, String pathToDirectoryWithPatchedFiles) {
+    moduleOutputPatches.put(moduleName, pathToDirectoryWithPatchedFiles)
+  }
+
+  /**
+   * Creates the output layout accordingly to {@code data} in {@code targetDirectory}. Please note that {@code data} may refer to local
+   * variables of its method only. It cannot refer to its fields or methods because data's 'owner' field is changed to support the internal DSL.
+   */
+  void layout(String targetDirectory, @DelegatesTo(LayoutSpec) Closure data) {
+    def spec = new LayoutSpec()
+    //we cannot set 'spec' as delegate because 'delegate' will be overwritten by AntBuilder
+    def body = data.rehydrate(null, spec, data.thisObject)
+    body.resolveStrategy = Closure.OWNER_FIRST
+    ant.layout(toDir: targetDirectory, body)
+  }
+
+  class LayoutSpec {
+    /**
+     * Create a JAR file with name {@code relativePath} (it may also include parent directories names for the JAR) into the current place
+     * in the layout. The content of the JAR is specified by {@code body}.
+     */
+    def jar(String relativePath, boolean preserveDuplicates = false, boolean mergeManifests = true, Closure body) {
+      def directory = PathUtilRt.getParentPath(relativePath)
+      if (directory == "") {
+        ant.jar(name: relativePath, compress: compressJars, duplicate: preserveDuplicates ? "preserve" : "fail",
+                filesetmanifest: mergeManifests ? "merge" : "skip", body)
+      }
+      else {
+        dir(directory) {
+          jar(PathUtilRt.getFileName(relativePath), preserveDuplicates, mergeManifests, body)
+        }
+      }
+    }
+
+    /**
+     * Create a Zip file with name {@code relativePath} (it may also include parent directories names for the JAR) into the current place
+     * in the layout. The content of the JAR is specified by {@code body}.
+     */
+    def zip(String relativePath, Closure body) {
+      def directory = PathUtilRt.getParentPath(relativePath)
+      if (directory == "") {
+        ant.zip(name: relativePath, body)
+      }
+      else {
+        dir(directory) {
+          zip(PathUtilRt.getFileName(relativePath), body)
+        }
+      }
+    }
+
+    /**
+     * Create a directory (or several nested directories) {@code relativePath} in the current place in the layout. The content of the
+     * directory is specified by {@code body}.
+     */
+    def dir(String relativePath, Closure body) {
+      def parent = PathUtilRt.getParentPath(relativePath)
+      if (relativePath.empty) {
+        body()
+      }
+      else if (parent.empty) {
+        ant.dir(name: relativePath, body)
+      }
+      else {
+        dir(parent) {
+          dir(PathUtilRt.getFileName(relativePath), body)
+        }
+      }
+    }
+
+    /**
+     * Include the patched outputs of {@code moduleNames} modules to the current place in the layout. This method is supposed to be called
+     * in the {@code body} of {@link #jar} with 'preserveDuplicates' set to {@code true}
+     */
+    def modulePatches(Collection<String> moduleNames) {
+      moduleNames.each {
+        moduleOutputPatches.get(it)?.each {
+          ant.fileset(dir: it)
+        }
+      }
+    }
+
+    /**
+     * Include production output of {@code moduleName} to the current place in the layout
+     */
+    def module(String moduleName, Closure body = {}) {
+      usedModules << moduleName
+      ant.module(name: moduleName, body)
+    }
+
+    /**
+     * Include test output of {@code moduleName} to the current place in the layout
+     */
+    def moduleTests(String moduleName, Closure body = {}) {
+      ant.moduleTests(name: moduleName, body)
+    }
+
+    /**
+     * Include JARs added as classes roots of project library {@code libraryName} to the current place in the layout
+     */
+    def projectLibrary(String libraryName) {
+      def library = project.libraryCollection.findLibrary(libraryName)
+      if (library == null) {
+        throw new IllegalArgumentException("Cannot find library $libraryName in the project")
+      }
+      jpsLibrary(library)
+    }
+
+    /**
+     * Include JARs added as classes roots of a module library {@code libraryName} from module {@code moduleName} to the current place in the layout
+     */
+    def moduleLibrary(String moduleName, String libraryName) {
+      def module = findModule(moduleName)
+      def library = module.libraryCollection.libraries.find {getLibraryName(it) == libraryName}
+      if (library == null) {
+        throw new IllegalArgumentException("Cannot find library $libraryName in '$moduleName' module")
+      }
+      jpsLibrary(library)
+    }
+
+    def jpsLibrary(JpsLibrary library) {
+      library.getFiles(JpsOrderRootType.COMPILED).each {
+        ant.fileset(file: it.absolutePath)
+      }
+    }
+
+    def JpsModule findModule(String name) {
+      def module = project.modules.find { it.name == name }
+      if (module == null) {
+        throw new IllegalArgumentException("Cannot find module '$name' in the project")
+      }
+      module
+    }
+
+    private String getLibraryName(JpsLibrary lib) {
+      def name = lib.name
+      if (name.startsWith("#")) {
+        if (lib.getRoots(JpsOrderRootType.COMPILED).size() != 1) {
+          def urls = lib.getRoots(JpsOrderRootType.COMPILED).collect { it.url }
+          throw new IllegalStateException("Non-single entry module library $name: $urls");
+        }
+        File file = lib.getFiles(JpsOrderRootType.COMPILED)[0]
+        return file.name
+      }
+      return name
+    }
+  }
+}
+
index 1b6549a61c5747e9ea76be1fbd79022c5361f21e..badd29c548163bfaed3ad42dd84f3f33efbf3e3a 100644 (file)
@@ -36,7 +36,11 @@ class LinuxDistributionBuilder {
   //todo[nik] rename
   void layoutUnix(File ideaProperties) {
     buildContext.ant.copy(todir: "$unixDistPath/bin") {
-      fileset(dir: "$buildContext.paths.communityHome/bin/linux")
+      fileset(dir: "$buildContext.paths.communityHome/bin/linux") {
+        if (!buildContext.includeBreakGenLibraries()) {
+          exclude(name: "libbreakgen*")
+        }
+      }
       if (buildContext.productProperties.yourkitAgentBinariesDirectoryPath != null) {
         fileset(dir: buildContext.productProperties.yourkitAgentBinariesDirectoryPath) {
           include(name: "libyjpagent-linux*.so")
@@ -47,7 +51,9 @@ class LinuxDistributionBuilder {
     //todo[nik] converting line separators to unix-style make sense only when building Linux distributions under Windows on a local machine;
     // for real installers we need to checkout all text files with 'lf' separators anyway
     buildContext.ant.fixcrlf(file: "$unixDistPath/bin/idea.properties", eol: "unix")
-    buildContext.ant.copy(file: customizer.iconPngPath, tofile: "$unixDistPath/bin/${buildContext.productProperties.baseFileName}.png")
+    if (customizer.iconPngPath != null) {
+      buildContext.ant.copy(file: customizer.iconPngPath, tofile: "$unixDistPath/bin/${buildContext.productProperties.baseFileName}.png")
+    }
 
     unixScripts()
     unixVMOptions()
@@ -70,10 +76,8 @@ class LinuxDistributionBuilder {
 
     String classPath = "CLASSPATH=\"\$IDE_HOME/lib/${buildContext.bootClassPathJarNames[0]}\"\n"
     classPath += buildContext.bootClassPathJarNames[1..-1].collect { "CLASSPATH=\"\$CLASSPATH:\$IDE_HOME/lib/${it}\"" }.join("\n")
-    def jvmArgs = buildContext.productProperties.additionalIdeJvmArguments
     if (buildContext.productProperties.toolsJarRequired) {
       classPath += "\nCLASSPATH=\"\$CLASSPATH:\$JDK/lib/tools.jar\""
-      jvmArgs = "$jvmArgs -Didea.jre.check=true".trim()
     }
 
     buildContext.ant.copy(todir: "${unixDistPath}/bin") {
@@ -81,11 +85,11 @@ class LinuxDistributionBuilder {
 
       filterset(begintoken: "@@", endtoken: "@@") {
         filter(token: "product_full", value: fullName)
-        filter(token: "product_uc", value: buildContext.applicationInfo.upperCaseProductName)
+        filter(token: "product_uc", value: buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo))
         filter(token: "vm_options", value: vmOptionsFileName)
         filter(token: "isEap", value: buildContext.applicationInfo.isEAP)
         filter(token: "system_selector", value: buildContext.systemSelector)
-        filter(token: "ide_jvm_args", value: jvmArgs)
+        filter(token: "ide_jvm_args", value: buildContext.additionalJvmArguments)
         filter(token: "class_path", value: classPath)
         filter(token: "script_name", value: name)
       }
index 172479fa1e6f18f8c87ddddfb877f289ee6123ee..568c693c819d840e139e630ddfd20cd53673860a 100644 (file)
  */
 package org.jetbrains.intellij.build.impl
 
+import com.intellij.util.PathUtilRt
 import org.jetbrains.intellij.build.BuildContext
 import org.jetbrains.intellij.build.BuildOptions
 import org.jetbrains.intellij.build.JvmArchitecture
 import org.jetbrains.intellij.build.MacDistributionCustomizer
 
 import java.time.LocalDate
+
 /**
  * @author nik
  */
@@ -36,21 +38,25 @@ class MacDistributionBuilder {
   }
 
   public layoutMac(File ideaPropertiesFile) {
-    def docTypes = customizer.docTypes ?: """
+    def docTypes = (customizer.associateIpr ? """
       <dict>
         <key>CFBundleTypeExtensions</key>
         <array>
           <string>ipr</string>
         </array>
         <key>CFBundleTypeIconFile</key>
-        <string>${buildContext.productProperties.baseFileName}.icns</string>
+        <string>${PathUtilRt.getFileName(customizer.icnsPath ?: "idea.icns")}</string>
         <key>CFBundleTypeName</key>
         <string>${buildContext.applicationInfo.productName} Project File</string>
         <key>CFBundleTypeRole</key>
         <string>Editor</string>
       </dict>
-"""
-    Map<String, String> customIdeaProperties = ["idea.jre.check": "$buildContext.productProperties.toolsJarRequired"];
+""" : "") + customizer.additionalDocTypes
+    Map<String, String> customIdeaProperties = [:]
+    if (buildContext.productProperties.toolsJarRequired) {
+      customIdeaProperties["idea.jre.check"] = "true"
+    }
+    customIdeaProperties.putAll(customizer.customIdeaProperties(buildContext.applicationInfo))
     layoutMacApp(ideaPropertiesFile, customIdeaProperties, docTypes)
     customizer.copyAdditionalFiles(buildContext, macDistPath)
     def macZipPath = buildMacZip()
diff --git a/build/groovy/org/jetbrains/intellij/build/impl/PluginLayout.groovy b/build/groovy/org/jetbrains/intellij/build/impl/PluginLayout.groovy
new file mode 100644 (file)
index 0000000..2ae33d4
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * 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.
+ */
+/*
+ * 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 org.jetbrains.intellij.build.impl
+
+import com.intellij.openapi.util.MultiValuesMap
+import groovy.transform.Immutable
+
+/**
+ * @author nik
+ */
+class PluginLayout {
+  final String mainModule
+  String directoryName
+  /** JAR name (or path relative to 'lib' directory) to module name */
+  final MultiValuesMap<String, String> moduleJars = new MultiValuesMap<>(true)
+  /** source directory -> relative path to a target directory under the plugin directory */
+  final Map<String, String> resourcePaths = [:]
+  /** source directory -> relative path to a zip file under the plugin directory */
+  final Map<String, String> resourceArchivePaths = [:]
+  /** module name to entries which should be excluded from its output */
+  final MultiValuesMap<String, String> moduleExcludes = new MultiValuesMap<>(true)
+  final List<String> includedProjectLibraries = []
+  final List<ModuleLibraryData> includedModuleLibraries = []
+  private final Set<String> optionalModules = new LinkedHashSet<>()
+  private final Set<String> modulesWithLocalizableResourcesInCommonJar = new LinkedHashSet<>()
+  private boolean doNotCreateSeparateJarForLocalizableResources
+
+  private PluginLayout(String mainModule) {
+    this.mainModule = mainModule
+  }
+
+  /**
+   * Creates the plugin layout description. The default plugin layout is composed of a jar with name {@code mainModuleName}.jar containing output of
+   * {@code mainModuleName}, resources_en.jar containing translatable resources from {@code mainModuleName}, and the module libraries of
+   * {@code mainModuleName} with scopes 'Compile' and 'Runtime' placed under 'lib' directory in a directory with name {@code mainModuleName}.
+   * In you need to include additional resources or modules into the plugin layout specify them in {@code body} parameter.
+   *
+   * @param mainModuleName name of the module containing META-INF/plugin.xml file of the plugin
+   */
+  static PluginLayout plugin(String mainModuleName, @DelegatesTo(PluginLayoutSpec) Closure body = {}) {
+    def layout = new PluginLayout(mainModuleName)
+    def spec = new PluginLayoutSpec(layout)
+    body.delegate = spec
+    body()
+    layout.directoryName = spec.directoryName
+    spec.withModule(mainModuleName, spec.mainJarName)
+    if (layout.doNotCreateSeparateJarForLocalizableResources) {
+      layout.modulesWithLocalizableResourcesInCommonJar.clear()
+    }
+    return layout
+  }
+
+  MultiValuesMap<String, String> getActualModules(Set<String> enabledPluginModules) {
+    def result = new MultiValuesMap<String, String>(true)
+    for (Map.Entry<String, Collection<String>> entry : moduleJars.entrySet()) {
+      for (String moduleName : entry.getValue()) {
+        if (!optionalModules.contains(moduleName) || enabledPluginModules.contains(moduleName)) {
+          result.put(entry.key, moduleName)
+        }
+      }
+    }
+    return result
+  }
+
+  boolean packLocalizableResourcesInCommonJar(String moduleName) {
+    return modulesWithLocalizableResourcesInCommonJar.contains(moduleName)
+  }
+
+  static class PluginLayoutSpec {
+    private final PluginLayout layout
+    /**
+     * Name of the directory (under 'plugins' directory) where the plugin should be placed
+     */
+    String directoryName
+    /**
+     * Name of the main plugin JAR file
+     */
+    String mainJarName
+
+    PluginLayoutSpec(PluginLayout layout) {
+      this.layout = layout
+      directoryName = layout.mainModule
+      mainJarName = "${layout.mainModule}.jar"
+    }
+
+    /**
+     * Register an optional module which may be excluded from the plugin distribution in some products
+     */
+    void withOptionalModule(String moduleName, String relativeJarPath = "${moduleName}.jar") {
+      layout.optionalModules << moduleName
+      withModule(moduleName, relativeJarPath)
+    }
+
+    /**
+     * Register an additional module to be included into the plugin distribution. If {@code relativeJarPath} doesn't contain '/' (i.e. the
+     * JAR will be added to the plugin's classpath) this will also cause modules library from {@code moduleName} with scopes 'Compile' and
+     * 'Runtime' to be copied to the 'lib' directory of the plugin.
+     *
+     * @param relativeJarPath target JAR path relative to 'lib' directory of the plugin; different modules may be packed into the same JAR,
+     * but don't use this for new plugins; this parameter is temporary added to keep layout of old plugins.
+     * @param localizableResourcesInCommonJar if {@code true} the translatable resources from the module (messages, inspection descriptions, etc) will be
+     * placed into a separate 'resources_en.jar'. <strong>Do not use this for new plugins, this parameter is temporary added to keep layout of old plugins</strong>.
+     */
+    void withModule(String moduleName, String relativeJarPath = "${moduleName}.jar", boolean localizableResourcesInCommonJar = true) {
+      if (localizableResourcesInCommonJar) {
+        layout.modulesWithLocalizableResourcesInCommonJar << moduleName
+      }
+      layout.moduleJars.put(relativeJarPath, moduleName)
+    }
+
+    void withJpsModule(String moduleName) {
+      withModule(moduleName, "jps/${moduleName}.jar")
+    }
+
+    /**
+     * @param resourcePath path to resource file or directory relative to the plugin's main module content root
+     * @param relativeOutputDirectory target path relative to the plugin root directory
+     */
+    void withResource(String resourcePath, String relativeOutputDirectory) {
+      layout.resourcePaths[resourcePath] = relativeOutputDirectory
+    }
+
+    /**
+     * @param resourcePath path to resource file or directory relative to the plugin's main module content root
+     * @param relativeOutputFile target path relative to the plugin root directory
+     */
+    void withResourceArchive(String resourcePath, String relativeOutputFile) {
+      layout.resourceArchivePaths[resourcePath] = relativeOutputFile
+    }
+
+    /**
+     * Include the project library to 'lib' directory of the plugin distribution
+     */
+    void withProjectLibrary(String libraryName) {
+      layout.includedProjectLibraries << libraryName
+    }
+
+    /**
+     * Include the module library to the plugin distribution. Please note that it makes sense to call this method only
+     * for additional modules which aren't copied directly to the 'lib' directory of the plugin distribution, because for ordinary modules
+     * their module libraries are included into the layout automatically.
+     */
+    void withModuleLibrary(String libraryName, String moduleName = layout.mainModule, String relativeOutputPath) {
+      layout.includedModuleLibraries << new ModuleLibraryData(moduleName: moduleName, libraryName: libraryName, relativeOutputPath: relativeOutputPath)
+    }
+
+    /**
+     * Exclude the specified directory when {@code moduleName} is packed into JAR file.
+     * <strong>This is a temporary method added to keep layout of some old plugins. If some directory from a module shouldn't be included into the
+     * module JAR it's strongly recommended to move that directory outside of the module source roots.</strong>
+     * @param excludedDirectory path to the directory to be exclude relatively to the module output root
+     */
+    void excludeFromModule(String moduleName, String excludedDirectory) {
+      layout.moduleExcludes.put(moduleName, excludedDirectory)
+    }
+
+    /**
+     * Do not create 'resources_en.jar' and pack all resources into corresponding module JARs.
+     * <strong>Do not use this for new plugins, this method is temporary added to keep layout of old plugins</strong>.
+     */
+    void doNotCreateSeperateJarForLocalizableResources() {
+      layout.doNotCreateSeparateJarForLocalizableResources = true
+    }
+  }
+
+  @Immutable
+  static class ModuleLibraryData {
+    String moduleName
+    String libraryName
+    String relativeOutputPath
+  }
+}
\ No newline at end of file
index bf23841eab5368e5fe3e0b3a1e0e04c8f9be0be6..97f17d38ad82058c0ef62e7fc49684af04ffbb76 100644 (file)
@@ -122,13 +122,12 @@ class WinExeInstallerBuilder {
 !define PRODUCT_VM_OPTIONS_FILE "${toSystemDependentName("$winDistPath/bin/")}\${PRODUCT_VM_OPTIONS_NAME}"
 """
 
-    String fullProductName = productProperties.fullNameIncludingEdition(buildContext.applicationInfo)
     def extensionsList = customizer.fileAssociations
     def fileAssociations = extensionsList.isEmpty() ? "NoAssociation" : extensionsList.join(",")
     new File(box, "nsiconf/strings.nsi").text = """
-!define MANUFACTURER "JetBrains"
-!define MUI_PRODUCT  "$fullProductName"
-!define PRODUCT_FULL_NAME "$fullProductName"
+!define MANUFACTURER "${buildContext.applicationInfo.shortCompanyName}"
+!define MUI_PRODUCT  "${customizer.fullNameIncludingEdition(buildContext.applicationInfo)}"
+!define PRODUCT_FULL_NAME "${customizer.fullNameIncludingEditionAndVendor(buildContext.applicationInfo)}"
 !define PRODUCT_EXE_FILE "${productProperties.baseFileName}.exe"
 !define PRODUCT_EXE_FILE_64 "${productProperties.baseFileName}64.exe"
 !define PRODUCT_ICON_FILE "install.ico"
@@ -138,7 +137,7 @@ class WinExeInstallerBuilder {
 !define ASSOCIATION "$fileAssociations"
 !define UNINSTALL_WEB_PAGE "${customizer.uninstallFeedbackPageUrl(buildContext.applicationInfo) ?: "feedback_web_page"}"
 
-; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDEA build has been installed
+; if SHOULD_SET_DEFAULT_INSTDIR != 0 then default installation directory will be directory where highest-numbered IDE build has been installed
 ; set to 1 for release build
 !define SHOULD_SET_DEFAULT_INSTDIR "0"
 
index 6d0484b21956c364bca19c0af51d0a5d89597294..774f54928f649b0cf676b9562f771c855fccd8b8 100644 (file)
@@ -20,6 +20,7 @@ import org.jetbrains.intellij.build.BuildOptions
 import org.jetbrains.intellij.build.JvmArchitecture
 import org.jetbrains.intellij.build.WindowsDistributionCustomizer
 import org.jetbrains.jps.model.module.JpsModuleSourceRoot
+
 /**
  * @author nik
  */
@@ -37,7 +38,11 @@ class WindowsDistributionBuilder {
   //todo[nik] rename
   void layoutWin(File ideaProperties) {
     buildContext.ant.copy(todir: "$winDistPath/bin") {
-      fileset(dir: "$buildContext.paths.communityHome/bin/win")
+      fileset(dir: "$buildContext.paths.communityHome/bin/win") {
+        if (!buildContext.includeBreakGenLibraries()) {
+          exclude(name: "breakgen*")
+        }
+      }
       if (buildContext.productProperties.yourkitAgentBinariesDirectoryPath != null) {
         fileset(dir: buildContext.productProperties.yourkitAgentBinariesDirectoryPath) {
           include(name: "yjpagent*.dll")
@@ -47,7 +52,9 @@ class WindowsDistributionBuilder {
     buildContext.ant.copy(file: ideaProperties.path, todir: "$winDistPath/bin")
     buildContext.ant.fixcrlf(file: "$winDistPath/bin/idea.properties", eol: "dos")
 
-    buildContext.ant.copy(file: customizer.icoPath, tofile: "$winDistPath/bin/${buildContext.productProperties.baseFileName}.ico")
+    if (customizer.icoPath != null) {
+      buildContext.ant.copy(file: customizer.icoPath, tofile: "$winDistPath/bin/${buildContext.productProperties.baseFileName}.ico")
+    }
     if (customizer.includeBatchLaunchers) {
       winScripts()
     }
@@ -58,7 +65,7 @@ class WindowsDistributionBuilder {
 
     def arch = customizer.bundledJreArchitecture
     def jreDirectoryPath = arch != null ? buildContext.bundledJreManager.extractWinJre(arch) : null
-    buildWinZip(jreDirectoryPath, ".win")
+    buildWinZip(jreDirectoryPath, buildContext.productProperties.buildCrossPlatformDistribution ? ".win" : "")
     if (arch != null && customizer.buildZipWithBundledOracleJre) {
       String oracleJrePath = buildContext.bundledJreManager.extractOracleWinJre(arch)
       if (oracleJrePath != null) {
@@ -82,7 +89,6 @@ class WindowsDistributionBuilder {
 
     String classPath = "SET CLASS_PATH=%IDE_HOME%\\lib\\${buildContext.bootClassPathJarNames[0]}\n"
     classPath += buildContext.bootClassPathJarNames[1..-1].collect { "SET CLASS_PATH=%CLASS_PATH%;%IDE_HOME%\\lib\\$it" }.join("\n")
-    def jvmArgs = getAdditionalJvmArguments()
     if (buildContext.productProperties.toolsJarRequired) {
       classPath += "\nSET CLASS_PATH=%CLASS_PATH%;%JDK%\\lib\\tools.jar"
     }
@@ -93,11 +99,11 @@ class WindowsDistributionBuilder {
 
       filterset(begintoken: "@@", endtoken: "@@") {
         filter(token: "product_full", value: fullName)
-        filter(token: "product_uc", value: buildContext.applicationInfo.upperCaseProductName)
+        filter(token: "product_uc", value: buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo))
         filter(token: "vm_options", value: vmOptionsFileName)
         filter(token: "isEap", value: buildContext.applicationInfo.isEAP)
         filter(token: "system_selector", value: buildContext.systemSelector)
-        filter(token: "ide_jvm_args", value: jvmArgs)
+        filter(token: "ide_jvm_args", value: buildContext.additionalJvmArguments)
         filter(token: "class_path", value: classPath)
         filter(token: "script_name", value: batName)
       }
@@ -116,14 +122,6 @@ class WindowsDistributionBuilder {
     buildContext.ant.fixcrlf(srcdir: "$winDistPath/bin", includes: "*.bat", eol: "dos")
   }
 
-  private String getAdditionalJvmArguments() {
-    def jvmArgs = buildContext.productProperties.additionalIdeJvmArguments
-    if (buildContext.productProperties.toolsJarRequired) {
-      return "$jvmArgs -Didea.jre.check=true".trim()
-    }
-    return jvmArgs
-  }
-
   //todo[nik] rename
   private void winVMOptions() {
     JvmArchitecture.values().each {
@@ -141,37 +139,32 @@ class WindowsDistributionBuilder {
       def launcherPropertiesPath = "${buildContext.paths.temp}/launcher${arch.fileSuffix}.properties"
       def upperCaseProductName = buildContext.applicationInfo.upperCaseProductName
       def lowerCaseProductName = buildContext.applicationInfo.shortProductName.toLowerCase()
-      String vmOptions
-      if (buildContext.productProperties.platformPrefix != null
-//todo[nik] remove later. This is added to keep current behavior (platform prefix for CE is set in MainImpl anyway)
-        && buildContext.productProperties.platformPrefix != "Idea") {
-        vmOptions = "-Didea.platform.prefix=${buildContext.productProperties.platformPrefix}"
-      }
-      else {
-        vmOptions = ""
-      }
-
-      vmOptions = "$vmOptions -Didea.paths.selector=${buildContext.systemSelector} ${getAdditionalJvmArguments()}".trim()
+      String vmOptions = "$buildContext.additionalJvmArguments -Didea.paths.selector=${buildContext.systemSelector}".trim()
       def productName = buildContext.applicationInfo.upperCaseProductName //todo[nik] use '.productName' instead
 
       String jdkEnvVarSuffix = arch == JvmArchitecture.x64 ? "_64" : "";
+      def envVarBaseName = buildContext.productProperties.environmentVariableBaseName(buildContext.applicationInfo)
       new File(launcherPropertiesPath).text = """
 IDS_JDK_ONLY=$buildContext.productProperties.toolsJarRequired
-IDS_JDK_ENV_VAR=${upperCaseProductName}_JDK${jdkEnvVarSuffix}
-IDS_APP_TITLE=${productName} Launcher
+IDS_JDK_ENV_VAR=${envVarBaseName}_JDK$jdkEnvVarSuffix
+IDS_APP_TITLE=$productName Launcher
 IDS_VM_OPTIONS_PATH=%USERPROFILE%\\\\.$buildContext.systemSelector
 IDS_VM_OPTION_ERRORFILE=-XX:ErrorFile=%USERPROFILE%\\\\java_error_in_${lowerCaseProductName}_%p.log
 IDS_VM_OPTION_HEAPDUMPPATH=-XX:HeapDumpPath=%USERPROFILE%\\\\java_error_in_${lowerCaseProductName}.hprof
 IDC_WINLAUNCHER=${upperCaseProductName}_LAUNCHER
-IDS_PROPS_ENV_VAR=${upperCaseProductName}_PROPERTIES
-IDS_VM_OPTIONS_ENV_VAR=${upperCaseProductName}${arch.fileSuffix}_VM_OPTIONS
-IDS_ERROR_LAUNCHING_APP=Error launching ${productName}
+IDS_PROPS_ENV_VAR=${envVarBaseName}_PROPERTIES
+IDS_VM_OPTIONS_ENV_VAR=$envVarBaseName${arch.fileSuffix}_VM_OPTIONS
+IDS_ERROR_LAUNCHING_APP=Error launching $productName
 IDS_VM_OPTIONS=$vmOptions
 """.trim()
 
       def communityHome = "$buildContext.paths.communityHome"
       String inputPath = "$communityHome/bin/WinLauncher/WinLauncher${arch.fileSuffix}.exe"
       def outputPath = "$winDistPath/bin/$exeFileName"
+      def resourceModules = [buildContext.findApplicationInfoModule(), buildContext.findModule("icons")]
+      if (buildContext.productProperties.brandingModule != null) {
+        resourceModules << buildContext.findRequiredModule(buildContext.productProperties.brandingModule)
+      }
       buildContext.ant.java(classname: "com.pme.launcher.LauncherGeneratorMain", fork: "true", failonerror: "true") {
         sysproperty(key: "java.awt.headless", value: "true")
         arg(value: inputPath)
@@ -186,7 +179,7 @@ IDS_VM_OPTIONS=$vmOptions
             include(name: "jdom.jar")
             include(name: "sanselan*.jar")
           }
-          [buildContext.findApplicationInfoModule(), buildContext.findModule("icons")].collectMany { it.sourceRoots }.each { JpsModuleSourceRoot root ->
+          resourceModules.collectMany { it.sourceRoots }.each { JpsModuleSourceRoot root ->
             pathelement(location: root.file.absolutePath)
           }
         }
index fe68c1c00278295af0ab8c328ccaede9b66a4f23..464abd6f8ca5ad82444cdc46075a13a74a616936 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.codeInspection.dataFlow;
 
 import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.ExceptionUtil;
 import com.intellij.codeInspection.dataFlow.instructions.*;
 import com.intellij.codeInspection.dataFlow.value.*;
 import com.intellij.openapi.diagnostic.Logger;
@@ -1041,9 +1042,9 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
         ((PsiResourceExpression)resource).getExpression().accept(this);
       }
 
-      PsiMethod closer = PsiUtil.getResourceCloserMethod(resource);
-      if (closer != null) {
-        addMethodThrows(closer, null);
+      final List<PsiClassType> closerExceptions = ExceptionUtil.getCloserExceptions(resource);
+      if (!closerExceptions.isEmpty()) {
+        addThrows(null, findNextCatch(false), closerExceptions.toArray(new PsiClassType[closerExceptions.size()]));
       }
     }
   }
@@ -1411,15 +1412,19 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
     CatchDescriptor cd = findNextCatch(false);
     if (method != null) {
       PsiClassType[] refs = method.getThrowsList().getReferencedTypes();
-      for (PsiClassType ref : refs) {
-        pushUnknown();
-        ConditionalGotoInstruction cond = new ConditionalGotoInstruction(null, false, null);
-        addInstruction(cond);
-        addInstruction(new EmptyStackInstruction());
-        initException(ref, cd);
-        addThrowCode(cd, explicitCall);
-        cond.setOffset(myCurrentFlow.getInstructionCount());
-      }
+      addThrows(explicitCall, cd, refs);
+    }
+  }
+
+  private void addThrows(@Nullable PsiElement explicitCall, CatchDescriptor cd, PsiClassType[] refs) {
+    for (PsiClassType ref : refs) {
+      pushUnknown();
+      ConditionalGotoInstruction cond = new ConditionalGotoInstruction(null, false, null);
+      addInstruction(cond);
+      addInstruction(new EmptyStackInstruction());
+      initException(ref, cd);
+      addThrowCode(cd, explicitCall);
+      cond.setOffset(myCurrentFlow.getInstructionCount());
     }
   }
 
index 3b2ffe5a6832d1623fe4073dddcc3f166ee29a86..e6b2e95de45a5a3a4667afa2dc2287bc28b75478 100644 (file)
@@ -100,11 +100,6 @@ public class TryWithResourcesPostfixTemplate extends PostfixTemplate {
   @NotNull
   private static Collection<PsiClassType> getUnhandled(@NotNull PsiExpression expression) {
     assert expression.getType() != null;
-    PsiMethod methodCloser = PsiUtil.getResourceCloserMethodForType((PsiClassType)expression.getType());
-    PsiSubstitutor substitutor = PsiUtil.resolveGenericsClassInType(expression.getType()).getSubstitutor();
-
-    return methodCloser != null
-           ? ExceptionUtil.getUnhandledExceptions(methodCloser, expression, null, substitutor)
-           : Collections.<PsiClassType>emptyList();
+    return ExceptionUtil.getUnhandledCloserExceptions(expression, null, expression.getType());
   }
 }
index c1864e69373efce16bc03c8e94b9c31adaf62527..7376042ef16e05f6f248486959c9e5f3ae84d723 100644 (file)
@@ -216,34 +216,44 @@ public class LambdaUtil {
   }
 
   @Nullable
-  public static List<HierarchicalMethodSignature> findFunctionCandidates(PsiClass psiClass) {
+  public static List<HierarchicalMethodSignature> findFunctionCandidates(final PsiClass psiClass) {
     if (psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType()) {
-      final List<HierarchicalMethodSignature> methods = new ArrayList<HierarchicalMethodSignature>();
-      final Map<MethodSignature, Set<PsiMethod>> overrideEquivalents = PsiSuperMethodUtil.collectOverrideEquivalents(psiClass);
-      final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
-      for (HierarchicalMethodSignature signature : visibleSignatures) {
-        final PsiMethod psiMethod = signature.getMethod();
-        if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
-        if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) continue;
-        final Set<PsiMethod> equivalentMethods = overrideEquivalents.get(signature);
-        if (equivalentMethods != null && equivalentMethods.size() > 1) {
-          boolean hasNonAbstractOverrideEquivalent = false;
-          for (PsiMethod method : equivalentMethods) {
-            if (!method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(method, psiMethod)) {
-              hasNonAbstractOverrideEquivalent = true;
-              break;
-            }
-          }
-          if (hasNonAbstractOverrideEquivalent) continue;
+      return CachedValuesManager.getCachedValue(psiClass, new CachedValueProvider<List<HierarchicalMethodSignature>>() {
+        @Nullable
+        @Override
+        public Result<List<HierarchicalMethodSignature>> compute() {
+          return Result.create(calcFunctionCandidates(psiClass), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
         }
-        if (!overridesPublicObjectMethod(signature)) {
-          methods.add(signature);
+      });
+    }
+    return null;
+  }
+
+  private static List<HierarchicalMethodSignature> calcFunctionCandidates(PsiClass psiClass) {
+    final List<HierarchicalMethodSignature> methods = new ArrayList<HierarchicalMethodSignature>();
+    final Map<MethodSignature, Set<PsiMethod>> overrideEquivalents = PsiSuperMethodUtil.collectOverrideEquivalents(psiClass);
+    final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
+    for (HierarchicalMethodSignature signature : visibleSignatures) {
+      final PsiMethod psiMethod = signature.getMethod();
+      if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
+      if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) continue;
+      final Set<PsiMethod> equivalentMethods = overrideEquivalents.get(signature);
+      if (equivalentMethods != null && equivalentMethods.size() > 1) {
+        boolean hasNonAbstractOverrideEquivalent = false;
+        for (PsiMethod method : equivalentMethods) {
+          if (!method.hasModifierProperty(PsiModifier.ABSTRACT) && !MethodSignatureUtil.isSuperMethod(method, psiMethod)) {
+            hasNonAbstractOverrideEquivalent = true;
+            break;
+          }
         }
+        if (hasNonAbstractOverrideEquivalent) continue;
+      }
+      if (!overridesPublicObjectMethod(signature)) {
+        methods.add(signature);
       }
-
-      return hasSubsignature(methods);
     }
-    return null;
+
+    return hasSubsignature(methods);
   }
 
 
index 5360eb550f2971258732c9c619e0397c902a5717..289154d7e930102879824000204fe9ec5e8a9931 100644 (file)
@@ -1137,20 +1137,9 @@ public final class PsiUtil extends PsiUtilCore {
     return name != null && IGNORED_NAMES.contains(name);
   }
 
-  @Nullable
-  public static PsiMethod getResourceCloserMethod(@NotNull PsiResourceListElement resource) {
-    PsiType resourceType = resource.getType();
-    return resourceType instanceof PsiClassType ? getResourceCloserMethodForType((PsiClassType)resourceType) : null;
-  }
-
-  /** @deprecated use {@link #getResourceCloserMethod(PsiResourceListElement)} (to be removed in IDEA 17) */
-  @SuppressWarnings("unused")
-  public static PsiMethod getResourceCloserMethod(@NotNull PsiResourceVariable resource) {
-    return getResourceCloserMethod((PsiResourceListElement)resource);
-  }
 
   @Nullable
-  public static PsiMethod getResourceCloserMethodForType(@NotNull final PsiClassType resourceType) {
+  public static PsiMethod[] getResourceCloserMethodsForType(@NotNull final PsiClassType resourceType) {
     final PsiClass resourceClass = resourceType.resolve();
     if (resourceClass == null) return null;
 
@@ -1162,7 +1151,10 @@ public final class PsiUtil extends PsiUtilCore {
     if (JavaClassSupers.getInstance().getSuperClassSubstitutor(autoCloseable, resourceClass, resourceType.getResolveScope(), PsiSubstitutor.EMPTY) == null) return null;
 
     final PsiMethod[] closes = autoCloseable.findMethodsByName("close", false);
-    return closes.length == 1 ? resourceClass.findMethodBySignature(closes[0], true) : null;
+    if (closes.length == 1) {
+      return resourceClass.findMethodsBySignature(closes[0], true);
+    }
+    return null;
   }
 
   @Nullable
index 7f9c6cc8194c7ccd25fbf7d804a8cc2022763f1c..fc9083936d248b4bdc5859cf39b9db9f04158dda 100644 (file)
@@ -38,8 +38,6 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
 
-import static com.intellij.openapi.util.Pair.pair;
-
 /**
  * @author mike
  */
@@ -533,38 +531,66 @@ public class ExceptionUtil {
       if (psiType instanceof PsiClassType) {
         ex.add((PsiClassType)psiType);
       }
+      else if (psiType instanceof PsiCapturedWildcardType) {
+        final PsiCapturedWildcardType capturedWildcardType = (PsiCapturedWildcardType)psiType;
+        final PsiType upperBound = capturedWildcardType.getUpperBound();
+        if (upperBound instanceof PsiClassType) {
+          ex.add((PsiClassType)upperBound);
+        }
+      }
     }
     return ex;
   }
 
   @NotNull
   public static List<PsiClassType> getCloserExceptions(@NotNull PsiResourceListElement resource) {
-    Pair<PsiMethod, PsiSubstitutor> closer = resolveCloser(resource);
-    return closer != null ? getExceptionsByMethod(closer.first, closer.second, resource) : Collections.<PsiClassType>emptyList();
+    List<PsiClassType> ex = getExceptionsFromClose(resource);
+    return ex != null ? ex : Collections.<PsiClassType>emptyList();
   }
 
   @NotNull
   public static List<PsiClassType> getUnhandledCloserExceptions(@NotNull PsiResourceListElement resource, @Nullable PsiElement topElement) {
-    Pair<PsiMethod, PsiSubstitutor> closer = resolveCloser(resource);
-    return closer != null ? getUnhandledExceptions(closer.first, resource, topElement, closer.second) : Collections.<PsiClassType>emptyList();
+    final PsiType type = resource.getType();
+    return getUnhandledCloserExceptions(resource, topElement, type);
   }
 
-  private static Pair<PsiMethod, PsiSubstitutor> resolveCloser(PsiResourceListElement resource) {
-    PsiMethod method = PsiUtil.getResourceCloserMethod(resource);
-    if (method != null) {
-      PsiClass closerClass = method.getContainingClass();
-      if (closerClass != null) {
-        PsiClassType.ClassResolveResult resourceType = PsiUtil.resolveGenericsClassInType(resource.getType());
-        if (resourceType != null) {
-          PsiClass resourceClass = resourceType.getElement();
-          if (resourceClass != null) {
-            PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(closerClass, resourceClass, resourceType.getSubstitutor());
-            if (substitutor != null) {
-              return pair(method, substitutor);
+  @NotNull
+  public static List<PsiClassType> getUnhandledCloserExceptions(PsiElement place, @Nullable PsiElement topElement, PsiType type) {
+    List<PsiClassType> ex = type instanceof PsiClassType ? getExceptionsFromClose(type, place.getResolveScope()) : null;
+    return ex != null ? getUnhandledExceptions(place, topElement, PsiSubstitutor.EMPTY, ex.toArray(new PsiClassType[ex.size()])) : Collections.<PsiClassType>emptyList();
+  }
+
+  private static List<PsiClassType> getExceptionsFromClose(PsiResourceListElement resource) {
+    final PsiType type = resource.getType();
+    return type instanceof PsiClassType ? getExceptionsFromClose(type, resource.getResolveScope()) : null;
+  }
+
+  private static List<PsiClassType> getExceptionsFromClose(PsiType type, GlobalSearchScope scope) {
+    PsiClassType.ClassResolveResult resourceType = PsiUtil.resolveGenericsClassInType(type);
+    PsiClass resourceClass = resourceType.getElement();
+    if (resourceClass == null) return null;
+
+    PsiMethod[] methods = PsiUtil.getResourceCloserMethodsForType((PsiClassType)type);
+    if (methods != null) {
+      List<PsiClassType> ex = null;
+      for (PsiMethod method : methods) {
+        PsiClass closerClass = method.getContainingClass();
+        if (closerClass != null) {
+          PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(closerClass, resourceClass, resourceType.getSubstitutor());
+          if (substitutor != null) {
+            final PsiClassType[] exceptionTypes = method.getThrowsList().getReferencedTypes();
+            if (exceptionTypes.length == 0) return Collections.emptyList();
+
+            if (ex == null) {
+              ex = collectSubstituted(substitutor, exceptionTypes, scope);
+            }
+            else {
+              retainExceptions(ex, collectSubstituted(substitutor, exceptionTypes, scope));
             }
           }
         }
       }
+      return ex;
     }
 
     return null;
index 4de4dbeec1f571f184851b8d00118afbc8f37993..68f20356704a967b80673cbf4cd62a50bb78f55c 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.lang.LighterAST;
 import com.intellij.lang.LighterASTNode;
 import com.intellij.psi.JavaTokenType;
 import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiNameHelper;
 import com.intellij.psi.impl.cache.RecordUtil;
 import com.intellij.psi.impl.cache.TypeInfo;
 import com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl;
@@ -169,8 +170,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
         for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
           if (paramStub instanceof PsiParameterStub) {
             TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
-            if (type.arrayCount > 0) continue;
-            String typeName = type.getShortTypeText();
+            String typeName = PsiNameHelper.getShortClassName(type.text);
             if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
             sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
             if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
index 85fbce060fb7025459d1d1e85de811c08edd2005..d6074403ef3ef82cca1de0a669685c91105073d7 100644 (file)
@@ -38,7 +38,7 @@ import java.io.IOException;
  * @author max
  */
 public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileStub> {
-  public static final int STUB_VERSION = 27;
+  public static final int STUB_VERSION = 28;
 
   public JavaFileElementType() {
     super("java.FILE", JavaLanguage.INSTANCE);
index 063242381fc33808052f9e90b0de0e3ec3dc6e3d..1cf442943e97aa4e40d6e53baef09aa9efa36cda 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.CharTable;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.JBIterable;
 import com.intellij.util.containers.Stack;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -92,7 +93,9 @@ public class JavaSharedImplUtil {
     if (modifierList != null) {
       PsiAnnotation[] annotations = modifierList.getAnnotations();
       if (annotations.length > 0) {
-        TypeAnnotationProvider provider = new FilteringTypeAnnotationProvider(annotations);
+        TypeAnnotationProvider original =
+          modifierList.getParent() instanceof PsiMethod ? type.getAnnotationProvider() : TypeAnnotationProvider.EMPTY;
+        TypeAnnotationProvider provider = new FilteringTypeAnnotationProvider(annotations, original);
         if (type instanceof PsiArrayType) {
           Stack<PsiArrayType> types = new Stack<PsiArrayType>();
           do {
@@ -196,10 +199,12 @@ public class JavaSharedImplUtil {
 
   private static class FilteringTypeAnnotationProvider implements TypeAnnotationProvider {
     private final PsiAnnotation[] myCandidates;
+    private final TypeAnnotationProvider myOriginalProvider;
     private volatile PsiAnnotation[] myCache;
 
-    private FilteringTypeAnnotationProvider(PsiAnnotation[] candidates) {
+    private FilteringTypeAnnotationProvider(PsiAnnotation[] candidates, TypeAnnotationProvider originalProvider) {
       myCandidates = candidates;
+      myOriginalProvider = originalProvider;
     }
 
     @NotNull
@@ -207,12 +212,15 @@ public class JavaSharedImplUtil {
     public PsiAnnotation[] getAnnotations() {
       PsiAnnotation[] result = myCache;
       if (result == null) {
-        List<PsiAnnotation> filtered = ContainerUtil.filter(myCandidates, new Condition<PsiAnnotation>() {
-          @Override
-          public boolean value(PsiAnnotation annotation) {
-            return AnnotationTargetUtil.isTypeAnnotation(annotation);
-          }
-        });
+        List<PsiAnnotation> filtered = JBIterable.of(myCandidates)
+          .filter(new Condition<PsiAnnotation>() {
+            @Override
+            public boolean value(PsiAnnotation annotation) {
+              return AnnotationTargetUtil.isTypeAnnotation(annotation);
+            }
+          })
+          .append(myOriginalProvider.getAnnotations())
+          .toList();
         myCache = result = filtered.isEmpty() ? PsiAnnotation.EMPTY_ARRAY : filtered.toArray(new PsiAnnotation[filtered.size()]);
       }
       return result;
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResourcesWithMultipleCloseInterfaces.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResourcesWithMultipleCloseInterfaces.java
new file mode 100644 (file)
index 0000000..2ff3686
--- /dev/null
@@ -0,0 +1,48 @@
+import java.io.IOException;
+
+class Ex extends Exception {}
+
+interface IOCloseable {
+  void close() throws IOException;
+}
+
+interface ExCloseable {
+  void close() throws Ex;
+}
+
+interface NoExCloseable {
+  void close();
+}
+
+interface TCloseable<T extends Throwable> {
+  void close() throws T;
+}
+
+interface I1 extends AutoCloseable, IOCloseable {}
+interface I1R extends IOCloseable, AutoCloseable {}
+interface I2 extends AutoCloseable, IOCloseable, ExCloseable {}
+interface I3 extends AutoCloseable, NoExCloseable {}
+interface I3R extends NoExCloseable, AutoCloseable {}
+
+interface IT extends AutoCloseable, TCloseable<IOException> {}
+
+class Main {
+  {
+    try (<error descr="Unhandled exception from auto-closeable resource: java.io.IOException">I1 i1 = null</error>) {}
+    try (I1 i11 = null) {
+    } catch (IOException e){}
+    try (I1R i11r = null) {
+    } catch (IOException e){}
+
+    try (I2 i2 = null) {}
+    try (I2 i21 = null) {
+    } catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException e</error>) {}
+    try (I2 i22 = null) {
+    } catch (<error descr="Exception 'Ex' is never thrown in the corresponding try block">Ex e</error>) {}
+
+    try (I3 i3 = null) {}
+    try (I3R i3r = null) {}
+
+    try (<error descr="Unhandled exception from auto-closeable resource: java.io.IOException">IT it = null</error>) {}
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ConstructorReferences.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/ConstructorReferences.java
new file mode 100644 (file)
index 0000000..e51e0df
--- /dev/null
@@ -0,0 +1,9 @@
+class Foo {
+  Foo() { this(() -> 4); }
+
+  Foo(I i) {}
+}
+
+interface <caret>I {
+  int foo();
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/VarargPosition.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/VarargPosition.java
new file mode 100644 (file)
index 0000000..cc76623
--- /dev/null
@@ -0,0 +1,6 @@
+public interface <caret>I {
+  void m();
+}
+
+interface J extends I {}
+
index 12d72c9ed2469a1b3da5bd52332c5aba68a7c93b..a717ecf9a9f1bdf9911dc9a81b9040e0ed4bec30 100644 (file)
@@ -237,7 +237,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase {
       }
       String qualifiedName = aClass.getQualifiedName();
       if (qualifiedName.startsWith("java.lang.invoke")) continue; // java.lang.invoke.MethodHandle has weird access attributes in recent rt.jar which causes spurious highlighting errors
-      if ("Sink".equals(aClass.getName())) continue;
+      if (qualifiedName.contains(".Sink")) continue; // Sink has weird access in class files
       imports.append("import " + qualifiedName + ";\n");
       usages.append("/**/ "+aClass.getName() + " var" + v + " = null; var" + v + ".toString();\n");
       aClasses.add(aClass);
@@ -248,7 +248,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase {
     WriteCommandAction.runWriteCommandAction(null, () -> getEditor().getDocument().setText(text));
 
     List<HighlightInfo> errors = DaemonAnalyzerTestCase.filter(doHighlighting(), HighlightSeverity.WARNING);
-    assertEmpty(errors);
+    assertEmpty(text, errors);
     Random random = new Random();
     int unused = 0;
     for (int i = 0; i < 100; i++) {
index c2062de4ca187fc494d348df5b9ced9aaf278e96..def1ddf0914210363162bd1c9fc4e03b95bc185b 100644 (file)
@@ -179,6 +179,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
   public void testUncheckedExtendedWarnings() { doTest(true, false); }
   public void testInaccessibleInferredTypeForVarargsArgument() { doTest(false, false);}
   public void testRuntimeClassCast() { doTest(true, false);}
+  public void testTryWithResourcesWithMultipleCloseInterfaces() { doTest(false, false);}
 
   public void testJavaUtilCollections_NoVerify() throws Exception {
     PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
index 4c1ab97d7bfde9e1471c05cfe21b28f5f34f099a..20fc3af7e55cc46aa70bd8610635c392a46d84a3 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon;
 import com.intellij.codeInspection.compiler.JavacQuirksInspection;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.testFramework.IdeaTestUtil;
 
@@ -33,11 +32,6 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   private void doTest(boolean warnings, boolean weakWarnings) {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, weakWarnings, false);
   }
index 14d02606cc8680573f19827b6188eeb62fabb482..5a000129aae9cbf6a86501b1c3da75cc80ff723f 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
 import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.testFramework.IdeaTestUtil;
 
@@ -34,11 +33,6 @@ public class LightAdvHighlightingJdk9Test extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable());
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   private void doTest(boolean checkWarnings, boolean checkInfos) {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
   }
index cdfb5a39a4e1a60b803e135a56b21d9cc84de71f..b4f1d7b22dd5ed50fdeafdd530c25396e344bf63 100644 (file)
  */
 package com.intellij.codeInsight.daemon.lambda;
 
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.PsiType;
 import com.intellij.refactoring.ChangeSignatureBaseTest;
 import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
 import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
-import com.intellij.testFramework.IdeaTestUtil;
 
 public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
  
@@ -52,9 +50,4 @@ public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
   protected String getRelativePath() {
     return "/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index acacc42803d51ee30f295fa568a505c5417d3a51..ef179f8155b3a8d796317e393f349cd3a01e1f9f 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
 public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
@@ -70,9 +68,4 @@ public class ConstraintsInferenceMiscTest extends LightDaemonAnalyzerTestCase {
   private void doTest(final boolean checkWarnings) {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index a1f1046f56da2e6f67fa7785c1281bee010e5e97..7a7898d7675790513bc53f55f4bd5b2620e031cf 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
 public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -70,9 +68,4 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
   private void doTest() throws Exception {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index cc967135b31160437ca9822a9c4a602919b27028..7ab0bf361c20d303d251a6a59f03cb474c1e8582 100644 (file)
@@ -50,19 +50,25 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
     myFixture.addClass("public class A {" +
                        "  public I r;" +
                        "}");
-    for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 1; i++) {
-      myFixture.addClass("class B" + i + " { {Runnable r = () -> {};}}"); //ensure common case is used
-    }
+    addManyLambdas();
+
+    doTestOneExpression();
+  }
+
+  public void testVarargPosition() throws Exception {
+    myFixture.addClass("\n" +
+                       "class A {  \n" +
+                       "  <T> void foo(T... r) {}\n" +
+                       "  void bar(J i){foo(i, i, () -> {});}\n" +
+                       "}");
+    addManyLambdas();
 
     doTestOneExpression();
   }
 
   private void doTestOneExpression() {
     myFixture.configureByFile(getTestName(false) + ".java");
-    final PsiElement elementAtCaret = myFixture.getElementAtCaret();
-    assertNotNull(elementAtCaret);
-    final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
-    assertTrue(psiClass != null && psiClass.isInterface());
+    final PsiClass psiClass = findClassAtCaret();
     final Collection<PsiFunctionalExpression> expressions = FunctionalExpressionSearch.search(psiClass).findAll();
     int size = expressions.size();
     assertEquals(1, size);
@@ -71,6 +77,15 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
     assertEquals("() -> {}", next.getText());
   }
 
+  @NotNull
+  private PsiClass findClassAtCaret() {
+    final PsiElement elementAtCaret = myFixture.getElementAtCaret();
+    assertNotNull(elementAtCaret);
+    final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
+    assertTrue(psiClass != null && psiClass.isInterface());
+    return psiClass;
+  }
+
   public void testFieldFromAnonymousClassScope() throws Exception {
     myFixture.configureByFile(getTestName(false) + ".java");
     final PsiElement elementAtCaret = myFixture.getElementAtCaret();
@@ -95,9 +110,7 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
   public void doTestIndexSearch(String expected) {
     myFixture.configureByFile(getTestName(false) + ".java");
 
-    for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 5; i++) {
-      myFixture.addFileToProject("a" + i + ".java", "class Goo {{ Runnable r = () -> {} }}");
-    }
+    addManyLambdas();
 
     PsiClass predicate = JavaPsiFacade.getInstance(getProject()).findClass(Predicate.class.getName(), GlobalSearchScope.allScope(getProject()));
     assert predicate != null;
@@ -105,6 +118,28 @@ public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase
     assertEquals(expected, next.getText());
   }
 
+  public void testConstructorReferences() {
+    myFixture.configureByFile(getTestName(false) + ".java");
+
+    myFixture.addClass("class Bar extends Foo {\n" +
+                       "  public Bar() { super(() -> 1); }\n" +
+                       "\n" +
+                       "  {\n" +
+                       "    new Foo(() -> 2) { };\n" +
+                       "    new Foo(() -> 3);\n" +
+                       "  }\n" +
+                       "}");
+    addManyLambdas();
+
+    assertSize(4, FunctionalExpressionSearch.search(findClassAtCaret()).findAll());
+  }
+
+  private void addManyLambdas() {
+    for (int i = 0; i < JavaFunctionalExpressionSearcher.SMART_SEARCH_THRESHOLD + 5; i++) {
+      myFixture.addFileToProject("a" + i + ".java", "class Goo {{ Runnable r = () -> {} }}");
+    }
+  }
+
   @Override
   protected String getBasePath() {
     return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/lambda/findUsages/";
index 66234ca38ca0ec85c09caa1ad507e3c5605737b9..f0bbbbf0d74a07c341d3351f453aba38d9d7a3a3 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
 public class FunctionalExpressionIncompleteHighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -45,9 +43,4 @@ public class FunctionalExpressionIncompleteHighlightingTest extends LightDaemonA
   private void doTest(final boolean checkWarnings) {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 507d4d181e509373152ff1038113ab343955e0ad..bf246de5f30832cc2b9a1c77383f0a7f3df143a3 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -48,9 +47,4 @@ public class FunctionalTypeWildcardParameterizationTest extends LightDaemonAnaly
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 6cf13ad22cb98a07c7b2dfbef9e204e955acb1c4..980e259b25f11af5782ba7e5ae34f1ac05586b38 100644 (file)
@@ -44,11 +44,6 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
     return new LocalInspectionTool[]{new UncheckedWarningLocalInspection(), new UnusedImportLocalInspection()};
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   public void testReferenceTypeParams() {
     doTest();
   }
index 020befac8ee10e8fd7455f7277e2442058c571bc..19979bc7b9055496b5168ad3c29e54c750b634e8 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.testFramework.IdeaTestUtil;
@@ -26,11 +25,6 @@ import org.jetbrains.annotations.NonNls;
 public class GenericsHighlightingGenerated8Test extends LightDaemonAnalyzerTestCase {
   @NonNls private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/genericsHighlightingGenerated8";
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   public void testEmptyTestT() throws Exception {}
 
   public void _testUnrelatedClasses() throws Exception {
index 2e8a7bd620595da67a586ad21f4d8dfcef507ec1..939c6056f7892a3ac5ddbad209b7b547afc4d30f 100644 (file)
@@ -491,9 +491,4 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 5ba7c67c169ff2e4a95c3ff91ca39b568375fc66..a8ebd709c923d470f214ae882ec3de416b6c3597 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.PlatformTestUtil;
 import org.jetbrains.annotations.NonNls;
@@ -37,9 +36,4 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 0dc3e2f72109869b3f3804106e7e6e9c318bed6b..279f26f2d1e999167a6ded2af6f221bfe198b83a 100644 (file)
@@ -18,13 +18,11 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.ExpectedTypeInfo;
 import com.intellij.codeInsight.ExpectedTypesProvider;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
 import com.intellij.psi.infos.CandidateInfo;
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
 import java.util.Collection;
@@ -203,9 +201,4 @@ public class Java8ExpressionsCheckTest extends LightDaemonAnalyzerTestCase {
       }
     }
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 26d9f6d81960b429ed4e996f596734b0b7eab80c..54ae883f2be04cf1a55dc3e956a69852358b97df 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -83,9 +82,4 @@ public class Java8RegressionTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 673a5cfaa44a8dbb3c7f9ed8bedab8ced9103db2..e6ebf6e2ab0d81e2183bc2e385bd66bd34c8b2e7 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
 public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
@@ -111,9 +109,4 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
   private void doTest(final boolean checkWarnings) {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 5a821021f2ecc6c031a5f91e9506bee6c04f5e00..e7b0bcdba6f3b085d12071049b40bafc9aefe37d 100644 (file)
@@ -18,8 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
@@ -89,9 +87,4 @@ public class LambdaRedundantCastTest extends LightDaemonAnalyzerTestCase {
   private void doTest() {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 97683fca3d57ee4d911ae42161c5e8d08a32c5cc..96880e40835a42465abee7a41db750e62c491924 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -118,9 +117,4 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 7f92628e506dbe4d1d177772f2c8ec77e487342b..6e41ee8e6193a751b9b25b684b770c4c0f3f758c 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
@@ -142,9 +141,4 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 01a6573ebefb3d00cf6b98c13dfe1d3168fc3ab1..3cfeaa32fc5e2021f1b527ae00f7a7551fd0e083 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.codeInsight.daemon.lambda;
 
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -40,9 +39,4 @@ public class NewInferenceCollectingAdditionalConstraintsTest extends LightDaemon
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 7bd35c7b68a0ed535e4fdfdcfd666337ccfa3079..050113fd5ffe65cfa5e5e45c134060daffcd0ac5 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 
@@ -337,11 +336,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-/*
+  /*
   public static Test suite() {
     final TestSuite suite = new TestSuite();
     for (int i = 0; i < 1000; i++) {
index 32055744148158d86d89390248ffc5a5ae5976d6..fda6beefbc4dbddf39bafce54836dc4b907907e6 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -530,9 +529,4 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 56ecc91be0a5b012a4419bd04859afe8dde92370..d9da817f04f80871b4c682140d1cbfb99e32c24d 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.lambda;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.PlatformTestUtil;
 import org.jetbrains.annotations.NonNls;
@@ -237,9 +236,4 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
     doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index aa50430c9664afdd8b4158f3b45474d889e1e11a..75b498bdcac0acc79491de78cec3f683588d6cbb 100644 (file)
@@ -15,9 +15,6 @@
  */
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 /**
  * @author Dmitry Batkovich
  */
@@ -30,9 +27,4 @@ public class AddExceptionFromFieldInitializerToConstructorThrowsTest extends Lig
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/addToConstructorThrows";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index e55cced099851baee51cb3936c4d47fa973877d8..4ef4c493e09dbeb7123cf63ae04f15f715298ea2 100644 (file)
@@ -1,8 +1,5 @@
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 public class AddExceptionToCatchTest extends LightQuickFixParameterizedTestCase {
   public void test() throws Exception {
     doAllTests();
@@ -12,9 +9,4 @@ public class AddExceptionToCatchTest extends LightQuickFixParameterizedTestCase
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/addCatchBlock";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 5fa9b96f574d06968ed02186ae75e39ed9f05fd9..f25775fb962b116ae572b9109d938bbf10175d12 100644 (file)
@@ -1,8 +1,5 @@
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase {
   public void test() throws Exception {
     doAllTests();
@@ -12,9 +9,4 @@ public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index a129c3cbe21df880385ceb3c7a7d955e942eb8f3..f496d6a3b3da99f0851bed6d81ebca659ab03de9 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.AnonymousCanBeLambdaInspection;
 import com.intellij.codeInspection.LocalInspectionTool;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class Anonymous2LambdaInspectionTest extends LightQuickFixParameterizedTe
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 37e0a4cfd4a8eb9acecc0e571ac6c7c518a4fa64..86ad2edfaaf80e66e8c3b3857da90bdbfcf3ced8 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.AnonymousCanBeMethodReferenceInspection;
 import com.intellij.codeInspection.LocalInspectionTool;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class Anonymous2MethodReferenceInspectionTest extends LightQuickFixParame
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 0a4f58ca8bbfd09b2ed7fb792a6d178d00544a99..fbc121e1a2e2c11552affac2a6b924e305dcd8f5 100644 (file)
  */
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
-import com.intellij.testFramework.IdeaTestUtil;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
 
 public class ChangeMethodSignatureFromUsage8Test extends LightQuickFixParameterizedTestCase {
 
@@ -35,9 +30,4 @@ public class ChangeMethodSignatureFromUsage8Test extends LightQuickFixParameteri
   protected LanguageLevel getLanguageLevel() {
     return LanguageLevel.JDK_1_8;
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 90299b35923c1ccbe53fe3291d4fb493d1fe4254..ac0c5b4ae09e49d18a32f31195a64952ccabcdd2 100644 (file)
@@ -1,8 +1,5 @@
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 public class GeneralizeCatchTest extends LightQuickFixParameterizedTestCase {
   public void test() throws Exception {
     doAllTests();
@@ -12,9 +9,4 @@ public class GeneralizeCatchTest extends LightQuickFixParameterizedTestCase {
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/generalizeCatch";
   }
-  
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 125aaf43ce44ed9802ee31f6d1c300c5d968bb68..6c6cda6147ae46befef9133fd5b0996542999826 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection;
 import com.intellij.codeInspection.LocalInspectionTool;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class Lambda2MethodReferenceInspectionTest extends LightQuickFixParameter
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 1a34d12eb4488f5cbf09545217515465de1e471d..757b720c44c62a46487e60e36626b232b716e98a 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.RedundantLambdaCodeBlockInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class RedundantLambdaCodeBlockInspectionTest extends LightQuickFixParamet
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 67659c1af3722f289d31f80729c6dfb5098bb599..110d2deac42d9d7f7c3541728562096ff4710e10 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -35,9 +33,4 @@ public class RedundantTypeArgsInspectionTest extends LightQuickFixParameterizedT
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 15ef5ff77f145cade013fd1cbd3c08792ea9518b..213258fa48ef056eb70be8c0aa47f90cbd36721b 100644 (file)
  */
 
 package com.intellij.codeInsight.daemon.quickFix
+
 import com.intellij.codeInspection.LocalInspectionTool
 import com.intellij.codeInspection.dataFlow.DataFlowInspection
 import com.intellij.openapi.Disposable
 import com.intellij.openapi.command.WriteCommandAction
-import com.intellij.openapi.projectRoots.Sdk
 import com.intellij.openapi.vfs.VfsUtil
 import com.intellij.openapi.vfs.VirtualFile
-import com.intellij.testFramework.IdeaTestUtil
 import org.jetbrains.annotations.NotNull
 
 public class ReplaceFromOfNullableFixTest extends LightQuickFixParameterizedTestCase {
@@ -82,8 +81,4 @@ public abstract class Optional<T> {
     super.afterActionCompleted(testName, contents)
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 8df4cf22e5c5b8ac46266d74a74869c62928cdce..3b486baf08b3d9690a25596060b0d16752a5fd85 100644 (file)
@@ -22,8 +22,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.dataFlow.DataFlowInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTestCase {
@@ -55,9 +53,4 @@ public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTest
     ReplaceFromOfNullableFixTest.cleanupGuava();
     super.afterActionCompleted(testName, contents);
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index eac9703e7ff026bfb3d53f004bdd6ec3ed1c5e79..b9c67141273f48d8da7998925fb5847c0ccb6b3e 100644 (file)
@@ -18,11 +18,9 @@ package com.intellij.codeInsight.daemon.quickFix;
 import com.intellij.codeInspection.ExplicitTypeCanBeDiamondInspection;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.lang.java.JavaLanguage;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -68,9 +66,4 @@ public class Simplify2DiamondInspectionsTest extends LightQuickFixParameterizedT
   protected LanguageLevel getLanguageLevel() {
     return LanguageLevel.JDK_1_8;
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index a112ddfa504567b767307db20a51246c2ad72798..4e6c407ec6f28a4bac0e5132cefe5473243a5dc8 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.StreamApiMigrationInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class StreamApiMigrationInspectionTest extends LightQuickFixParameterized
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 5de09e455807e863c43cf8f678e01beb3f86cdd2..6069a3ff647566381303e133c1dbb3f696a9a695 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.TrivialFunctionalExpressionUsageInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class TrivialFunctionalExpressionUsageInspectionTest extends LightQuickFi
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/trivialFunctionalExpressionUsage";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index 00263f77aab151a538ec5a73b84c7726e7f82bd6..320e749c4475a20ec7bac3daf8976d1e18038a9e 100644 (file)
@@ -17,8 +17,6 @@ package com.intellij.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.TrivialMethodReferenceInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -37,9 +35,4 @@ public class TrivialMethodReferenceInspectionTest extends LightQuickFixParameter
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/trivialMethodReference";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
\ No newline at end of file
index a32d1f339ff3f9eeb091a642ab0817e8b24d4fd3..caa712f1334020bff5fd2a3c9a3e129aa6fb860e 100644 (file)
@@ -15,9 +15,6 @@
  */
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 /**
  * @author Dmitry Batkovich
  */
@@ -30,9 +27,4 @@ public class WrapLongWithMathToIntExactFixTest extends LightQuickFixParameterize
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapLongWithMathToIntExact";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 401fcdc1a61eb9cee93805e2f372628f0561f234..993a3347e221499ace4e0dc4881074f62481be20 100644 (file)
@@ -15,9 +15,6 @@
  */
 package com.intellij.codeInsight.daemon.quickFix;
 
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
-
 /**
  * @author Dmitry Batkovich
  */
@@ -30,9 +27,4 @@ public class WrapObjectWithOptionalFixTest extends LightQuickFixParameterizedTes
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapObjectWithOptional";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index bcfbeb79b701a91885776e01c91e20b5c1b670dc..b1aa1985cdba5c0da03f2a330d3e7117e8815663 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInsight.intention;
 
 import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 
 public class MergeFilterChainActionTest extends LightIntentionActionTestCase {
 
@@ -27,9 +25,4 @@ public class MergeFilterChainActionTest extends LightIntentionActionTestCase {
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/mergeFilter";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index efe14b0a20551c92833c2066b96f1d14c9c917a2..02f1a5967709d6fb519023b77079f4f481757cf4 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInsight.intention;
 
 import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 
 public class SplitFilterActionTest extends LightIntentionActionTestCase {
 
@@ -27,9 +25,4 @@ public class SplitFilterActionTest extends LightIntentionActionTestCase {
   protected String getBasePath() {
     return "/codeInsight/daemonCodeAnalyzer/quickFix/splitFilter";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index bb2e2ba20a0b2b00d7feebae02f86b6ab266e52c..ec5ab5fcd0c52e2eeb16051c93af1640dd227d36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,9 +36,7 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase {
       @interface A { }
       @Target(ElementType.TYPE_USE) @interface TA { int value() default 42; }
 
-      class O {
-        class I { }
-      }
+      class O { class I { } }
 
       @SuppressWarnings("ExceptionClassNameDoesntEndWithException") class E1 extends Exception { }
       @SuppressWarnings("ExceptionClassNameDoesntEndWithException") class E2 extends Exception { }""".stripIndent())
@@ -101,9 +99,9 @@ class AnnotatedTypeTest extends LightCodeInsightFixtureTestCase {
   }
 
   public void testMethodReturnType() {
-    def psi = factory.createMethodFromText("@A @TA(1) String m() { return null; }", context)
-    assertTypeText psi.returnType, "java.lang.@pkg.TA(1) String", "java.lang.String"
-    assertAnnotations psi.returnType, "@TA(1)"
+    def psi = factory.createMethodFromText("@A @TA(1) <T> @TA(2) String m() { return null; }", context)
+    assertTypeText psi.returnType, "java.lang.@pkg.TA(1) @pkg.TA(2) String", "java.lang.String"
+    assertAnnotations psi.returnType, "@TA(1)", "@TA(2)"
   }
 
   private void doTest(String text, String annotated, String canonical) {
index 981fb7fe67ebde13f3eab1ff53dd236a5e832322..0e651d1a61997c7863762b4625494db2b222f2b4 100644 (file)
@@ -23,7 +23,6 @@ package com.intellij.codeInspection;
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
 import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
@@ -63,11 +62,6 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
     IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_1_6, JavaAPIUsagesInspectionTest.this::doTest);
   }
 
-  @Override
-  protected Sdk getTestProjectSdk() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   //generate apiXXX.txt
   /*
   //todo exclude inheritors of ConcurrentMap#putIfAbsent
index 8588e37d1fbf6c1c8ce6244af88bd1d096b713bc..3c28371a74c2d37c1b01075aa4bb53f2fb45fdb3 100644 (file)
@@ -38,6 +38,7 @@ import com.intellij.psi.impl.PsiManagerEx;
 import com.intellij.psi.impl.source.PsiClassImpl;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.testFramework.FileTreeAccessFilter;
+import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
 import com.intellij.testFramework.PsiTestUtil;
 import org.jetbrains.annotations.NotNull;
@@ -62,7 +63,8 @@ public class MagicConstantInspectionTest extends InspectionTestCase {
 
   @Override
   protected Sdk getTestProjectSdk() {
-    return PsiTestUtil.addJdkAnnotations(super.getTestProjectSdk());
+    // has to have JFrame and sources
+    return PsiTestUtil.addJdkAnnotations(IdeaTestUtil.getMockJdk17());
   }
 
   private void doTest() throws Exception {
index a8b27ab21089a263fe5639728f02e7f5ab190f11..d6c194fd1f926a380036cba06e4778ed6b1e636b 100644 (file)
@@ -3,6 +3,7 @@ package com.intellij.codeInspection;
 import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
 import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.openapi.roots.ModuleRootModificationUtil;
 import com.intellij.pom.java.LanguageLevel;
@@ -17,6 +18,12 @@ public class RedundantCast15Test extends InspectionTestCase {
     ModuleRootModificationUtil.setModuleSdk(getModule(), getTestProjectSdk());
   }
 
+  @Override
+  protected Sdk getTestProjectSdk() {
+    // in jdk 8 some casts are unnecessary
+    return IdeaTestUtil.getMockJdk17();
+  }
+
   private void doTest() throws Exception {
     final LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(new RedundantCastInspection());
     doTest("redundantCast/generics/" + getTestName(false), toolWrapper, "java 1.5");
index fe187a68940d12c6af7b3a802761f78261cb33f0..7e9bcf8e18e4bccbedb01aecb8d5317cc43d8009 100644 (file)
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
 
 import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
 import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
 
 public class RedundantCast18Test extends InspectionTestCase {
@@ -35,11 +31,4 @@ public class RedundantCast18Test extends InspectionTestCase {
   public void testForeachValue() throws Exception { doTest(); }
   public void testConditional() throws Exception { doTest(); }
   public void testInferApplicabilityError() throws Exception { doTest(); }
-
-  @Override
-  protected Sdk getTestProjectSdk() {
-    Sdk sdk = IdeaTestUtil.getMockJdk17();
-    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
-    return sdk;
-  }
 }
\ No newline at end of file
index 61dc1d9a560071b41e748f91295c89502fbd6099..4a7d7d1f35ab144f539f0988fb793910aad0c99c 100644 (file)
@@ -17,10 +17,6 @@ package com.intellij.codeInspection;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInspection.unneededThrows.RedundantThrows;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
 
 public class RedundantThrowTest extends InspectionTestCase {
@@ -68,11 +64,4 @@ public class RedundantThrowTest extends InspectionTestCase {
   public void testThrownClausesInFunctionalExpressions() throws Exception {
     doTest();
   }
-
-  @Override
-  protected Sdk getTestProjectSdk() {
-    Sdk sdk = IdeaTestUtil.getMockJdk17();
-    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
-    return sdk;
-  }
 }
index c79fb02d6c61d774465c263af5d28e9a64dbb179..87ab362233908ac3de9d0c8bf6b0c48f09fc7f96 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInspection;
 
 import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -35,11 +33,6 @@ public class SimplifyStreamApiCallChainsInspectionTest extends LightQuickFixPara
     doAllTests();
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   @Override
   protected String getBasePath() {
     return "/inspection/streamApiCallChains";
index ddac3879885c91558391418dbbe7226673129973..c5161190548910ae0cdf087037c60b2e02988661 100644 (file)
@@ -16,8 +16,6 @@
 package com.intellij.codeInspection;
 
 import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -39,9 +37,4 @@ public class StringTokenizerDelimiterInspectionTest extends LightQuickFixParamet
   protected String getBasePath() {
     return "/inspection/stringTokenizerDelimiter";
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 74f27e0b0c113a2f5e18576e9f37f9c08338ce0f..c72432532ad68464ad7449f7ef39450a4013aaf3 100644 (file)
@@ -12,10 +12,6 @@ package com.intellij.codeInspection;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInspection.unusedReturnValue.UnusedReturnValue;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
 
 public class UnusedReturnValueTest extends InspectionTestCase {
@@ -47,13 +43,6 @@ public class UnusedReturnValueTest extends InspectionTestCase {
     doTest();
   }
 
-  @Override
-  protected Sdk getTestProjectSdk() {
-    Sdk sdk = IdeaTestUtil.getMockJdk18();
-    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
-    return sdk;
-  }
-
   public void testSimpleSetter() throws Exception {
     try {
       myTool.IGNORE_BUILDER_PATTERN = true;
index 3b241630e76fb6d221764b7172ba7f50fc7669c5..cd4e7b3afc323ecb058dc63e5080b8a0cabc1a7d 100644 (file)
@@ -17,11 +17,9 @@ package com.intellij.ide.util;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.impl.FindSuperElementsHelper;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Collection;
@@ -38,11 +36,6 @@ public class JavaSuperMethodTest extends LightDaemonAnalyzerTestCase {
     return "/codeInsight/gotosuper/";
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   public void testDoNotGoToSiblingInheritanceIfInLibrary() throws Throwable {
     configureByFile(getBasePath() + "OverridingLibrary.java");
 
index 94d4a659674bb870abfe5bb4299c394f6c4e6dd7..d4c3e9980fbd844857d7a8bea48b56b349d20051 100644 (file)
@@ -36,7 +36,6 @@ import com.intellij.testFramework.LightIdeaTestCase;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.text.LineReader;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -147,11 +146,11 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     doTest(getTestName(false) + ".java", getTestName(false) + "_after.java");
   }
 
-  public void doTest(@NonNls String fileNameBefore, @NonNls String fileNameAfter) {
+  public void doTest(@NotNull String fileNameBefore, @NotNull String fileNameAfter) {
     doTextTest(Action.REFORMAT, loadFile(fileNameBefore), loadFile(fileNameAfter));
   }
 
-  public void doTestWithDetectableIndentOptions(@NonNls String text, @NonNls String textAfter) {
+  public void doTestWithDetectableIndentOptions(@NotNull String text, @NotNull String textAfter) {
     DetectableIndentOptionsProvider provider = DetectableIndentOptionsProvider.getInstance();
     assertNotNull("DetectableIndentOptionsProvider not found", provider);
     provider.setEnabledInTest(true);
@@ -163,11 +162,11 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     }
   }
 
-  public void doTextTest(@NonNls final String text, @NonNls String textAfter) throws IncorrectOperationException {
+  public void doTextTest(@NotNull  String text, @NotNull String textAfter) throws IncorrectOperationException {
     doTextTest(Action.REFORMAT, text, textAfter);
   }
 
-  public void doTextTest(@NotNull final Action action, @NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
+  public void doTextTest(@NotNull Action action, @NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
     final PsiFile file = createFile("A.java", text);
     final PsiDocumentManager manager = PsiDocumentManager.getInstance(getProject());
     final Document document = manager.getDocument(file);
@@ -226,7 +225,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     return document.getText();
   }
 
-  public void doMethodTest(@NonNls final String before, @NonNls final String after) {
+  public void doMethodTest(@NotNull String before, @NotNull String after) {
     doTextTest(
       Action.REFORMAT,
       "class Foo{\n" + "    void foo() {\n" + before + '\n' + "    }\n" + "}",
@@ -234,7 +233,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
     );
   }
 
-  public void doClassTest(@NonNls final String before, @NonNls final String after) {
+  public void doClassTest(@NotNull String before, @NotNull String after) {
     doTextTest(
       Action.REFORMAT,
       "class Foo{\n" + before + '\n' + "}",
index 9e60b9a5fc4c5559a36d82f9304dc971c1f4e6d7..63668f03d60ca63ae907c3267d1e9af4eea2cd88 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -150,6 +150,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
     doTextTest(initial, formatted); // Expect spaces to be inserted after unary operators
   }
 
+  @SuppressWarnings("unused")
   public void _testJavadocMethodParams() {
     // Inspired by IDEA-42167
     // Disabled because the contents of the {@code tag} is not necessarily Java code and
@@ -591,7 +592,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
       "};"
     );
   }
-  
+
   public void testCommentBetweenAnnotationAndModifierList() {
     getSettings().KEEP_LINE_BREAKS = false;
     getSettings().KEEP_FIRST_COLUMN_COMMENT = false;
@@ -607,7 +608,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
                 "    int a = 2;\n" +
                 "}");
   }
-  
+
   public void testSpace_BeforeSemicolon_InsideFor() {
     getSettings().SPACE_BEFORE_SEMICOLON = true;
     doMethodTest(
@@ -619,7 +620,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
       "}\n"
     );
   }
-  
+
   public void testSpace_BeforeSemicolon_InsideFor_IfSpacesWithinForIsOn() {
     getSettings().SPACE_WITHIN_FOR_PARENTHESES = true;
     doMethodTest(
@@ -631,7 +632,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
       "}\n"
     );
   }
-  
+
   public void testSpaceBeforeTypeArgumentList() {
     getSettings().SPACE_BEFORE_TYPE_PARAMETER_LIST = true;
     doMethodTest(
@@ -643,7 +644,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
       "Bar. <Int, String>call();"
     );
   }
-  
+
   public void testKeepLineBreaksWorks_InsidePolyExpression() {
     getSettings().KEEP_LINE_BREAKS = false;
     doMethodTest(
@@ -652,5 +653,4 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
       "int x = (1 + 2 + 3) * (1 + 2 + 2) * (1 + 2);"
     );
   }
-  
-}
+}
\ No newline at end of file
index 6961877d7bae332a13f4adc914fc1ee9dc83937f..625dce1c0c43bcbc34fbf22f0f4d755de9c590a2 100644 (file)
@@ -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.
@@ -17,6 +17,7 @@ package com.intellij.psi.formatter.java;
 
 import com.intellij.openapi.util.TextRange;
 import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * @author Denis Zhdanov
@@ -43,7 +44,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
     int end = initial.indexOf("\n", start);
     myTextRange = new TextRange(start, end);
 
-    doTextTest(initial,                     
+    doTextTest(initial,
       "class BrokenAlignment {\n" +
       "    public\n" +
       "\tstatic int foo(String a, String b, String c,\n" +
@@ -64,7 +65,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
       "<caret>\n" +
       "        }" +
       "}",
-      
+
       "class Test {\n" +
       "   // some comment\n" +
       "        public void doSmth(int[] p) {\n" +
@@ -74,7 +75,7 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
   }
 
   @Override
-  public void doTextTest(String text, String textAfter) throws IncorrectOperationException {
+  public void doTextTest(@NotNull String text, @NotNull String textAfter) throws IncorrectOperationException {
     doTextTest(Action.INDENT, adjustTextIfNecessary(text), textAfter);
   }
 
@@ -91,4 +92,4 @@ public class JavaIndenterTest extends AbstractJavaFormatterTest {
     myTextRange = new TextRange(caretIndex, caretIndex);
     return text.substring(0, caretIndex) + text.substring(caretIndex + CARET_TOKEN.length());
   }
-}
+}
\ No newline at end of file
index b5ee7c8771838c7c96a7241075ed807c71b0dc27..a6102422f72480efc30c9664ad23684829e59d1b 100644 (file)
 package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.JavaCodeFragment;
 import com.intellij.psi.JavaCodeFragmentFactory;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
@@ -314,9 +312,4 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
            "        }\n" +
            "    }");
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index deb8f12c38395ba88879addfe2f26442a1e46344..c51c4ae2bbc42532c1a901123e53057d30a367f8 100644 (file)
@@ -22,13 +22,10 @@ package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.TargetElementUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
 import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectHandler;
 import com.intellij.refactoring.extractMethodObject.ExtractMethodObjectProcessor;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 public class ExtractMethodObjectTest extends LightRefactoringTestCase {
@@ -145,9 +142,4 @@ public class ExtractMethodObjectTest extends LightRefactoringTestCase {
   public void testWithPrivateMethodWhichCantBeMoved() throws Exception {
     doTest();
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index e6f177806752cd1d91a4eea80ba0842ef5101342..dbac0ff8100ccf4340c3f60e578a280570a44666 100644 (file)
@@ -17,12 +17,10 @@ package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.openapi.editor.SelectionModel;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.PsiElement;
 import com.intellij.refactoring.extractMethod.ExtractMethodHandler;
 import com.intellij.refactoring.introduceParameter.IntroduceParameterHandler;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.TestDataPath;
 import org.jetbrains.annotations.NotNull;
 
@@ -83,11 +81,6 @@ public class IntroduceFunctionalParameterTest extends LightRefactoringTestCase
     return LanguageLevel.JDK_1_8;
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
-
   private void doTest() {
     doTest(null);
   }
index 56034a69ca8698f1ddcd670e2cfa4c5e9249161b..4ab61941c063ffb821c481d80ab0e833f602bde1 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.refactoring;
 import com.intellij.JavaTestUtil;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.CommonClassNames;
 import com.intellij.psi.PsiElement;
@@ -29,7 +28,6 @@ import com.intellij.refactoring.introduceVariable.InputValidator;
 import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
 import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
 import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.LightCodeInsightTestCase;
 import com.intellij.util.containers.MultiMap;
 import org.jetbrains.annotations.NotNull;
@@ -562,9 +560,4 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
     testMe.invoke(getProject(), getEditor(), getFile(), null);
     checkResultByFile(baseName + ".after.java");
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index c74e41a2138390131ca0bd2c5cd702ab9e3e3129..699d338a410a769b6089a349b72f5c206a4782af 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -26,7 +25,6 @@ import com.intellij.refactoring.memberPullUp.PullUpConflictsUtil;
 import com.intellij.refactoring.memberPullUp.PullUpProcessor;
 import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.util.containers.MultiMap;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
@@ -281,9 +279,4 @@ public class PullUpTest extends LightRefactoringTestCase {
   protected String getTestDataPath() {
     return JavaTestUtil.getJavaTestDataPath();
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index 84648a70edbc70a1ae2428a1bb9904b123ba9444..6271f4dc96fe39d2b8ae767ce86066fed02dd23e 100644 (file)
 package com.intellij.refactoring;
 
 import com.intellij.codeInsight.TargetElementUtil;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.refactoring.memberPushDown.PushDownProcessor;
 import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
-import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.util.containers.MultiMap;
 import org.jetbrains.annotations.NotNull;
@@ -183,9 +181,4 @@ public class PushDownTest extends LightRefactoringTestCase {
 
     checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index ba23b91162c1fe20f1de16bb65bb6a40cbb09a28..6b979db4f82a761dd682440758dd622ea5f1c2d2 100644 (file)
  * limitations under the License.
  */
 package com.intellij.refactoring
+
 import com.intellij.codeInsight.TargetElementUtil
 import com.intellij.codeInsight.lookup.LookupEx
 import com.intellij.codeInsight.lookup.LookupManager
 import com.intellij.codeInsight.template.impl.TemplateManagerImpl
 import com.intellij.codeInsight.template.impl.TemplateState
-import com.intellij.openapi.projectRoots.Sdk
 import com.intellij.psi.PsiElement
 import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
-import com.intellij.testFramework.IdeaTestUtil
 import com.intellij.testFramework.LightCodeInsightTestCase
 /**
  * User: anna
@@ -71,10 +70,6 @@ class RenameSuggestionsTest extends LightCodeInsightTestCase {
     doTestSuggestionAvailable(text, "foo")
   }
 
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18()
-  }
 
   public void "test by Optional_of initializer"() {
     def suggestions = getNameSuggestions("""
index 60e48283bda6eb69950c37c2977f42e68a90eaaf..30c32410e834fa55cd49a7266ed7b988bd14d086 100644 (file)
@@ -17,7 +17,6 @@ package com.intellij.refactoring.inline;
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.TargetElementUtil;
-import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
@@ -27,7 +26,6 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
 import com.intellij.refactoring.LightRefactoringTestCase;
 import com.intellij.refactoring.MockInlineMethodOptions;
 import com.intellij.refactoring.util.InlineUtil;
-import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
@@ -369,9 +367,4 @@ public class InlineMethodTest extends LightRefactoringTestCase {
       new InlineMethodProcessor(getProject(), method, refExpr, myEditor, options.isInlineThisOnly(), nonCode, nonCode);
     processor.run();
   }
-
-  @Override
-  protected Sdk getProjectJDK() {
-    return IdeaTestUtil.getMockJdk18();
-  }
 }
index f3a4f893f3d4e0277f7d7122d88bcad4e34ad3d1..6885606d29649dd7080546543cbc1da1de042ab8 100644 (file)
Binary files a/java/mockJDK-1.8/jre/lib/rt.jar and b/java/mockJDK-1.8/jre/lib/rt.jar differ
index 92e3a7d2c6ad250754c20c5f84e49043fbe4ee70..3538efac632200c0203f7cae9dd0928b31240fc6 100644 (file)
@@ -241,8 +241,8 @@ public abstract class InspectionTestCase extends PsiTestCase {
   }
 
   protected Sdk getTestProjectSdk() {
-    Sdk sdk = IdeaTestUtil.getMockJdk17();
-    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
+    Sdk sdk = IdeaTestUtil.getMockJdk18();
+    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
     return sdk;
   }
 
index 96b7ce7bdd2d31752c3a78ca64bfdcbc6a1035c9..d2e88f1ea0662548cb0b486902cc24b1e1f1636b 100644 (file)
@@ -16,4 +16,12 @@ public interface JsonSchemaFileProvider {
   SchemaType getSchemaType();
 
   int getOrder();
+
+  interface Orders {
+    int CORE = -1000;
+    int EMBEDDED_BASE = 1;
+    int PACKAGE_JSON = 2;
+    int TEST = 10;
+    int USER = 1000;
+  }
 }
index 7883df39f83e9dc63227c0eea8370decaa3e8342..d520f021fc18a2737e667deb5e100c4fdbc104e8 100644 (file)
@@ -77,7 +77,7 @@ public class JsonSchemaImportedProviderFactory implements JsonSchemaProviderFact
 
     @Override
     public int getOrder() {
-      return 1000;
+      return Orders.USER;
     }
 
     @NotNull
index a4366664e4d18917929494f1c8fab8f3473b0481..49a353de5043632310b56251923e885915268e21 100644 (file)
@@ -70,7 +70,7 @@ public class JsonSchemaProjectSelfProviderFactory implements JsonSchemaProviderF
 
     @Override
     public int getOrder() {
-      return -1000;
+      return Orders.CORE;
     }
   }
 }
index e598f876b19755f31f203c76d9c410b9fa45c480..b4e8b661daed8e21faf46239321b35f64e035358 100644 (file)
@@ -39,6 +39,6 @@ public class JsonSchemaTestProvider implements JsonSchemaFileProvider {
 
   @Override
   public int getOrder() {
-    return 10;
+    return Orders.TEST;
   }
 }
diff --git a/lib/annotations/jdk/java/math/annotations.xml b/lib/annotations/jdk/java/math/annotations.xml
new file mode 100644 (file)
index 0000000..e24dbcf
--- /dev/null
@@ -0,0 +1,5 @@
+<root>
+  <item name='java.math.BigInteger java.lang.String toString(int)'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+</root>
\ No newline at end of file
index 13c040f79e71db06400cb4a86a7a5a3ae474f9a9..cc536f329982ba183e958bcaf3ab28fc3aa11bd9 100644 (file)
@@ -41,6 +41,7 @@ public class IdeaForkJoinWorkerThreadFactory implements ForkJoinPool.ForkJoinWor
       }
     };
     thread.setName("JobScheduler FJ pool " + n + "/" + PARALLELISM);
+    thread.setPriority(Thread.NORM_PRIORITY - 1);
     return thread;
   }
 
index e8d95620fac722c13e1f63202af930fec76008ba..372e2c8af7c9742a49261ae7beb676c771883e6b 100644 (file)
@@ -32,6 +32,7 @@ import com.intellij.openapi.ui.Messages
 import com.intellij.openapi.util.SystemInfoRt
 import com.intellij.openapi.util.io.FileUtil
 import com.intellij.openapi.util.io.endsWithName
+import com.intellij.openapi.util.io.setOwnerPermissions
 import com.intellij.openapi.util.registry.Registry
 import com.intellij.openapi.util.text.StringUtil
 import com.intellij.openapi.vfs.VirtualFile
@@ -52,11 +53,8 @@ import java.awt.datatransfer.StringSelection
 import java.io.IOException
 import java.math.BigInteger
 import java.net.InetAddress
-import java.nio.file.Files
 import java.nio.file.Path
 import java.nio.file.Paths
-import java.nio.file.attribute.PosixFileAttributeView
-import java.nio.file.attribute.PosixFilePermission
 import java.security.SecureRandom
 import java.util.*
 import java.util.concurrent.TimeUnit
@@ -127,15 +125,7 @@ private val STANDARD_COOKIE by lazy {
   if (token == null) {
     token = UUID.randomUUID().toString()
     file.write(token!!)
-    val view = Files.getFileAttributeView(file, PosixFileAttributeView::class.java)
-    if (view != null) {
-      try {
-        view.setPermissions(setOf(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE))
-      }
-      catch (e: IOException) {
-        LOG.warn(e)
-      }
-    }
+    file.setOwnerPermissions()
   }
 
   // explicit setting domain cookie on localhost doesn't work for chrome
index 270150b7103c36006d3ad643727fb631f461825d..95f2bd14b5287b102b0d58a1ee7a2cd6b1c4f6e7 100644 (file)
@@ -23,6 +23,7 @@ import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -77,6 +78,12 @@ public abstract class DiffContentFactory {
   @Nullable
   public abstract FileContent createFile(@Nullable Project project, @NotNull VirtualFile file);
 
+  @NotNull
+  public abstract DocumentContent createFragment(@Nullable Project project, @NotNull Document document, @NotNull TextRange range);
+
+  @NotNull
+  public abstract DocumentContent createFragment(@Nullable Project project, @NotNull DocumentContent content, @NotNull TextRange range);
+
   @NotNull
   public abstract DiffContent createClipboardContent();
 
index b33b4b0e54f924b13708f641492d131de39e8e95..b2ff4f6ac40d3d6b968d42f065c70d68031d64e3 100644 (file)
  */
 package com.intellij.diff;
 
+import com.intellij.diff.actions.DocumentFragmentContent;
 import com.intellij.diff.contents.*;
 import com.intellij.ide.highlighter.ArchiveFileType;
 import com.intellij.openapi.application.ReadAction;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.ide.CopyPasteManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vcs.FilePath;
@@ -143,6 +146,19 @@ public class DiffContentFactoryImpl extends DiffContentFactory {
     return (FileContent)create(project, file);
   }
 
+  @NotNull
+  @Override
+  public DocumentContent createFragment(@Nullable Project project, @NotNull Document document, @NotNull TextRange range) {
+    DocumentContent content = create(project, document);
+    return new DocumentFragmentContent(project, content, range);
+  }
+
+  @NotNull
+  @Override
+  public DocumentContent createFragment(@Nullable Project project, @NotNull DocumentContent content, @NotNull TextRange range) {
+    return new DocumentFragmentContent(project, content, range);
+  }
+
   @Override
   @NotNull
   public DiffContent createClipboardContent() {
@@ -225,10 +241,10 @@ public class DiffContentFactoryImpl extends DiffContentFactory {
   }
 
   @NotNull
-  public static VirtualFile createTemporalFile(@Nullable Project project,
-                                               @NotNull String prefix,
-                                               @NotNull String suffix,
-                                               @NotNull byte[] content) throws IOException {
+  private static VirtualFile createTemporalFile(@Nullable Project project,
+                                                @NotNull String prefix,
+                                                @NotNull String suffix,
+                                                @NotNull byte[] content) throws IOException {
     File tempFile = FileUtil.createTempFile(PathUtil.suggestFileName(prefix + "_", true, false),
                                             PathUtil.suggestFileName("_" + suffix, true, false), true);
     if (content.length != 0) {
index 6594d17867787034cae6f7138fbf12e6e018a618..db6c656d0eb059a0c667b9ff45d929583b680b5b 100644 (file)
@@ -106,7 +106,7 @@ public class CompareClipboardWithSelectionAction extends BaseShowDiffAction {
     SelectionModel selectionModel = editor.getSelectionModel();
     if (selectionModel.hasSelection()) {
       TextRange range = new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
-      content = new DocumentFragmentContent(project, content, range);
+      content = DiffContentFactory.getInstance().createFragment(project, content, range);
     }
 
     return content;
index fad819b1040135d636159d349c744bd82e0aa8c1..0bd09104f464035e968d073e654155b218961899 100644 (file)
@@ -41,30 +41,40 @@ public class DocumentFragmentContent extends DiffContentBase implements Document
   // TODO: reuse DocumentWindow ?
 
   @NotNull private final DocumentContent myOriginal;
+  @NotNull private final RangeMarker myRangeMarker;
 
-  @NotNull private final MyDocumentsSynchronizer mySynchonizer;
+  @NotNull private final MyDocumentsSynchronizer mySynchronizer;
 
   private int myAssignments = 0;
 
   public DocumentFragmentContent(@Nullable Project project, @NotNull DocumentContent original, @NotNull TextRange range) {
+    this(project, original, createRangeMarker(original.getDocument(), range));
+  }
+
+  public DocumentFragmentContent(@Nullable Project project, @NotNull DocumentContent original, @NotNull RangeMarker rangeMarker) {
     myOriginal = original;
+    myRangeMarker = rangeMarker;
 
     Document document1 = myOriginal.getDocument();
 
     Document document2 = EditorFactory.getInstance().createDocument("");
     document2.putUserData(UndoManager.ORIGINAL_DOCUMENT, document1);
 
-    RangeMarker rangeMarker = document1.createRangeMarker(range.getStartOffset(), range.getEndOffset(), true);
+    mySynchronizer = new MyDocumentsSynchronizer(project, myRangeMarker, document1, document2);
+  }
+
+  @NotNull
+  private static RangeMarker createRangeMarker(@NotNull Document document, @NotNull TextRange range) {
+    RangeMarker rangeMarker = document.createRangeMarker(range.getStartOffset(), range.getEndOffset(), true);
     rangeMarker.setGreedyToLeft(true);
     rangeMarker.setGreedyToRight(true);
-
-    mySynchonizer = new MyDocumentsSynchronizer(project, rangeMarker, document1, document2);
+    return rangeMarker;
   }
 
   @NotNull
   @Override
   public Document getDocument() {
-    return mySynchonizer.getDocument2();
+    return mySynchronizer.getDocument2();
   }
 
   @Nullable
@@ -76,8 +86,9 @@ public class DocumentFragmentContent extends DiffContentBase implements Document
   @Nullable
   @Override
   public Navigatable getNavigatable(@NotNull LineCol position) {
+    if (!myRangeMarker.isValid()) return null;
     int offset = position.toOffset(getDocument());
-    int originalOffset = offset + mySynchonizer.getStartOffset();
+    int originalOffset = offset + myRangeMarker.getStartOffset();
     LineCol originalPosition = LineCol.fromOffset(myOriginal.getDocument(), originalOffset);
     return myOriginal.getNavigatable(originalPosition);
   }
@@ -109,12 +120,12 @@ public class DocumentFragmentContent extends DiffContentBase implements Document
   @Override
   public void onAssigned(boolean isAssigned) {
     if (isAssigned) {
-      if (myAssignments == 0) mySynchonizer.startListen();
+      if (myAssignments == 0) mySynchronizer.startListen();
       myAssignments++;
     }
     else {
       myAssignments--;
-      if (myAssignments == 0) mySynchonizer.stopListen();
+      if (myAssignments == 0) mySynchronizer.stopListen();
     }
     assert myAssignments >= 0;
   }
@@ -130,14 +141,6 @@ public class DocumentFragmentContent extends DiffContentBase implements Document
       myRangeMarker = range;
     }
 
-    public int getStartOffset() {
-      return myRangeMarker.getStartOffset();
-    }
-
-    public int getEndOffset() {
-      return myRangeMarker.getEndOffset();
-    }
-
     @Override
     protected void onDocumentChanged1(@NotNull DocumentEvent event) {
       if (!myRangeMarker.isValid()) {
@@ -152,9 +155,7 @@ public class DocumentFragmentContent extends DiffContentBase implements Document
 
     @Override
     protected void onDocumentChanged2(@NotNull DocumentEvent event) {
-      if (!myRangeMarker.isValid()) {
-        return;
-      }
+      if (!myRangeMarker.isValid()) return;
       if (!myDocument1.isWritable()) return;
 
       CharSequence newText = event.getNewFragment();
index 038a85eb921f4ccc9f72347bdd6ee8e1910abb4e..37f655cec86518aa5fecd6cb4e31b940778e6f0d 100644 (file)
@@ -155,8 +155,6 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
     String text = "";
     PsiElement[] impls = PsiElement.EMPTY_ARRAY;
     if (element != null) {
-      //if (element instanceof PsiPackage) return;
-
       impls = getSelfAndImplementations(editor, element, createImplementationsSearcher());
       text = SymbolPresentationUtil.getSymbolPresentableText(element);
     }
@@ -176,7 +174,7 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
       }
 
       if (!implsList.isEmpty()) {
-        implsList.toArray( impls = new PsiElement[implsList.size()] );
+        impls = implsList.toArray(new PsiElement[implsList.size()]);
       }
     }
 
@@ -455,7 +453,8 @@ public class ShowImplementationsAction extends AnAction implements PopupAction {
         };
       if (!myIncludeSelf) {
         myElements = getSelfAndImplementations(myEditor, myElement, implementationSearcher, false);
-      } else {
+      }
+      else {
         myElements = getSelfAndImplementations(myEditor, myElement, implementationSearcher);
       }
     }
index 34299445c9ef17cf05a31a72c109078324a94333..d88bb7ed9732701318271ee4a046031ef3d73619 100644 (file)
@@ -35,10 +35,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.startup.StartupManager;
 import com.intellij.openapi.ui.InputValidator;
 import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.Trinity;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
@@ -63,9 +60,9 @@ import java.util.List;
 )
 public class BookmarkManager extends AbstractProjectComponent implements PersistentStateComponent<Element> {
   private static final int MAX_AUTO_DESCRIPTION_SIZE = 50;
+  public static Key<List<Bookmark>> BOOKMARKS_KEY = Key.create("bookmarks");
 
   private final List<Bookmark> myBookmarks = new ArrayList<Bookmark>();
-  private final Map<Document, List<Bookmark>> myDocumentsMap = new WeakHashMap<>();
   private final Map<Trinity<VirtualFile, Integer, String>, Bookmark> myDeletedDocumentBookmarks =
     new HashMap<Trinity<VirtualFile, Integer, String>, Bookmark>();
   private final Map<Document, List<Trinity<Bookmark, Integer, String>>> myBeforeChangeData = new HashMap<>();
@@ -127,21 +124,21 @@ public class BookmarkManager extends AbstractProjectComponent implements Persist
     }, project);
   }
 
-  private void map(Document document, Bookmark bookmark) {
+  private static void map(Document document, Bookmark bookmark) {
     if (document == null || bookmark == null) return;
 
-    List<Bookmark> list = myDocumentsMap.get(document);
+    List<Bookmark> list = document.getUserData(BOOKMARKS_KEY);
     if (list == null) {
-      myDocumentsMap.put(document, list = new ArrayList<Bookmark>());
+      document.putUserData(BOOKMARKS_KEY, list = Collections.synchronizedList(new ArrayList<Bookmark>()));
     }
     list.add(bookmark);
   }
 
-  private void unmap(Document document, Bookmark bookmark) {
+  private static void unmap(Document document, Bookmark bookmark) {
     if (document == null || bookmark == null) return;
-    List<Bookmark> list = myDocumentsMap.get(document);
+    List<Bookmark> list = document.getUserData(BOOKMARKS_KEY);
     if (list != null && list.remove(bookmark) && list.isEmpty()) {
-      myDocumentsMap.remove(document);
+      document.putUserData(BOOKMARKS_KEY, null);
     }
   }
 
@@ -232,7 +229,7 @@ public class BookmarkManager extends AbstractProjectComponent implements Persist
 
   @Nullable
   public Bookmark findEditorBookmark(@NotNull Document document, int line) {
-    List<Bookmark> bookmarks = myDocumentsMap.get(document);
+    List<Bookmark> bookmarks = document.getUserData(BOOKMARKS_KEY);
     if (bookmarks != null) {
       for (Bookmark bookmark : bookmarks) {
         if (bookmark.getLine() == line) {
@@ -294,8 +291,8 @@ public class BookmarkManager extends AbstractProjectComponent implements Persist
         for (Bookmark bookmark : myBookmarks) {
           bookmark.release();
           publisher.bookmarkRemoved(bookmark);
+          unmap(bookmark.getDocument(), bookmark);
         }
-        myDocumentsMap.clear();
         myBookmarks.clear();
 
         readExternal(state);
@@ -406,7 +403,7 @@ public class BookmarkManager extends AbstractProjectComponent implements Persist
 
   @Nullable
   public Bookmark findLineBookmark(@NotNull Editor editor, boolean isWrapped, boolean next) {
-    List<Bookmark> bookmarksForDocument = myDocumentsMap.get(editor.getDocument());
+    List<Bookmark> bookmarksForDocument = editor.getDocument().getUserData(BOOKMARKS_KEY);
     if (bookmarksForDocument == null) return null;
     int sign = next ? 1 : -1;
     Collections.sort(bookmarksForDocument, (o1, o2) -> sign * (o1.getLine() - o2.getLine()));
index 051f42c3ebe986f3e2be4cf12b4866174b2fb49b..67fc45cc4613dc81908c1d67814fabce53c348f5 100644 (file)
@@ -438,7 +438,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
       String subId = subPane.getAttributeValue(ATTRIBUTE_SUBID);
       TreeState treeState = new TreeState();
       treeState.readExternal(subPane);
-      myReadTreeState.put(subId, treeState);
+      if (!treeState.isEmpty()) myReadTreeState.put(subId, treeState);
     }
   }
 
@@ -458,15 +458,13 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
   protected void saveExpandedPaths() {
     if (myTree != null) {
       TreeState treeState = TreeState.createOn(myTree);
-      myReadTreeState.put(getSubId(), treeState);
+      if (!treeState.isEmpty()) myReadTreeState.put(getSubId(), treeState);
     }
   }
 
   public final void restoreExpandedPaths(){
     TreeState treeState = myReadTreeState.get(getSubId());
-    if (treeState != null) {
-      treeState.applyTo(myTree);
-    }
+    if (treeState != null && !treeState.isEmpty()) treeState.applyTo(myTree);
   }
 
   public void installComparator() {
index d382bc9832988f2a50747c9744e1d9929c02c905..c0e83f53255aa0f8e8a377f2e11927e64d4b969f 100644 (file)
@@ -63,6 +63,8 @@ import com.intellij.util.Alarm;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.Convertor;
 import com.intellij.util.containers.Queue;
+import com.intellij.util.ui.JBInsets;
+import com.intellij.util.ui.JBUI;
 import com.intellij.util.ui.UIUtil;
 import com.intellij.util.ui.tree.TreeUtil;
 import gnu.trove.THashSet;
@@ -674,6 +676,7 @@ public class SingleInspectionProfilePanel extends JPanel {
     final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTreeTable);
     myTreeTable.getTree().setShowsRootHandles(true);
     scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+    scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM + SideBorder.LEFT + SideBorder.TOP));
     TreeUtil.collapseAll(myTreeTable.getTree(), 1);
 
     myTreeTable.getTree().addTreeExpansionListener(new TreeExpansionListener() {
@@ -893,21 +896,21 @@ public class SingleInspectionProfilePanel extends JPanel {
 
         severityPanel.add(new JLabel(InspectionsBundle.message("inspection.severity")),
                           new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
-                                                 new Insets(10, 0, 10, 0), 0, 0));
+                                                 JBUI.insets(10, 0), 0, 0));
         final JComponent severityLevelChooserComponent = severityLevelChooser.createCustomComponent(severityLevelChooser.getTemplatePresentation());
         severityPanel.add(severityLevelChooserComponent,
                           new GridBagConstraints(1, 0, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH,
-                                                 new Insets(10, 0, 10, 0), 0, 0));
+                                                 JBUI.insets(10, 0), 0, 0));
         final JComponent scopesChooserComponent = scopesChooser.createCustomComponent(scopesChooser.getTemplatePresentation());
         severityPanel.add(scopesChooserComponent,
                           new GridBagConstraints(2, 0, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH,
-                                                 new Insets(10, 0, 10, 0), 0, 0));
+                                                 JBUI.insets(10, 0), 0, 0));
         final JLabel label = new JLabel("", SwingConstants.RIGHT);
         severityPanel.add(label,
                           new GridBagConstraints(3, 0, 1, 1, 1, 0,
                                                  GridBagConstraints.EAST,
                                                  GridBagConstraints.BOTH,
-                                                 new Insets(2, 0, 2, 0), 0, 0));
+                                                 JBUI.insets(2, 0), 0, 0));
         severityPanelWeightY = 0.0;
         if (singleNode != null) {
           setConfigPanel(configPanelAnchor, mySelectedProfile.getToolDefaultState(singleNode.getDefaultDescriptor().getKey().toString(),
@@ -983,19 +986,20 @@ public class SingleInspectionProfilePanel extends JPanel {
         panel.setMinimumSize(new Dimension(getMinimumSize().width, 3 * scopesAndScopesAndSeveritiesTable.getRowHeight()));
         severityPanel.add(new JBLabel("Severity by Scope"),
                           new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
-                                                 new Insets(5, 0, 2, 10), 0, 0));
+                                                 JBUI.insets(5, 0, 2, 10), 0, 0));
         severityPanel.add(panel, new GridBagConstraints(0, 1, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
-                                                        new Insets(0, 0, 0, 0), 0, 0));
+                                                        JBUI.insets(0, 0, 0, 0), 0, 0));
         severityPanelWeightY = 0.3;
       }
-      myOptionsPanel.add(severityPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, severityPanelWeightY, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+      myOptionsPanel.add(severityPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, severityPanelWeightY, GridBagConstraints.WEST, GridBagConstraints.BOTH,
+                                                               JBUI.insets(0, 2, 0, 0), 0, 0));
       if (configPanelAnchor.getComponentCount() != 0) {
-        configPanelAnchor.setBorder(IdeBorderFactory.createTitledBorder("Options", false, new Insets(7, 0, 0, 0)));
+        configPanelAnchor.setBorder(IdeBorderFactory.createTitledBorder("Options", false, new JBInsets(7, 0, 0, 0)));
       }
       GuiUtils.enableChildren(myOptionsPanel, isThoughOneNodeEnabled(nodes));
       if (configPanelAnchor.getComponentCount() != 0 || scopesNames.isEmpty()) {
         myOptionsPanel.add(configPanelAnchor, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
-                                                                     new Insets(0, 0, 0, 0), 0, 0));
+                                                                     JBUI.insets(0, 2, 0, 0), 0, 0));
       }
       myOptionsPanel.revalidate();
     }
@@ -1084,7 +1088,7 @@ public class SingleInspectionProfilePanel extends JPanel {
 
     JPanel descriptionPanel = new JPanel(new BorderLayout());
     descriptionPanel.setBorder(IdeBorderFactory.createTitledBorder(InspectionsBundle.message("inspection.description.title"), false,
-                                                                   new Insets(2, 0, 0, 0)));
+                                                                   new JBInsets(2, 2, 0, 0)));
     descriptionPanel.add(ScrollPaneFactory.createScrollPane(myBrowser), BorderLayout.CENTER);
 
     myRightSplitter = new JBSplitter(true, "SingleInspectionProfilePanel.HORIZONTAL_DIVIDER_PROPORTION", DIVIDER_PROPORTION_DEFAULT);
@@ -1100,10 +1104,12 @@ public class SingleInspectionProfilePanel extends JPanel {
     final JPanel northPanel = new JPanel(new GridBagLayout());
     northPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0));
     myProfileFilter.setPreferredSize(new Dimension(20, myProfileFilter.getPreferredSize().height));
-    northPanel.add(myProfileFilter, new GridBagConstraints(0, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
-    northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+    northPanel.add(myProfileFilter, new GridBagConstraints(0, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL,
+                                                           JBUI.emptyInsets(), 0, 0));
+    northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL,
+                                                                                   JBUI.emptyInsets(), 0, 0));
 
-    myMainSplitter = new JBSplitter(false, DIVIDER_PROPORTION_DEFAULT, 0.01f, 0.99f);
+    myMainSplitter = new OnePixelSplitter(false, DIVIDER_PROPORTION_DEFAULT, 0.01f, 0.99f);
     myMainSplitter.setSplitterProportionKey("SingleInspectionProfilePanel.VERTICAL_DIVIDER_PROPORTION");
     myMainSplitter.setFirstComponent(tree);
     myMainSplitter.setSecondComponent(myRightSplitter);
index ba412e965c8ea3564a404a70812702c868a25aa7..4eae11fa4f8bcff12f08253c2d5dbeb10c86a2a2 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.copy;
 
+import com.intellij.ide.scratch.ScratchUtil;
 import com.intellij.ide.util.DirectoryUtil;
 import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.openapi.actionSystem.ActionManager;
@@ -23,6 +24,7 @@ import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
 import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
+import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.ex.FileTypeChooser;
 import com.intellij.openapi.help.HelpManager;
 import com.intellij.openapi.keymap.KeymapUtil;
@@ -43,6 +45,7 @@ import com.intellij.ui.TextFieldWithHistoryWithBrowseButton;
 import com.intellij.ui.components.JBLabelDecorator;
 import com.intellij.ui.components.JBTextField;
 import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.ObjectUtils;
 import com.intellij.util.PathUtil;
 import com.intellij.util.PathUtilRt;
 import com.intellij.util.ui.FormBuilder;
@@ -111,6 +114,10 @@ public class CopyFilesOrDirectoriesDialog extends DialogWrapper {
         VirtualFile vFile = file.getVirtualFile();
         text = RefactoringBundle.message(doClone ? "copy.files.clone.file.0" : "copy.files.copy.file.0", shortenPath(vFile));
         String fileName = vFile.isInLocalFileSystem() ? vFile.getName() : PathUtil.suggestFileName(file.getName(), true, true);
+        if (StringUtil.isEmpty(vFile.getExtension()) && ScratchUtil.isScratch(vFile)) {
+          FileType type = ObjectUtils.notNull(file.getLanguage().getAssociatedFileType(), file.getFileType());
+          fileName = PathUtil.makeFileName(fileName, type.getDefaultExtension());
+        }
         myNewNameField.setText(fileName);
         int dotIdx = fileName.lastIndexOf('.');
         if (dotIdx > 0) {
index a98f2dd271680f5b16408b90beb65f922f5f9332..20f04f3726fad827f9aed24b84b27c2fad22767e 100644 (file)
@@ -17,7 +17,6 @@
 package com.intellij.history.integration.ui.models;
 
 import com.intellij.diff.DiffContentFactory;
-import com.intellij.diff.actions.DocumentFragmentContent;
 import com.intellij.diff.contents.DiffContent;
 import com.intellij.diff.contents.DocumentContent;
 import com.intellij.history.core.revisions.Revision;
@@ -98,8 +97,7 @@ public class SelectionDifferenceModel extends FileDifferenceModel {
     int fromOffset = d.getLineStartOffset(myFrom);
     int toOffset = d.getLineEndOffset(myTo);
 
-    DocumentContent documentContent = DiffContentFactory.getInstance().create(myProject, d);
-    return new DocumentFragmentContent(myProject, documentContent, new TextRange(fromOffset, toOffset));
+    return DiffContentFactory.getInstance().createFragment(myProject, d, new TextRange(fromOffset, toOffset));
   }
 
   private DocumentContent getDiffContent(Revision r, RevisionProcessingProgress p) {
index 50d503b764119bdfafb7ee7d55a8df75e43410c5..5e64427a7829b7a37840ee19fadb4652b10b434f 100644 (file)
 package com.intellij.ide.passwordSafe;
 
 import com.intellij.openapi.components.ServiceManager;
+import org.jetbrains.annotations.NotNull;
 
-/**
- * The password safe component. It allows storing, removing, and retrieving the passwords.
- * Note that on the first access to the password safe functions, the dialog asking for the
- * master password might have to be shown. So the access should be either done from UI thread,
- * or it should be possible to invoke {@link java.awt.EventQueue#invokeAndWait(Runnable)}
- * method when password access methods are invoked.
- *
- * @see com.intellij.ide.passwordSafe.ui.PasswordSafePromptDialog
- */
 public abstract class PasswordSafe implements PasswordStorage {
-
-  /**
-   * @return the instance of password safe service
-   */
+  @NotNull
   public static PasswordSafe getInstance() {
     return ServiceManager.getService(PasswordSafe.class);
   }
index 1411eaa4439ed61be373a3734b9d69e2cf9ea208..538916f6aefdc94e7eb2710c82b2a87da97306da 100644 (file)
@@ -110,6 +110,10 @@ public class TreeState implements JDOMExternalizable {
     this(new ArrayList<List<PathElement>>(), new ArrayList<List<PathElement>>());
   }
 
+  public boolean isEmpty() {
+    return myExpandedPaths.isEmpty() && mySelectedPaths.isEmpty();
+  }
+
   @Override
   public void readExternal(Element element) throws InvalidDataException {
     readExternal(element, myExpandedPaths, PATH);
@@ -492,5 +496,39 @@ public class TreeState implements JDOMExternalizable {
   public void setScrollToSelection(boolean scrollToSelection) {
     myScrollToSelection = scrollToSelection;
   }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("TreeState(").append(myScrollToSelection).append(")");
+    append(sb, " expanded:", myExpandedPaths);
+    append(sb, " selected:", mySelectedPaths);
+    return sb.toString();
+  }
+
+  private static void append(StringBuilder sb, String prefix, Object object) {
+    if (prefix != null) {
+      sb.append(prefix);
+    }
+    if (object instanceof List) {
+      appendList(sb, (List)object);
+    }
+    else {
+      sb.append(object);
+    }
+  }
+
+  private static void appendList(StringBuilder sb, List list) {
+    if (list.isEmpty()) {
+      sb.append("{}");
+    }
+    else {
+      String prefix = "{";
+      for (Object object : list) {
+        append(sb, prefix, object);
+        prefix = ", ";
+      }
+      sb.append("}");
+    }
+  }
 }
 
index f8a7a790fc9649ae396b1e4f59e05b5bc77d62d3..d2d83ac31261938dc6f47822a54ae314a261ac52 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.intellij.diagnostic;
 
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.project.DumbAwareAction;
 
@@ -26,6 +25,10 @@ public class DropAnOutOfMemoryErrorAction extends DumbAwareAction {
   }
 
   public void actionPerformed(AnActionEvent e) {
+    Object[] array = new Object[Integer.MAX_VALUE];
+    for (int i = 0; i < array.length; i++) {
+      array[i] = new Object[Integer.MAX_VALUE];
+    }
     throw new OutOfMemoryError();
   }
 }
\ No newline at end of file
index 3d15ec4ca98f29149a1bbd36169ff20b41ea1a49..92e85cab47d0e340205112aa1d70073502a3cf73 100644 (file)
@@ -29,7 +29,7 @@ class CharToVKeyMap {
     new HashMap<Character, Integer>();
 
   public static Integer get (Character ch) {
-    return charToVKeyMap.get(ch);
+    return charToVKeyMap.containsKey(ch) ? charToVKeyMap.get(ch) : KeyEvent.VK_UNDEFINED;
   }
 
   static {
index 8e590d041972ee1ad7ecc7c2b2ac5c8a54c92f5a..ff3aeb175b055644b93acfa14c4b8b0e01a4f2d9 100644 (file)
         <clientProperties>
           <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
         </clientProperties>
-        <border type="etched" title="On Process Tab Close"/>
+        <border type="etched" title-resource-bundle="messages/IdeBundle" title-key="group.settings.process.tab.close"/>
         <children>
           <component id="a998a" class="com.intellij.ui.components.JBRadioButton" binding="myTerminateProcessJBRadioButton" default-binding="true">
             <constraints>
index ce09b77acbe0c24e55214f609768250d285b764c..9b4dfaa3e9b296ef55812b1a5b52f3b6154a2009 100644 (file)
@@ -439,83 +439,49 @@ public class IdeEventQueue extends EventQueue {
     // Try to get it from editor
     Component sourceComponent = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
 
-    if (ke.getID() == KeyEvent.KEY_PRESSED) {
-      switch (ke.getKeyCode()) {
-        case KeyEvent.VK_CONTROL:
-          if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) {
-            ctrlIsPressedCount++;
-          }
-          break;
-        case KeyEvent.VK_ALT:
-          if (ke.getKeyLocation() == KeyEvent.KEY_LOCATION_LEFT) {
-            if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) {
-              leftAltIsPressed = true;
-            }
-          }
-          break;
-      }
-    }
-    else if (ke.getID() == KeyEvent.KEY_RELEASED) {
-      switch (ke.getKeyCode()) {
-        case KeyEvent.VK_CONTROL:
-          ctrlIsPressedCount = 0;
-          break;
-        case KeyEvent.VK_ALT:
-          if (ke.getKeyLocation() == KeyEvent.KEY_LOCATION_LEFT) {
-            leftAltIsPressed = false;
-          }
-          break;
-      }
-    }
+    switch (ke.getID()) {
+      case KeyEvent.KEY_PRESSED:
+        break;
+      case KeyEvent.KEY_RELEASED:
+        break;
+    }
+
+    //if (!leftAltIsPressed && KeyboardSettingsExternalizable.getInstance().isUkrainianKeyboard(sourceComponent)) {
+    //  if ('ґ' == ke.getKeyChar() || ke.getKeyCode() == KeyEvent.VK_U) {
+    //    ke = new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), 0,
+    //                     KeyEvent.VK_UNDEFINED, 'ґ', ke.getKeyLocation());
+    //    ke.setKeyCode(KeyEvent.VK_U);
+    //    ke.setKeyChar('ґ');
+    //    return ke;
+    //  }
+    //}
+
+    // NB: Standard keyboard layout is an English keyboard layout. If such
+    //     layout is active every KeyEvent that is received has
+    //     a @{code KeyEvent.getKeyCode} key code corresponding to
+    //     the @{code KeyEvent.getKeyChar} key char in the event.
+    //     For  example, VK_MINUS key code and '-' character
+    //
+    // We have a key char. On some non standard layouts it does not correspond to
+    // key code in the event.
 
-    if (!leftAltIsPressed && KeyboardSettingsExternalizable.getInstance().isUkrainianKeyboard(sourceComponent)) {
-      if ('ґ' == ke.getKeyChar() || ke.getKeyCode() == KeyEvent.VK_U) {
-        ke = new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), 0,
-                          KeyEvent.VK_UNDEFINED, 'ґ', ke.getKeyLocation());
-        ke.setKeyCode(KeyEvent.VK_U);
-        ke.setKeyChar('ґ');
-        return ke;
-      }
+    Integer keyCodeFromChar = CharToVKeyMap.get(ke.getKeyChar());
+
+    // Now we have a correct key code as if we'd gotten  a KeyEvent for
+    // standard English layout
+
+    if (keyCodeFromChar == ke.getKeyCode() || keyCodeFromChar == KeyEvent.VK_UNDEFINED) {
+      return e;
     }
 
-    Integer keyCodeFromChar = CharToVKeyMap.get(ke.getKeyChar());
+    // Farther we handle a non standard layout
+
     if (keyCodeFromChar != null) {
       if (keyCodeFromChar != ke.getKeyCode()) {
         // non-english layout
         ke.setKeyCode(keyCodeFromChar);
       }
-
-      //for (int i = 0; sourceComponent == null && i < WindowManagerEx.getInstanceEx().getAllProjectFrames().length; i++) {
-      //  sourceComponent = WindowManagerEx.getInstanceEx().getAllProjectFrames()[i].getComponent();
-      //}
-
-      if (sourceComponent != null) {
-        if (KeyboardSettingsExternalizable.isSupportedKeyboardLayout(sourceComponent)) {
-          if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != 0 /*&& ke.getKeyLocation() == KeyEvent.KEY_LOCATION_RIGHT*/) {
-            // On German keyboard layout on Windows  we are getting on key press
-            // ctrl + alt instead of AltGr
-
-            int modifiers = ke.getModifiers() ^ InputEvent.ALT_DOWN_MASK ^ InputEvent.CTRL_DOWN_MASK;
-
-            if (ctrlIsPressedCount > 1) {
-              modifiers |= InputEvent.CTRL_DOWN_MASK;
-            }
-
-            if (leftAltIsPressed) {
-              modifiers |= InputEvent.ALT_MASK;
-            }
-
-            int oldKeyCode = ke.getKeyCode();
-
-            //noinspection MagicConstant
-            ke = new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), modifiers,
-                             KeyEvent.VK_UNDEFINED, ke.getKeyChar(), KeyEvent.KEY_LOCATION_UNKNOWN);
-
-            ke.setKeyCode(oldKeyCode);
-          }
-        }
       }
-    }
 
     return ke;
   }
index 669b99de49553bcbf48f3a343b2691481c837452..f1edc303a264d0e4c75cac26cfcaef0fc8e53e07 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.openapi.components.Storage;
 
 /**
  * The password safe settings
- * The password database. The internal component for {@link com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterKeyPasswordSafe}.
  */
 @State(
   name = "PasswordSafe",
index 0b7c5e00e83a8bc58ee28805d3f92cf52a79c39a..cffa1c8d2c8dbf165d0378f336566ec717b1ccf1 100644 (file)
@@ -23,6 +23,7 @@ import com.sun.jna.Structure;
 import com.sun.jna.win32.StdCallLibrary;
 import com.sun.jna.win32.W32APIFunctionMapper;
 import com.sun.jna.win32.W32APITypeMapper;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Arrays;
 import java.util.List;
@@ -51,7 +52,8 @@ public class WindowsCryptUtils {
    * @param data the data to protect
    * @return the the protected form the data
    */
-  public static byte[] protect(byte[] data) {
+  @NotNull
+  public static byte[] protect(@NotNull byte[] data) {
     if(data.length == 0) {
       return data;
     }
@@ -74,6 +76,7 @@ public class WindowsCryptUtils {
    * @param data the data to protect
    * @return the the protected form the data
    */
+  @NotNull
   public static byte[] unprotect(byte[] data) {
     if(data.length == 0) {
       return data;
index a33d4277f0f944363d5bc3dafd09fba7bc7bd4bc..d7c886513f00fb3612821d9bd70103e92b1b1275 100644 (file)
@@ -25,6 +25,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.BrowserHyperlinkListener;
 import com.intellij.ui.JBColor;
@@ -45,6 +46,8 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.List;
 
+import static com.intellij.openapi.util.Pair.pair;
+
 /**
  * @author pti
  */
@@ -55,9 +58,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
   private final BuildInfo myNewBuild;
   private final PatchInfo myPatch;
   private final boolean myWriteProtected;
-
-  private String myLicenseInfo = null;
-  private Color myLicenseInfoColor = null;
+  private final Pair<String, Color> myLicenseInfo;
 
   UpdateInfoDialog(@NotNull UpdateChannel channel,
                    @NotNull BuildInfo newBuild,
@@ -74,7 +75,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
     myPatch = patch;
     myWriteProtected = myPatch != null && !new File(PathManager.getHomePath()).canWrite();
     getCancelAction().putValue(DEFAULT_ACTION, Boolean.TRUE);
-    initLicensingInfo(myUpdatedChannel, myNewBuild);
+    myLicenseInfo = initLicensingInfo(myUpdatedChannel, myNewBuild);
     init();
 
     if (incompatiblePlugins != null && !incompatiblePlugins.isEmpty()) {
@@ -83,33 +84,32 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
     }
   }
 
-  private void initLicensingInfo(@NotNull UpdateChannel channel, @NotNull BuildInfo build) {
+  private static Pair<String, Color> initLicensingInfo(UpdateChannel channel, BuildInfo build) {
     LicensingFacade facade = LicensingFacade.getInstance();
-    if (facade != null) {
-      if (channel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
-        myLicenseInfo = IdeBundle.message("updates.channel.bundled.key");
-      }
-      else {
-        Date buildDate = build.getReleaseDate();
-        if (buildDate != null) {
-          Boolean applicable = facade.isApplicableForProduct(buildDate);
-          if (applicable != null) {
-            if (applicable == Boolean.FALSE) {
-              myLicenseInfo = IdeBundle.message("updates.paid.upgrade", channel.getEvalDays());
-              myLicenseInfoColor = JBColor.RED;
-            }
-            else if (facade.isPerpetualForProduct(buildDate) == Boolean.TRUE) {
-              myLicenseInfo = IdeBundle.message("updates.fallback.build");
-            }
-            else {
-              Date expiration = facade.getLicenseExpirationDate();
-              if (expiration != null) {
-                myLicenseInfo = IdeBundle.message("updates.interim.build", DateFormatUtil.formatAboutDialogDate(expiration));
-              }
-            }
-          }
-        }
-      }
+    if (facade == null) return null;
+
+    if (channel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
+      return pair(IdeBundle.message("updates.channel.bundled.key"), null);
+    }
+
+    Date releaseDate = build.getReleaseDate();
+    Boolean applicable = releaseDate == null ? null : facade.isApplicableForProduct(releaseDate);
+    if (applicable == null) {
+      return null;
+    }
+    if (applicable == Boolean.FALSE) {
+      return pair(IdeBundle.message("updates.paid.upgrade", channel.getEvalDays()), JBColor.RED);
+    }
+    if (facade.isPerpetualForProduct(releaseDate) == Boolean.TRUE) {
+      return pair(IdeBundle.message("updates.fallback.build"), null);
+    }
+
+    Date expiration = facade.getLicenseExpirationDate();
+    if (expiration != null) {
+      return pair(IdeBundle.message("updates.interim.build", DateFormatUtil.formatAboutDialogDate(expiration)), null);
+    }
+    else {
+      return null;
     }
   }
 
@@ -269,7 +269,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
       }
 
       if (myLicenseInfo != null) {
-        configureMessageArea(myLicenseArea, myLicenseInfo, myLicenseInfoColor, null);
+        configureMessageArea(myLicenseArea, myLicenseInfo.first, myLicenseInfo.second, null);
       }
     }
   }
index eeb97cb8c019e59464f6df294f48df7a0cbee5e3..fc752370b3c087862b28a924031ca18f9c907c7b 100644 (file)
  */
 package com.intellij.openapi.util.io
 
+import com.intellij.openapi.diagnostic.Logger
 import com.intellij.openapi.util.text.StringUtil
 import com.intellij.util.PathUtilRt
 import java.io.File
+import java.io.IOException
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.attribute.PosixFileAttributeView
+import java.nio.file.attribute.PosixFilePermission
+
+private val LOG = Logger.getInstance("#com.intellij.openapi.util.io.FileUtil")
 
 val File.systemIndependentPath: String
   get() = path.replace(File.separatorChar, '/')
@@ -30,4 +38,15 @@ fun getParentPath(path: String) = StringUtil.nullize(PathUtilRt.getParentPath(pa
 
 fun endsWithSlash(path: String) = path.getOrNull(path.length - 1) == '/'
 
-fun endsWithName(path: String, name: String) = path.endsWith(name) && (path.length == name.length || path.getOrNull(path.length - name.length - 1) == '/')
\ No newline at end of file
+fun endsWithName(path: String, name: String) = path.endsWith(name) && (path.length == name.length || path.getOrNull(path.length - name.length - 1) == '/')
+
+fun Path.setOwnerPermissions() {
+  Files.getFileAttributeView(this, PosixFileAttributeView::class.java)?.let {
+    try {
+      it.setPermissions(setOf(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE))
+    }
+    catch (e: IOException) {
+      LOG.warn(e)
+    }
+  }
+}
\ No newline at end of file
index c8cd453903a962255c284b3fbd385a7f717ab1dc..92e9c6bfc1aefa5fa9dc87f490a4fbe106f4e63a 100644 (file)
@@ -38,6 +38,7 @@ checkbox.save.files.on.frame.deactivation=Save files on frame deactivation
 checkbox.synchronize.files.on.frame.activation=Synchronize files on frame or editor tab activation
 checkbox.reopen.last.project.on.startup=Reopen last project on startup
 checkbox.support.screen.readers=Support screen readers (requires restart)
+group.settings.process.tab.close=On Closing Tool Window with Running Process
 radio.process.close.terminate=Terminate process
 radio.process.close.disaconnect=Disconnect (if available)
 radio.process.close.ask=Ask
index faa1d31b724af7112c9530bab79ea5b122656ff9..c428b8bb0416a955a2f1e3689dc4c9760b348043 100644 (file)
@@ -1,7 +1,21 @@
+/*
+ * 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.ide.passwordSafe.impl.providers.masterKey.windows;
 
 import com.intellij.openapi.util.SystemInfo;
-import com.intellij.ide.passwordSafe.MasterPasswordUnavailableException;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -12,7 +26,7 @@ import java.security.SecureRandom;
  */
 public class WindowsCryptUtilTest {
   @Test
-  public void testProtect() throws MasterPasswordUnavailableException {
+  public void testProtect() {
     if(SystemInfo.isWindows) {
       SecureRandom t = new SecureRandom();
       byte[] data = new byte[256];
index fb13b95f15f506f80882ad8edb42892c32ef1be8..a9d1c6413e15e51d54e3a83d15dd4d4771c3e9c9 100644 (file)
@@ -68,12 +68,6 @@ enum class StepAction {
    */
   IN,
 
-  /**
-   * Step into first scheduled async handler.
-   * @see <a href="https://groups.google.com/a/chromium.org/forum/#!topic/blink-reviews-bindings/LRAHGXErvOc">Chrome debugger suggestion</a>
-   */
-  IN_ASYNC,
-
   /**
    * Step over the current statement.
    */
index a50e2397a79142cdb2272f32d094bf2f084b7cf9..8104b203fceb0fff98e3554c446f6f43bdd11786 100644 (file)
@@ -137,7 +137,7 @@ abstract class DebugProcessImpl<C : VmConnection<*>>(session: XDebugSession,
   override final fun startStepInto(context: XSuspendContext?) {
     val vm = context.vm
     updateLastCallFrame(vm)
-    continueVm(vm, if (vm.captureAsyncStackTraces) StepAction.IN_ASYNC else StepAction.IN)
+    continueVm(vm, StepAction.IN)
   }
 
   override final fun startStepOut(context: XSuspendContext?) {
index 74e0977c91b0ffca63f664bf86f9788c7b915041..48834773f0027923698e3f007070fe7a00bb5c24 100644 (file)
@@ -18,7 +18,9 @@ internal class TypeMap {
     val domainGenerator = domainGeneratorMap!!.get(domainName)
     if (domainGenerator == null) {
       val qName = "$domainName.$typeName";
-      if (qName == "IO.StreamHandle" || qName == "Security.SecurityState") return BoxableType.ANY_STRING // ignore
+      if (qName == "IO.StreamHandle" || qName == "Security.SecurityState" || qName == "Emulation.ScreenOrientation") {
+        return BoxableType.ANY_STRING // ignore
+      }
       throw RuntimeException("Failed to find domain generator: $domainName for type $typeName")
     }
     return direction.get(getTypeData(domainName, typeName)).resolve(this, domainGenerator)
index 63a17b083aa419e733a3ab0e774cfbdb91c3627e..31f8c204d27815509ed24e50110c13f751706609 100644 (file)
@@ -153,7 +153,8 @@ open class OutMessage() {
     writer.endArray()
   }
 
-  fun writeStringList(name: String, value: Collection<String>) {
+  fun writeStringList(name: String, value: Collection<String>?) {
+    if (value == null) return
     beginArguments()
     JsonWriters.writeStringList(writer, name, value)
   }