From 3e797f6a300031044247ec606f352470c2151fde Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Mon, 28 Sep 2015 16:50:36 +0300 Subject: [PATCH 01/16] IDEA-145257 Installation update fails for build installed into path with space --- platform/util/src/com/intellij/util/Restarter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java index c0e3968df4b2..79e28cbf75d5 100644 --- a/platform/util/src/com/intellij/util/Restarter.java +++ b/platform/util/src/com/intellij/util/Restarter.java @@ -96,8 +96,10 @@ public class Restarter { output.write("#!/bin/sh\n"); for (int i = 0; i < beforeRestart.length; i++) { output.write(beforeRestart[i]); - output.write(i == beforeRestart.length - 1 ? '\n' : ' '); + if (i <= beforeRestart.length - 2) output.write(' '); + if (i >= beforeRestart.length - 2) output.write('"'); } + output.write('\n'); } finally { output.close(); From ff929c32b6111a34061c0f102723f17dc4395eab Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Tue, 29 Sep 2015 03:47:23 +0300 Subject: [PATCH 02/16] test fix: django is used as lib in python, not external lib --- .../testSrc/com/jetbrains/python/PythonMockSdk.java | 12 +++++++++--- .../python/fixtures/PyLightProjectDescriptor.java | 10 +++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/python/testSrc/com/jetbrains/python/PythonMockSdk.java b/python/testSrc/com/jetbrains/python/PythonMockSdk.java index f9de2dad53a2..fb4541deea90 100644 --- a/python/testSrc/com/jetbrains/python/PythonMockSdk.java +++ b/python/testSrc/com/jetbrains/python/PythonMockSdk.java @@ -22,6 +22,7 @@ import com.intellij.openapi.projectRoots.SdkType; import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.stubs.StubUpdatingIndex; import com.intellij.util.indexing.FileBasedIndex; import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil; @@ -29,6 +30,7 @@ import com.jetbrains.python.psi.stubs.PyModuleNameIndex; import com.jetbrains.python.sdk.PySdkUpdater; import com.jetbrains.python.sdk.PythonSdkType; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.List; @@ -42,17 +44,17 @@ public class PythonMockSdk { private PythonMockSdk() { } - public static Sdk findOrCreate(String version) { + public static Sdk findOrCreate(final String version, @NotNull final VirtualFile ... additionalRoots) { final List sdkList = ProjectJdkTable.getInstance().getSdksOfType(PythonSdkType.getInstance()); for (Sdk sdk : sdkList) { if (sdk.getName().equals(MOCK_SDK_NAME + " " + version)) { return sdk; } } - return create(version); + return create(version, additionalRoots); } - public static Sdk create(final String version) { + public static Sdk create(final String version, @NotNull final VirtualFile ... additionalRoots) { final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/"; String sdkHome = new File(mock_path, "bin/python"+version).getPath(); @@ -78,6 +80,10 @@ public class PythonMockSdk { String mock_stubs_path = mock_path + PythonSdkType.SKELETON_DIR_NAME; sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByPath(mock_stubs_path), PythonSdkType.BUILTIN_ROOT_TYPE); + for (final VirtualFile root : additionalRoots) { + sdkModificator.addRoot(root, OrderRootType.CLASSES); + } + sdkModificator.commitChanges(); final FileBasedIndex index = FileBasedIndex.getInstance(); diff --git a/python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java b/python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java index f528f229ddaa..52ac1a3caaeb 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java +++ b/python/testSrc/com/jetbrains/python/fixtures/PyLightProjectDescriptor.java @@ -47,7 +47,15 @@ public class PyLightProjectDescriptor extends LightProjectDescriptor { @Override public Sdk getSdk() { - return PythonMockSdk.findOrCreate(myPythonVersion); + return PythonMockSdk.findOrCreate(myPythonVersion, getAdditionalRoots()); + } + + /** + * @return additional roots to add to mock python + */ + @NotNull + protected VirtualFile[] getAdditionalRoots() { + return VirtualFile.EMPTY_ARRAY; } protected void createLibrary(ModifiableRootModel model, final String name, final String path) { From 0bb4f48d7b6cb47cbfcd7b33742486ba194d70d3 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 29 Sep 2015 08:54:28 +0200 Subject: [PATCH 03/16] WEB-17450 Startup failure when blocked in firewall --- .../src/com/intellij/idea/SocketLock.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/idea/SocketLock.java b/platform/platform-impl/src/com/intellij/idea/SocketLock.java index ac72ed55778b..9c39bbe7db15 100644 --- a/platform/platform-impl/src/com/intellij/idea/SocketLock.java +++ b/platform/platform-impl/src/com/intellij/idea/SocketLock.java @@ -18,6 +18,7 @@ package com.intellij.idea; import com.intellij.CommonBundle; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.diagnostic.DefaultLogger; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; @@ -42,7 +43,10 @@ import org.jetbrains.io.MessageDecoder; import javax.swing.*; import java.io.*; import java.net.Socket; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicReference; /** @@ -100,7 +104,7 @@ public final class SocketLock { }); } catch (Throwable e) { - LOG.error(e); + logError(e); } } } @@ -179,7 +183,7 @@ public final class SocketLock { }); } catch (Throwable e) { - LOG.error(e); + logError(e); if (Main.isHeadless()) { Main.showMessage("Cannot lock system folders", e); @@ -213,12 +217,22 @@ public final class SocketLock { closeable.close(); } catch (Throwable e) { - LOG.error(e); + logError(e); } } } } + private static void logError(@NotNull Throwable e) { + // default logger throws AssertionError and it leads to startup failure without error message dialog + if (LOG instanceof DefaultLogger) { + LOG.warn(e); + } + else { + LOG.error(e); + } + } + @SuppressWarnings({"SocketOpenedButNotSafelyClosed", "IOResourceOpenedButNotSafelyClosed"}) @NotNull private static ActivateStatus tryActivate(int portNumber, @NotNull Collection paths, @NotNull String[] args) { From 7724e14b58ba02502d08d92eb610cc7866628830 Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Tue, 29 Sep 2015 11:51:01 +0300 Subject: [PATCH 04/16] Api for adding process listeners in StudyRunAction --- .../edu/learning/actions/StudyRunAction.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java index e466ada6c270..ebf0fa887538 100644 --- a/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java +++ b/python/educational/interactive-learning/src/com/jetbrains/edu/learning/actions/StudyRunAction.java @@ -5,6 +5,7 @@ import com.intellij.execution.RunContentExecutor; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.process.ProcessHandler; +import com.intellij.execution.process.ProcessListener; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.diagnostic.Logger; @@ -24,12 +25,14 @@ import com.jetbrains.edu.learning.courseFormat.UserTest; import com.jetbrains.edu.learning.editor.StudyEditor; import org.jetbrains.annotations.NotNull; +import java.util.LinkedList; import java.util.List; public class StudyRunAction extends DumbAwareAction { private static final Logger LOG = Logger.getInstance(StudyRunAction.class.getName()); public static final String ACTION_ID = "StudyRunAction"; private ProcessHandler myHandler; + private List myProcessListeners = new LinkedList(); public StudyRunAction() { super("Run File With Tests", "Run your code with tests", AllIcons.General.Run); @@ -75,6 +78,11 @@ public class StudyRunAction extends DumbAwareAction { return; } myHandler = new OSProcessHandler(process); + + for (ProcessListener processListener : myProcessListeners) { + myHandler.addProcessListener(processListener); + } + final RunContentExecutor executor = StudyUtils.getExecutor(project, currentTask, myHandler); if (executor != null) { Disposer.register(project, executor); @@ -84,6 +92,14 @@ public class StudyRunAction extends DumbAwareAction { } } + public void addProcessListener(@NotNull final ProcessListener processListener) { + myProcessListeners.add(processListener); + } + + public void removeProcessListener(@NotNull final ProcessListener processListener) { + myProcessListeners.remove(processListener); + } + public void actionPerformed(@NotNull AnActionEvent e) { final Project project = e.getProject(); if (project != null) { From 15369d718e73c55af7ce7ae3f6b6e16ccd0f872a Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 29 Sep 2015 11:05:10 +0200 Subject: [PATCH 05/16] IDEA-145680 Basic completion doesn't work inside method call after "<" in if condition --- .../completion/JavaCompletionContributor.java | 3 ++- .../codeInsight/completion/normal/IfConditionLt.java | 9 +++++++++ .../completion/HeavyNormalCompletionTest.groovy | 2 +- .../codeInsight/completion/NormalCompletionTest.groovy | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/completion/normal/IfConditionLt.java diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java index 1939ef31d060..a196cf93eec4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java @@ -768,7 +768,8 @@ public class JavaCompletionContributor extends CompletionContributor { iterator.advance(); } - if (!iterator.atEnd() && (iterator.getTokenType() == JavaTokenType.LPARENTH)) { + if (!iterator.atEnd() && iterator.getTokenType() == JavaTokenType.LPARENTH && PsiTreeUtil.getParentOfType(ref, PsiExpression.class, PsiClass.class) == null) { + // looks like a method declaration, e.g. StringBuimethodName() inside a class return true; } diff --git a/java/java-tests/testData/codeInsight/completion/normal/IfConditionLt.java b/java/java-tests/testData/codeInsight/completion/normal/IfConditionLt.java new file mode 100644 index 000000000000..580a2eedb323 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normal/IfConditionLt.java @@ -0,0 +1,9 @@ +class Zoo { + + void foo(int x) { + if (x < getAnnotationsAreaOffset()); + + } + + int getAnnotationsAreaOffset() {} +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyNormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyNormalCompletionTest.groovy index 2117c9e877f2..3852327e36e9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyNormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyNormalCompletionTest.groovy @@ -117,7 +117,7 @@ public class HeavyNormalCompletionTest extends JavaCodeInsightFixtureTestCase { myFixture.completeBasic(); assertOrderedEquals(myFixture.getLookupElementStrings(), "getAaa", "getBbb"); myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getCaretModel().getOffset() + 2); - assertNull(myFixture.completeBasic()); + assert myFixture.completeBasic() == null } public void testQualifyInaccessibleClassName() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy index df9087e84238..22a692ec25b4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -512,6 +512,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { public void testBreakInIfCondition() throws Throwable { doTest(); } public void testAccessStaticViaInstance() throws Throwable { doTest(); } + public void testIfConditionLt() { + configure() + myFixture.assertPreferredCompletionItems 0, 'getAnnotationsAreaOffset' + } + public void testAccessStaticViaInstanceSecond() throws Throwable { configure() myFixture.complete(CompletionType.BASIC, 2) From b13d509891463dbf40c34c435d117d51cf89ced7 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 29 Sep 2015 11:37:44 +0200 Subject: [PATCH 06/16] [platform] file appearance service impl moved to platform (WEB-14408) --- .../intellij/openapi/roots/ui/FileAppearanceServiceImpl.java | 2 +- .../intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java | 2 +- .../openapi/roots/ui/util/JarSubfileCellAppearance.java | 2 +- .../openapi/roots/ui/util/ValidFileCellAppearance.java | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) rename {java/idea-ui => platform/platform-impl}/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java (98%) rename {java/idea-ui => platform/platform-impl}/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java (95%) rename {java/idea-ui => platform/platform-impl}/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java (96%) rename {java/idea-ui => platform/platform-impl}/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java (94%) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java similarity index 98% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java rename to platform/platform-impl/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java index 82682f452801..de5cd66d19c3 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/roots/ui/FileAppearanceServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 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. diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java similarity index 95% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java rename to platform/platform-impl/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java index 8ab9551c9e57..c69be680cedd 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java +++ b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/HttpUrlCellAppearance.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2015 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. diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java similarity index 96% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java rename to platform/platform-impl/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java index ed4fd082ff7d..49009bd11723 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java +++ b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/JarSubfileCellAppearance.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2015 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. diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java similarity index 94% rename from java/idea-ui/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java rename to platform/platform-impl/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java index 89c7cdcc56b5..ec62d30bf3ee 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java +++ b/platform/platform-impl/src/com/intellij/openapi/roots/ui/util/ValidFileCellAppearance.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.intellij.openapi.roots.ui.util; -import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.vfs.VirtualFile; import javax.swing.*; From ff6559e2422aa717ab4afcdc323096a1dafbd5e0 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 28 Sep 2015 18:00:12 +0200 Subject: [PATCH 07/16] EA-73655 (IOE: PsiElementFactoryImpl.createKeyword) --- .../ig/classlayout/UtilityClassCanBeEnumInspection.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java index 89ce1411ea1f..7b5416fa6975 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java @@ -19,6 +19,7 @@ import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.util.PsiUtil; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; @@ -97,6 +98,11 @@ public class UtilityClassCanBeEnumInspection extends BaseInspection { return new UtilityClassCanBeEnumVisitor(); } + @Override + public boolean shouldInspect(PsiFile file) { + return PsiUtil.isLanguageLevel5OrHigher(file); + } + private static class UtilityClassCanBeEnumVisitor extends BaseInspectionVisitor { @Override From f5c8a630448e13e48f1359fb20a2cba25690a686 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 29 Sep 2015 12:02:16 +0200 Subject: [PATCH 08/16] SSR: match multiple fields declared in single declaration correctly in incomplete code (IDEA-CR-4531) --- .../impl/matcher/handlers/DeclarationStatementHandler.java | 4 +++- .../intellij/structuralsearch/StructuralSearchTest.java | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java index 6ebf9d238c95..acd6e91bfa96 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java @@ -22,6 +22,7 @@ import java.util.List; public class DeclarationStatementHandler extends MatchingHandler { private MatchingHandler myCommentHandler; + @Override public boolean match(PsiElement patternNode, PsiElement matchedNode, MatchContext context) { if (patternNode instanceof PsiComment) { return myCommentHandler.match(patternNode, matchedNode, context); @@ -59,7 +60,7 @@ public class DeclarationStatementHandler extends MatchingHandler { node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class); while (PsiUtil.isJavaToken(node, JavaTokenType.COMMA)) { node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class); - if (node != null) { + if (node instanceof PsiField) { matchNodes.add(node); } node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class); @@ -89,6 +90,7 @@ public class DeclarationStatementHandler extends MatchingHandler { return false; } + @Override public boolean shouldAdvanceTheMatchFor(PsiElement patternElement, PsiElement matchedElement) { if (patternElement instanceof PsiComment && ( matchedElement instanceof PsiField || diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java index c7d2f94c770b..a0ff99c09ac9 100644 --- a/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java +++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/StructuralSearchTest.java @@ -3291,5 +3291,12 @@ public class StructuralSearchTest extends StructuralSearchTestCase { assertEquals("find declarations with only one field", 1, findMatchesCount(source, "int '_a;")); assertEquals("find all declarations", 4, findMatchesCount(source, "int '_a+;")); assertEquals("find all fields", 9, findMatchesCount(source, "int 'a+;")); + + String source2 = "class ABC {" + + " String u;" + + " String s,t," + + " void m() {}" + + "}"; + assertEquals("find incomplete code", 1, findMatchesCount(source2, "'_a '_b{2,100};")); } } From cc8deca74d6c77b13c6ebdb9b68021e34417297e Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 29 Sep 2015 12:03:49 +0200 Subject: [PATCH 09/16] sm runner: ensure disposer are not registered after parent was already disposed (IDEA-145661) --- .../sm/runner/ui/SMTestRunnerResultsForm.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java index dee35b645c08..e53c009c5bb9 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java @@ -117,6 +117,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel private AbstractTestProxy myLastSelected; private Alarm myUpdateQueue; private Set myRequests = Collections.synchronizedSet(new HashSet()); + private boolean myDisposed = false; public SMTestRunnerResultsForm(@NotNull final JComponent console, final TestConsoleProperties consoleProperties) { @@ -337,13 +338,14 @@ public class SMTestRunnerResultsForm extends TestResultsPanel addToHistory(testsRoot, myProperties, this); } - private static void addToHistory(final SMTestProxy.SMRootTestProxy root, - TestConsoleProperties consoleProperties, - Disposable parentDisposable) { + private void addToHistory(final SMTestProxy.SMRootTestProxy root, + TestConsoleProperties consoleProperties, + Disposable parentDisposable) { final RunProfile configuration = consoleProperties.getConfiguration(); if (configuration instanceof RunConfiguration && !(consoleProperties instanceof ImportedTestConsoleProperties) && - !ApplicationManager.getApplication().isUnitTestMode()) { + !ApplicationManager.getApplication().isUnitTestMode() && + !myDisposed) { final MySaveHistoryTask backgroundable = new MySaveHistoryTask(consoleProperties, root, (RunConfiguration)configuration); final BackgroundableProcessIndicator processIndicator = new BackgroundableProcessIndicator(backgroundable); Disposer.register(parentDisposable, new Disposable() { @@ -532,6 +534,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel myShowStatisticForProxyHandler = null; myEventListeners.clear(); myStatisticsPane.doDispose(); + myDisposed = true; } public void showStatisticsForSelectedProxy() { From b38a8aa6d1f416e23bd4e774076c8b4921b601da Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Tue, 29 Sep 2015 12:08:31 +0200 Subject: [PATCH 10/16] fix kotlin compatibility --- .../testng/configuration/TestNGConfigurationProducer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationProducer.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationProducer.java index 8b07de478261..2f6d390163ac 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationProducer.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationProducer.java @@ -42,6 +42,11 @@ public abstract class TestNGConfigurationProducer extends JavaRunConfigurationPr super(configurationType); } + @SuppressWarnings("unused") //used in kotlin + public TestNGConfigurationProducer() { + super(TestNGConfigurationType.getInstance()); + } + @Override public boolean isConfigurationFromContext(TestNGConfiguration testNGConfiguration, ConfigurationContext context) { if (RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class).isMultipleElementsSelected(context)) { From bf24c1e6daa053adf6f566c5b292e6259e585884 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 29 Sep 2015 13:23:12 +0300 Subject: [PATCH 11/16] areas description in javadoc --- .../impl/EditorGutterComponentImpl.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 6bfb8b63c2e1..73502af88781 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -80,6 +80,36 @@ import java.awt.geom.AffineTransform; import java.util.*; import java.util.List; +/** + * Gutter content (left to right): + *
    + *
  • GAP_BETWEEN_AREAS
  • + *
  • Line numbers area + *
      + *
    • Line numbers
    • + *
    • GAP_BETWEEN_AREAS
    • + *
    • Additional line numbers (used in diff)
    • + *
    + *
  • + *
  • GAP_BETWEEN_AREAS
  • + *
  • Annotations area + *
      + *
    • Annotations
    • + *
    • Annotations extra (used in distraction free mode)
    • + *
    + *
  • + *
  • GAP_BETWEEN_AREAS
  • + *
  • Line markers area + *
      + *
    • Left free painters
    • + *
    • Icons
    • + *
    • GAP_BETWEEN_AREAS
    • + *
    • Free painters
    • + *
    + *
  • + *
  • Folding area
  • + *
+ */ class EditorGutterComponentImpl extends EditorGutterComponentEx implements MouseListener, MouseMotionListener, DataProvider { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.EditorGutterComponentImpl"); private static final int START_ICON_AREA_WIDTH = 15; From b6803293039a58dbbf3a8b3239daf9ae15836629 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Tue, 29 Sep 2015 13:33:39 +0300 Subject: [PATCH 12/16] mark NodeJS 142.3858 as broken --- platform/platform-resources/src/brokenPlugins.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt index d7af8ba68e7c..c4be860144f5 100644 --- a/platform/platform-resources/src/brokenPlugins.txt +++ b/platform/platform-resources/src/brokenPlugins.txt @@ -1,7 +1,7 @@ // This file contains list of broken plugins. // Each line contains plugin ID and list of versions that are broken. // If plugin name or version contains a space you can quote it like in command line. -NodeJS 142.4100 142.3224 142.2650 142.2492 142.2481 142.2064 141.1108 140.2045 140.1669 140.642 139.173 139.105 139.496 139.1 139.8 138.2196 138.2254 138.1684 138.1744 138.1879 138.2051 138.1367 138.1495 138.1189 138.1145 138.937 138.1013 138.921 138.447 138.172 138.317 138.21 138.35 138.96 138.85 136.1205 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 136.1141 +NodeJS 142.4100 142.3858 142.3224 142.2650 142.2492 142.2481 142.2064 141.1108 140.2045 140.1669 140.642 139.173 139.105 139.496 139.1 139.8 138.2196 138.2254 138.1684 138.1744 138.1879 138.2051 138.1367 138.1495 138.1189 138.1145 138.937 138.1013 138.921 138.447 138.172 138.317 138.21 138.35 138.96 138.85 136.1205 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 136.1141 com.jetbrains.php 140.2765 141.332 139.732 139.659 139.496 139.173 139.105 138.2502 138.2000.2262 138.1751 138.1806 138.1505 138.1161 138.826 136.1768 136.1672 134.1456 133.982 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12 com.jetbrains.lang.ejs 131.17 131.12 com.jetbrains.twig 133.51 130.1639 From 45777394e67405035afe4c12f0f4577793ab61c9 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 25 Sep 2015 19:06:43 +0300 Subject: [PATCH 13/16] test fix --- .../com/intellij/application/ApplicationImplTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java index 66e9dc715d89..9b2e48189634 100644 --- a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java @@ -449,11 +449,12 @@ public class ApplicationImplTest extends LightPlatformTestCase { try { System.out.println("write lock acquired"); writeAcquired.set(true); - assertTrue(application.isWriteActionInProgress()); - assertTrue(application.isWriteAccessAllowed()); - assertTrue(application.isWriteActionPending()); - while (holdWrite.get() && ok()); + while (holdWrite.get() && ok()) { + assertTrue(application.isWriteActionInProgress()); + assertTrue(application.isWriteAccessAllowed()); + //assertTrue(application.isWriteActionPending()); depends on how you look at it, so leave it for now + } } finally { writeReleased.set(true); From 371e3ad580073f20291b306d87a93713e06bb2fb Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 25 Sep 2015 19:33:48 +0300 Subject: [PATCH 14/16] cleanup: lazy value for icons doesn't make sense with advent of AllIcons --- .../src/com/intellij/ide/JavaFileIconPatcher.java | 7 ++++--- .../intellij/ide/highlighter/JavaClassFileType.java | 13 ++----------- .../intellij/ide/highlighter/ArchiveFileType.java | 13 ++----------- .../intellij/openapi/fileTypes/UnknownFileType.java | 12 ++---------- 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/java/java-impl/src/com/intellij/ide/JavaFileIconPatcher.java b/java/java-impl/src/com/intellij/ide/JavaFileIconPatcher.java index b7d9d56006cd..db7b27e59bd5 100644 --- a/java/java-impl/src/com/intellij/ide/JavaFileIconPatcher.java +++ b/java/java-impl/src/com/intellij/ide/JavaFileIconPatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package com.intellij.ide; -import com.intellij.lang.StdLanguages; +import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.compiler.CompilerManager; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.StdFileTypes; @@ -36,6 +36,7 @@ import javax.swing.*; * @author yole */ public class JavaFileIconPatcher implements FileIconPatcher { + @Override public Icon patchIcon(final Icon baseIcon, final VirtualFile file, final int flags, final Project project) { if (project == null) { return baseIcon; @@ -58,7 +59,7 @@ public class JavaFileIconPatcher implements FileIconPatcher { } PsiFile psiFile = PsiManager.getInstance(project).findFile(file); - if (psiFile instanceof PsiClassOwner && psiFile.getViewProvider().getBaseLanguage() == StdLanguages.JAVA) { + if (psiFile instanceof PsiClassOwner && psiFile.getViewProvider().getBaseLanguage() == JavaLanguage.INSTANCE) { PsiClass[] classes = ((PsiClassOwner)psiFile).getClasses(); if (classes.length > 0) { // prefer icon of the class named after file diff --git a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java index e203f41c1626..8040151b2ceb 100644 --- a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java +++ b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package com.intellij.ide.highlighter; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeBundle; import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; @@ -28,14 +27,6 @@ public class JavaClassFileType implements FileType { public static final JavaClassFileType INSTANCE = new JavaClassFileType(); - private static final NotNullLazyValue ICON = new NotNullLazyValue() { - @NotNull - @Override - protected Icon compute() { - return AllIcons.FileTypes.JavaClass; - } - }; - private JavaClassFileType() { } @@ -59,7 +50,7 @@ public class JavaClassFileType implements FileType { @Override public Icon getIcon() { - return ICON.getValue(); + return AllIcons.FileTypes.JavaClass; } @Override diff --git a/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java b/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java index 4c61d42cb84f..18007ca2588a 100644 --- a/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java +++ b/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,21 +18,12 @@ package com.intellij.ide.highlighter; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeBundle; import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import javax.swing.*; public class ArchiveFileType implements FileType { - private static final NotNullLazyValue ICON = new NotNullLazyValue() { - @NotNull - @Override - protected Icon compute() { - return AllIcons.FileTypes.Archive; - } - }; - public static final ArchiveFileType INSTANCE = new ArchiveFileType(); @Override @@ -55,7 +46,7 @@ public class ArchiveFileType implements FileType { @Override public Icon getIcon() { - return ICON.getValue(); + return AllIcons.FileTypes.Archive; } @Override diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java index 5e34421c6ca3..6bd98c1419c6 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,12 @@ package com.intellij.openapi.fileTypes; import com.intellij.icons.AllIcons; -import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import javax.swing.*; public class UnknownFileType implements FileType { - private static final NotNullLazyValue ICON = new NotNullLazyValue() { - @NotNull - @Override - protected Icon compute() { - return AllIcons.FileTypes.Unknown; - } - }; public static final FileType INSTANCE = new UnknownFileType(); private UnknownFileType() {} @@ -54,7 +46,7 @@ public class UnknownFileType implements FileType { @Override public Icon getIcon() { - return ICON.getValue(); + return AllIcons.FileTypes.Unknown; } @Override From 34673408769d12be78932a1ffa0d0e0c844e0883 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 29 Sep 2015 13:34:07 +0300 Subject: [PATCH 15/16] test fix --- .../com/intellij/application/ApplicationImplTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java index 9b2e48189634..484cd29a3266 100644 --- a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java @@ -85,7 +85,7 @@ public class ApplicationImplTest extends LightPlatformTestCase { String msg = "acquireReadActionLock(" + l2 + "ms) vs runReadAction(" + l1 + "ms). Ratio: " + ratioPercent + "%"; System.out.println(msg); if (Math.abs(ratioPercent) > 20) { - return "Suspiciously different times for " + msg; + return "Suspiciously different times for " + msg +" (in "+(ratioPercent<0 ? "my" : "Maxim's") +" favor)"; } } catch (Throwable e) { @@ -415,7 +415,7 @@ public class ApplicationImplTest extends LightPlatformTestCase { assertFalse(application.tryRunReadAction(EmptyRunnable.getInstance())); assertTrue(application.isWriteActionInProgress()); assertFalse(application.isWriteAccessAllowed()); - assertTrue(application.isWriteActionPending()); + assertFalse(application.isWriteActionPending()); } holdWrite.set(false); @@ -453,7 +453,7 @@ public class ApplicationImplTest extends LightPlatformTestCase { while (holdWrite.get() && ok()) { assertTrue(application.isWriteActionInProgress()); assertTrue(application.isWriteAccessAllowed()); - //assertTrue(application.isWriteActionPending()); depends on how you look at it, so leave it for now + assertFalse(application.isWriteActionPending()); } } finally { From 5c40461de6b11d36f461f63c8630ce79530185a5 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 29 Sep 2015 13:37:06 +0300 Subject: [PATCH 16/16] avoid duplicated logging --- .../util/src/com/intellij/openapi/util/LowMemoryWatcher.java | 1 + platform/util/src/com/intellij/util/io/PersistentHashMap.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcher.java b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcher.java index 18d35615f54f..65d245ac8e5a 100644 --- a/platform/util/src/com/intellij/openapi/util/LowMemoryWatcher.java +++ b/platform/util/src/com/intellij/openapi/util/LowMemoryWatcher.java @@ -49,6 +49,7 @@ public class LowMemoryWatcher { private static final Runnable ourJanitor = new Runnable() { @Override public void run() { + LOG.info("Low memory signal received."); try { for (LowMemoryWatcher watcher : ourInstances) { try { diff --git a/platform/util/src/com/intellij/util/io/PersistentHashMap.java b/platform/util/src/com/intellij/util/io/PersistentHashMap.java index 91030d7830ca..37ec5f8195cb 100644 --- a/platform/util/src/com/intellij/util/io/PersistentHashMap.java +++ b/platform/util/src/com/intellij/util/io/PersistentHashMap.java @@ -118,7 +118,6 @@ public class PersistentHashMap extends PersistentEnumeratorDelegate< private final LowMemoryWatcher myAppendCacheFlusher = LowMemoryWatcher.register(new Runnable() { @Override public void run() { - LOG.info("Low memory signal received. Dropping memory caches..."); dropMemoryCaches(); } });