, P extends XBreakpointP
myState.setDescription(StringUtil.nullize(description));
}
- public void dispose() {
+ public final void dispose() {
+ myDisposed = true;
+ doDispose();
+ }
+
+ protected void doDispose() {
+ }
+
+ public boolean isDisposed() {
+ return myDisposed;
}
@Override
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
index cd15f4d601d6..47d67064a56b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
@@ -61,7 +61,6 @@ public class XLineBreakpointImpl extends XBreak
@Nullable private RangeHighlighter myHighlighter;
private final XLineBreakpointType
myType;
private XSourcePosition mySourcePosition;
- private boolean myDisposed;
public XLineBreakpointImpl(final XLineBreakpointType
type,
XBreakpointManagerImpl breakpointManager,
@@ -78,7 +77,7 @@ public class XLineBreakpointImpl
extends XBreak
}
public void updateUI() {
- if (myDisposed || ApplicationManager.getApplication().isUnitTestMode()) {
+ if (isDisposed() || ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
@@ -209,9 +208,8 @@ public class XLineBreakpointImpl
extends XBreak
}
@Override
- public void dispose() {
+ protected void doDispose() {
removeHighlighter();
- myDisposed = true;
}
private void removeHighlighter() {
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
index ed0aaa93f018..afd0e1a4f322 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml
@@ -2815,6 +2815,10 @@
key="junit5.assertions.converter.display.name"
groupBundle="messages.InspectionsBundle" groupKey="group.names.junit.issues" enabledByDefault="false" level="WARNING"
implementationClass="com.siyeh.ig.junit.JUnit5AssertionsConverterInspection"/>
+
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
index 4913876518f6..d71660236fb2 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
@@ -1911,7 +1911,7 @@ usage.of.obsolete.assert.display.name=Usage of obsolete 'junit.framework.Assert'
use.of.obsolete.assert.problem.descriptor=Call to #ref() from ''{0}'' should be replaced with call to method from ''org.junit.Assert'' #loc
use.of.obsolete.assert.quickfix=Replace with 'org.junit.Assert' method call
junit5.assertions.converter.problem.descriptor=Call to #ref() from ''{0}'' should be replaced with call to method from ''{1}'' #loc
-junit5.assertions.converter.quickfix=Replace with ''0'' method call
+junit5.assertions.converter.quickfix=Replace with ''{0}'' method call
junit5.assertions.converter.familyName=Replace with JUnit 5 compatible call
properties.object.as.hashtable.set.quickfix=Replace with call to 'setProperty()'
properties.object.as.hashtable.get.quickfix=Replace with call to 'getProperty()'
@@ -2203,3 +2203,5 @@ overly.long.lambda.problem.descriptor=Lambda expression is too long (# Non-comme
wait.notify.not.in.synchronized.context.display.name='wait()' or 'notify()' while not synchronized
wait.notify.while.not.synchronized.on.problem.descriptor=Call to #ref while not synchronized on ''{0}'' #loc
junit5.assertions.converter.display.name=Obsolete assertions in JUnit 5 tests
+junit5.converter.display.name=JUnit4 test can be JUnit5
+junit5.converter.fix.name=Migrate to JUnit5
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/JUnitCommonClassNames.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/JUnitCommonClassNames.java
index 9d50187406dd..fc10305facdf 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/JUnitCommonClassNames.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/JUnitCommonClassNames.java
@@ -23,4 +23,7 @@ public class JUnitCommonClassNames {
public static final String ORG_JUNIT_JUPITER_API_ASSUMPTIONS = "org.junit.jupiter.api.Assumptions";
public static final String JUNIT_FRAMEWORK_TEST_CASE = "junit.framework.TestCase";
public static final String ORG_HAMCREST_MATCHER_ASSERT = "org.hamcrest.MatcherAssert";
+ public static final String ORG_JUNIT_TEST = "org.junit.Test";
+ public static final String ORG_JUNIT_RULE = "org.junit.Rule";
+ public static final String ORG_JUNIT_CLASS_RULE = "org.junit.ClassRule";
}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TestUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TestUtils.java
index 68c85078e271..3353c198d078 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TestUtils.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/TestUtils.java
@@ -17,8 +17,6 @@ package com.siyeh.ig.psiutils;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.TestFrameworks;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -101,7 +99,7 @@ public class TestUtils {
}
public static boolean isJUnit4TestMethod(@Nullable PsiMethod method) {
- return method != null && AnnotationUtil.isAnnotated(method, "org.junit.Test", true);
+ return method != null && AnnotationUtil.isAnnotated(method, JUnitCommonClassNames.ORG_JUNIT_TEST, true);
}
public static boolean isAnnotatedTestMethod(@Nullable PsiMethod method) {
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/testFrameworks/AssertHint.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/testFrameworks/AssertHint.java
index 7dc6817de776..78705947df52 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/testFrameworks/AssertHint.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/testFrameworks/AssertHint.java
@@ -78,8 +78,9 @@ public class AssertHint {
if (minimumParamCount == null) {
return null;
}
- final PsiMethod method = expression.resolveMethod();
- if (method == null || method.hasModifierProperty(PsiModifier.PRIVATE)) {
+ JavaResolveResult resolveResult = expression.resolveMethodGenerics();
+ final PsiMethod method = (PsiMethod)resolveResult.getElement();
+ if (method == null || method.hasModifierProperty(PsiModifier.PRIVATE) || !resolveResult.isValidResult()) {
return null;
}
final boolean messageOnLastPosition = isMessageOnLastPosition(method, checkTestNG);
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5AssertionsConverterInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5AssertionsConverterInspection.java
index ed6bbad3bdf2..4594f347e1d6 100644
--- a/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5AssertionsConverterInspection.java
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5AssertionsConverterInspection.java
@@ -35,6 +35,14 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
public class JUnit5AssertionsConverterInspection extends BaseInspection {
+ private String myFrameworkName = "JUnit5";;
+
+ JUnit5AssertionsConverterInspection(String frameworkName) {
+ myFrameworkName = frameworkName;
+ }
+
+ public JUnit5AssertionsConverterInspection() {
+ }
@Override
@NotNull
@@ -61,7 +69,7 @@ public class JUnit5AssertionsConverterInspection extends BaseInspection {
return new UseOfObsoleteAssertVisitor();
}
- private static class UseOfObsoleteAssertVisitor extends BaseInspectionVisitor {
+ private class UseOfObsoleteAssertVisitor extends BaseInspectionVisitor {
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
@@ -97,7 +105,7 @@ public class JUnit5AssertionsConverterInspection extends BaseInspection {
if (file instanceof PsiClassOwner) {
for (PsiClass psiClass : ((PsiClassOwner)file).getClasses()) {
TestFramework testFramework = TestFrameworks.detectFramework(psiClass);
- if (testFramework != null && "JUnit5".equals(testFramework.getName())) {
+ if (testFramework != null && myFrameworkName.equals(testFramework.getName())) {
String methodName = psiMethod.getName();
registerMethodCallError(expression, name,
getNewAssertClassName(methodName),
@@ -123,7 +131,7 @@ public class JUnit5AssertionsConverterInspection extends BaseInspection {
}
}
- private static class ReplaceObsoleteAssertsFix extends InspectionGadgetsFix {
+ static class ReplaceObsoleteAssertsFix extends InspectionGadgetsFix {
private final String myBaseClassName;
public ReplaceObsoleteAssertsFix(String baseClassName) {
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5ConverterInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5ConverterInspection.java
new file mode 100644
index 000000000000..884f25f80ebf
--- /dev/null
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/junit/JUnit5ConverterInspection.java
@@ -0,0 +1,187 @@
+/*
+ * 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.siyeh.ig.junit;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.TestFrameworks;
+import com.intellij.codeInspection.GlobalInspectionContext;
+import com.intellij.codeInspection.InspectionEngine;
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.actions.CleanupInspectionIntention;
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.refactoring.RefactoringManager;
+import com.intellij.refactoring.migration.MigrationManager;
+import com.intellij.refactoring.migration.MigrationMap;
+import com.intellij.refactoring.migration.MigrationProcessor;
+import com.intellij.testIntegration.TestFramework;
+import com.intellij.usageView.UsageInfo;
+import com.intellij.util.ArrayUtil;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.BaseInspectionVisitor;
+import com.siyeh.ig.InspectionGadgetsFix;
+import com.siyeh.ig.psiutils.TestUtils;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class JUnit5ConverterInspection extends BaseInspection {
+ private static final List ruleAnnotations = Arrays.asList(JUnitCommonClassNames.ORG_JUNIT_RULE, JUnitCommonClassNames.ORG_JUNIT_CLASS_RULE);
+
+ @Nls
+ @NotNull
+ @Override
+ public String getDisplayName() {
+ return InspectionGadgetsBundle.message("junit5.converter.display.name");
+ }
+
+ @NotNull
+ @Override
+ protected String buildErrorString(Object... infos) {
+ return "#ref can be JUnit 5 test";
+ }
+
+ @Override
+ public boolean shouldInspect(PsiFile file) {
+ if (!PsiUtil.isLanguageLevel8OrHigher(file)) return false;
+ return super.shouldInspect(file);
+ }
+
+ @Nullable
+ @Override
+ protected InspectionGadgetsFix buildFix(Object... infos) {
+ return new MigrateToJUnit5();
+ }
+
+ @Override
+ public BaseInspectionVisitor buildVisitor() {
+ return new BaseInspectionVisitor() {
+
+ @Override
+ public void visitClass(PsiClass aClass) {
+ TestFramework framework = TestFrameworks.detectFramework(aClass);
+ if (framework == null || !"JUnit4".equals(framework.getName())) {
+ return;
+ }
+
+ if (AnnotationUtil.isAnnotated(aClass, TestUtils.RUN_WITH, true)) {
+ return;
+ }
+
+ for (PsiField field : aClass.getAllFields()) {
+ if (AnnotationUtil.isAnnotated(field, ruleAnnotations)) {
+ return;
+ }
+ }
+
+ for (PsiMethod method : aClass.getMethods()) {
+ if (AnnotationUtil.isAnnotated(method, ruleAnnotations)) {
+ return;
+ }
+ }
+
+ registerClassError(aClass);
+ }
+ };
+ }
+
+ private static class MigrateToJUnit5 extends InspectionGadgetsFix {
+ @Nls
+ @NotNull
+ @Override
+ public String getFamilyName() {
+ return InspectionGadgetsBundle.message("junit5.converter.fix.name");
+ }
+
+ @Override
+ protected void doFix(Project project, ProblemDescriptor descriptor) {
+ PsiClass psiClass = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiClass.class);
+ if (psiClass != null) {
+ MigrationManager manager = RefactoringManager.getInstance(project).getMigrateManager();
+ MigrationMap migrationMap = manager.findMigrationMap("JUnit (4.x -> 5.0)");
+ if (migrationMap != null) {
+ new MyJUnit5MigrationProcessor(project, migrationMap, psiClass.getContainingFile()).run();
+ }
+ }
+ }
+
+ @Override
+ public boolean startInWriteAction() {
+ return false;
+ }
+
+ private static class MyJUnit5MigrationProcessor extends MigrationProcessor {
+
+ private final Project myProject;
+ private final PsiFile myFile;
+
+ public MyJUnit5MigrationProcessor(Project project, MigrationMap migrationMap, PsiFile file) {
+ super(project, migrationMap, GlobalSearchScope.fileScope(file));
+ myProject = project;
+ myFile = file;
+ }
+
+ @NotNull
+ @Override
+ protected UsageInfo[] findUsages() {
+ UsageInfo[] usages = super.findUsages();
+ InspectionManager inspectionManager = InspectionManager.getInstance(myProject);
+ GlobalInspectionContext globalContext = inspectionManager.createNewGlobalContext(false);
+ LocalInspectionToolWrapper assertionsConverter = new LocalInspectionToolWrapper(new JUnit5AssertionsConverterInspection("JUnit4"));
+ UsageInfo[] descriptors = InspectionEngine.runInspectionOnFile(myFile, assertionsConverter, globalContext).stream().map(descriptor -> new MyDescriptionBasedUsageInfo(descriptor)).toArray(UsageInfo[]::new);
+ return ArrayUtil.mergeArrays(usages, descriptors);
+ }
+
+ @Override
+ protected void performRefactoring(@NotNull UsageInfo[] usages) {
+ List migrateUsages = new ArrayList<>();
+ List descriptions = new ArrayList<>();
+ for (UsageInfo usage : usages) {
+ if (usage instanceof MyDescriptionBasedUsageInfo) {
+ descriptions.add (((MyDescriptionBasedUsageInfo)usage).myDescriptor);
+ }
+ else {
+ migrateUsages.add(usage);
+ }
+ }
+ super.performRefactoring(migrateUsages.toArray(new UsageInfo[migrateUsages.size()]));
+ CleanupInspectionIntention.applyFixes(myProject, "Convert Assertions", descriptions, JUnit5AssertionsConverterInspection.ReplaceObsoleteAssertsFix.class);
+ }
+ }
+ }
+
+ private static class MyDescriptionBasedUsageInfo extends UsageInfo {
+ private final ProblemDescriptor myDescriptor;
+
+ public MyDescriptionBasedUsageInfo(ProblemDescriptor descriptor) {
+ super(descriptor.getPsiElement());
+ myDescriptor = descriptor;
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit5Converter.html b/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit5Converter.html
new file mode 100644
index 000000000000..36fa589f9405
--- /dev/null
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit5Converter.html
@@ -0,0 +1,7 @@
+
+
+Reports JUnit4 tests which can be automatically converted to JUnit5. Though default runners are automatically convertable, custom runners, method- and field- rules are not and require manual changes.
+
+ New in 2017.1
+
+
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.after.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.after.java
new file mode 100644
index 000000000000..566d8facf130
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.after.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.*;
+
+
+public class Simple {
+
+ @Test
+ public void test_first() throws Exception {
+ Assertions.assertArrayEquals(new Object[] {}, null);
+ Assertions.assertArrayEquals(new Object[] {}, null, "message");
+
+ Assertions.assertEquals("Expected", "actual");
+ Assertions.assertEquals("Expected", "actual", "message");
+
+ fail();
+ Assertions.fail("");
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.java
new file mode 100644
index 000000000000..4f4b2b1a2978
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/junit/junit5_converter/Simple.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+public class Simple {
+
+ @Test
+ public void test_first() throws Exception {
+ assertArrayEquals(new Object[] {}, null);
+ assertArrayEquals("message", new Object[] {}, null);
+
+ assertEquals("Expected", "actual");
+ assertEquals("message", "Expected", "actual");
+
+ fail();
+ fail("");
+ }
+}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/junit/Junit5ConverterFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/junit/Junit5ConverterFixTest.java
new file mode 100644
index 000000000000..7cd269ac7f44
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/junit/Junit5ConverterFixTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.siyeh.ig.fixes.junit;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.junit.JUnit5ConverterInspection;
+
+public class Junit5ConverterFixTest extends IGQuickFixesTestCase {
+
+ public void testSimple() {
+ doTest();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myFixture.enableInspections(new JUnit5ConverterInspection());
+ myRelativePath = "junit/junit5_converter";
+ myDefaultHint = InspectionGadgetsBundle.message("junit5.converter.fix.name");
+
+ myFixture.addClass("package org.junit;" +
+ "public class Assert {" +
+ " public static void assertArrayEquals(Object[] expecteds, Object[] actuals) {}" +
+ " public static void assertArrayEquals(String message, Object[] expecteds, Object[] actuals){}" +
+ " public static void assertTrue(String message, boolean condition) {}" +
+ " public static void assertTrue(boolean condition) {}" +
+ " public static void assertEquals(String message, Object expected, Object actual) {}" +
+ " public static void assertEquals(Object expected, Object actual) {}" +
+ " public static void fail(String message) {}" +
+ " public static void assertThat(T actual, Matcher super T> matcher) {}" +
+ "}");
+
+ myFixture.addClass("package org.junit;" +
+ "public @interface Test {}");
+
+ myFixture.addClass("package org.junit.jupiter.api;" +
+ "public @interface Test {}");
+
+ myFixture.addClass("package org.junit.jupiter.api;\n" +
+ "public final class Assertions {\n" +
+ " public static void assertArrayEquals(Object[] expected, Object[] actual) {}\n" +
+ " public static void assertArrayEquals(Object[] expected, Object[] actual, String message) {}\n" +
+ " public static void assertEquals(Object expected, Object actual) {}\n" +
+ " public static void assertTrue(boolean expected) {}\n" +
+ " public static void assertEquals(Object expected, Object actual, String message) {}\n" +
+ " public static void assertTrue(Object expected, String message) {}\n" +
+ " public static void fail(String message) {}" +
+ "}");
+ }
+}
diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
index 5cc755e27074..117507ba1f48 100644
--- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
+++ b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/importing/GradleImportingTestCase.java
@@ -252,14 +252,19 @@ public abstract class GradleImportingTestCase extends ExternalSystemImportingTes
File zip = localDistribution.getZipFile();
try {
- ZipFile zipFile = new ZipFile(zip);
- zipFile.close();
+ if (zip.exists()) {
+ ZipFile zipFile = new ZipFile(zip);
+ zipFile.close();
+ }
}
catch (ZipException e) {
e.printStackTrace();
System.out.println("Corrupted file will be removed: " + zip.getPath());
FileUtil.delete(zip);
}
+ catch (IOException e) {
+ e.printStackTrace();
+ }
}
@NotNull
diff --git a/plugins/ui-designer-core/src/com/intellij/designer/propertyTable/renderers/ColorIcon.java b/plugins/ui-designer-core/src/com/intellij/designer/propertyTable/renderers/ColorIcon.java
index c273c9a2963f..a1a984f7f930 100644
--- a/plugins/ui-designer-core/src/com/intellij/designer/propertyTable/renderers/ColorIcon.java
+++ b/plugins/ui-designer-core/src/com/intellij/designer/propertyTable/renderers/ColorIcon.java
@@ -34,6 +34,18 @@ public final class ColorIcon extends EmptyIcon {
myColorSize = colorSize;
}
+ protected ColorIcon(ColorIcon icon) {
+ super(icon);
+ myColorSize = icon.myColorSize;
+ myColor = icon.myColor;
+ myShowRedLine = icon.myShowRedLine;
+ }
+
+ @Override
+ protected ColorIcon copy() {
+ return new ColorIcon(this);
+ }
+
public Color getColor() {
return myShowRedLine ? null : myColor;
}
diff --git a/resources-en/src/messages/DebuggerBundle.properties b/resources-en/src/messages/DebuggerBundle.properties
index 847dcded70ca..280b434bf16c 100644
--- a/resources-en/src/messages/DebuggerBundle.properties
+++ b/resources-en/src/messages/DebuggerBundle.properties
@@ -343,6 +343,7 @@ exception.breakpoints.tab.title=Java Exception Breakpoints
field.watchpoints.tab.title=Java Field Watchpoints
line.breakpoints.tab.title=Java Line Breakpoints
method.breakpoints.tab.title=Java Method Breakpoints
+method.breakpoints.slowness.warning=Method breakpoints may dramatically slow down debugging
title.error.evaluating.breakpoint.condition=Breakpoint Condition Error
title.error.evaluating.breakpoint.action=Breakpoint Action Error
error.evaluating.breakpoint.condition.or.action=Problem processing VM event:\nBreakpoint: ''{0}''\nError: {1}\nWould you like to stop at the breakpoint?
diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml
index 79f8d9d9e66a..d2a9d01ca2c1 100644
--- a/resources/src/idea/RichPlatformPlugin.xml
+++ b/resources/src/idea/RichPlatformPlugin.xml
@@ -172,6 +172,8 @@
+
+
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java
index e47515bdb588..eb6ce5d23a0c 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsInitializingActivity.java
@@ -46,7 +46,7 @@ public class BreadcrumbsInitializingActivity implements StartupActivity, DumbAwa
return;
}
- MessageBusConnection connection = project.getMessageBus().connect(project);
+ MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener());
connection.subscribe(FileTypeManager.TOPIC, new MyFileTypeListener(project));
@@ -123,9 +123,12 @@ public class BreadcrumbsInitializingActivity implements StartupActivity, DumbAwa
for (final FileEditor fileEditor : fileEditors) {
if (fileEditor instanceof TextEditor) {
Editor editor = ((TextEditor)fileEditor).getEditor();
- if (BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor) != null) {
+ final BreadcrumbsXmlWrapper existingWrapper = BreadcrumbsXmlWrapper.getBreadcrumbsComponent(editor);
+ if (existingWrapper != null) {
+ existingWrapper.queueUpdate();
continue;
}
+
final BreadcrumbsXmlWrapper wrapper = new BreadcrumbsXmlWrapper(editor);
final JComponent c = wrapper.getComponent();
fileEditorManager.addTopComponent(fileEditor, c);
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
index a472ba06bbb2..6aa3bcdd7d3f 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
@@ -17,8 +17,6 @@ package com.intellij.xml.breadcrumbs;
import com.intellij.codeInsight.daemon.impl.tagTreeHighlighting.XmlTagTreeHighlightingUtil;
import com.intellij.codeInsight.highlighting.HighlightManager;
-import com.intellij.ide.ui.UISettings;
-import com.intellij.ide.ui.UISettingsListener;
import com.intellij.lang.Language;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.editor.Document;
@@ -101,27 +99,14 @@ public class BreadcrumbsXmlWrapper implements BreadcrumbsItemListener