From 26c692ef769c1b3ac2409953c529169794f0d701 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 28 Sep 2016 19:28:32 +0200 Subject: [PATCH 1/5] IG: "the" -> "a" in description --- .../inspectionDescriptions/EqualsReplaceableByObjectsCall.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsReplaceableByObjectsCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsReplaceableByObjectsCall.html index 5a55c5b308f7..80c33db1a5d0 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsReplaceableByObjectsCall.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsReplaceableByObjectsCall.html @@ -9,6 +9,6 @@ For example: still makes sense, but slightly changes the semantics. For the cases where only equivalent replacement is needed, there's the check box Report only null safe 'equals' calls to enforce that.

- This inspection only applies to projects and modules configured to use the language level of 7 or higher. + This inspection only applies to projects and modules configured to use a language level of 7 or higher. \ No newline at end of file From d348e0bf854aa452e9606e87ed9c870e89b65e3c Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 28 Sep 2016 20:13:19 +0200 Subject: [PATCH 2/5] EA-89119 (assert: BaseInspectionVisitor.registerErrorAtOffset) --- .../ig/numeric/SuspiciousLiteralUnderscoreInspection.java | 6 +++++- .../SuspiciousLiteralUnderscore.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/SuspiciousLiteralUnderscoreInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/SuspiciousLiteralUnderscoreInspection.java index ce00828c0a62..28f390c8e8ea 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/SuspiciousLiteralUnderscoreInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/numeric/SuspiciousLiteralUnderscoreInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,6 +95,10 @@ public class SuspiciousLiteralUnderscoreInspection extends BaseInspection { return; } } + if (digit == 0) { + // literal ends with underscore (which does not compile) + return; + } if (dot ? digit > 3 : digit != 3) { registerErrorAtOffset(expression, length - digit, digit); } diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/suspicious_literal_underscore/SuspiciousLiteralUnderscore.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/suspicious_literal_underscore/SuspiciousLiteralUnderscore.java index 55201d2a1b98..757da7defc50 100644 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/suspicious_literal_underscore/SuspiciousLiteralUnderscore.java +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/suspicious_literal_underscore/SuspiciousLiteralUnderscore.java @@ -8,6 +8,7 @@ class SuspiciousLiteralUnderscore {{ int i = 1_000_00; int j = 1_000_0000; long k = 1_000_000L; + int l = 100_; double g = 12_34d; double h = 1.123_4567e3; From a4dea3ee1697e3c8de11f93ce453d8814d93d0a3 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 28 Sep 2016 21:11:09 +0300 Subject: [PATCH 3/5] IDEA-158500: remove unneeded listeners, which are accessible via MouseAdapter --- platform/util/src/com/intellij/util/ui/MouseEventAdapter.java | 3 +-- platform/util/src/com/intellij/util/ui/MouseEventHandler.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java b/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java index be9fe2bdad1d..f7c7b4745d24 100644 --- a/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java +++ b/platform/util/src/com/intellij/util/ui/MouseEventAdapter.java @@ -24,8 +24,7 @@ import java.awt.event.*; /** * @author Sergey.Malenkov */ -public class MouseEventAdapter extends MouseAdapter implements MouseListener, MouseInputListener, - MouseMotionListener, MouseWheelListener { +public class MouseEventAdapter extends MouseAdapter implements MouseInputListener { private final T myAdapter; public MouseEventAdapter(T adapter) { diff --git a/platform/util/src/com/intellij/util/ui/MouseEventHandler.java b/platform/util/src/com/intellij/util/ui/MouseEventHandler.java index 92aa467b364e..7e0da37c9e0f 100644 --- a/platform/util/src/com/intellij/util/ui/MouseEventHandler.java +++ b/platform/util/src/com/intellij/util/ui/MouseEventHandler.java @@ -21,8 +21,7 @@ import java.awt.event.*; /** * @author Sergey.Malenkov */ -public abstract class MouseEventHandler extends MouseAdapter implements MouseListener, MouseInputListener, - MouseMotionListener, MouseWheelListener { +public abstract class MouseEventHandler extends MouseAdapter implements MouseInputListener { protected abstract void handle(MouseEvent event); @Override From 4c2949717a6b3af5c4a6aeca54aec854351172dc Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 28 Sep 2016 20:56:42 +0200 Subject: [PATCH 4/5] EA-72276 (assert: PsiWalkingState.elementStarted) --- .../ig/junit/TestMethodWithoutAssertionInspectionBase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/TestMethodWithoutAssertionInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/TestMethodWithoutAssertionInspectionBase.java index 0415bcab5d19..62bb0b940c86 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/TestMethodWithoutAssertionInspectionBase.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/junit/TestMethodWithoutAssertionInspectionBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -152,6 +152,10 @@ public class TestMethodWithoutAssertionInspectionBase extends BaseInspection { @Override public void visitElement(@NotNull PsiElement element) { + if ((element instanceof PsiCompiledElement)) { + // assume no assertions in libraries (prevents assertion in recursive element walking visitor) + return; + } if (!containsAssertion) { super.visitElement(element); } From 7a577e49ee319a97461c6f88c0844262e91d7265 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Wed, 28 Sep 2016 23:10:53 +0300 Subject: [PATCH 5/5] allow plugin script engines --- .../Jsr223IdeScriptEngineManagerImpl.java | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java b/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java index c4ed7782241a..e38a4f8e607a 100644 --- a/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java +++ b/platform/core-impl/src/org/jetbrains/ide/script/Jsr223IdeScriptEngineManagerImpl.java @@ -36,9 +36,7 @@ import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.net.URL; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.Future; @@ -50,7 +48,12 @@ class Jsr223IdeScriptEngineManagerImpl extends IdeScriptEngineManager { public ScriptEngineManager call() { long start = System.currentTimeMillis(); try { - return new ScriptEngineManager(); + return ClassLoaderUtil.runWithClassLoader(AllPluginsLoader.INSTANCE, new Computable() { + @Override + public ScriptEngineManager compute() { + return new ScriptEngineManager(); + } + }); } finally { long end = System.currentTimeMillis(); @@ -300,13 +303,38 @@ class Jsr223IdeScriptEngineManagerImpl extends IdeScriptEngineManager { throw new ClassNotFoundException(name); } + private static boolean isAllowedPluginResource(String name) { + // allow plugin engines but suppress all other resources + return "META-INF/services/javax.script.ScriptEngineFactory".equals(name); + } + @Override protected URL findResource(String name) { + if (isAllowedPluginResource(name)) { + for (IdeaPluginDescriptor descriptor : PluginManagerCore.getPlugins()) { + ClassLoader l = descriptor.getPluginClassLoader(); + URL url = l == null ? null : l.getResource(name); + if (url != null) return url; + } + } return getClass().getClassLoader().getResource(name); } @Override protected Enumeration findResources(String name) throws IOException { + if (isAllowedPluginResource(name)) { + Set result = null; + for (IdeaPluginDescriptor descriptor : PluginManagerCore.getPlugins()) { + ClassLoader l = descriptor.getPluginClassLoader(); + Enumeration urls = l == null ? null : l.getResources(name); + if (urls == null || !urls.hasMoreElements()) continue; + if (result == null) result = ContainerUtil.newLinkedHashSet(); + ContainerUtil.addAll(result, urls); + } + if (result != null) { + return Collections.enumeration(result); + } + } return getClass().getClassLoader().getResources(name); } }