Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Batkovich
2016-09-28 23:34:13 +03:00
7 changed files with 46 additions and 11 deletions
@@ -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<ScriptEngineManager>() {
@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<URL> findResources(String name) throws IOException {
if (isAllowedPluginResource(name)) {
Set<URL> result = null;
for (IdeaPluginDescriptor descriptor : PluginManagerCore.getPlugins()) {
ClassLoader l = descriptor.getPluginClassLoader();
Enumeration<URL> 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);
}
}
@@ -24,8 +24,7 @@ import java.awt.event.*;
/**
* @author Sergey.Malenkov
*/
public class MouseEventAdapter<T> extends MouseAdapter implements MouseListener, MouseInputListener,
MouseMotionListener, MouseWheelListener {
public class MouseEventAdapter<T> extends MouseAdapter implements MouseInputListener {
private final T myAdapter;
public MouseEventAdapter(T adapter) {
@@ -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
@@ -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);
}
@@ -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);
}
@@ -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 <i>Report only null safe 'equals' calls</i> to enforce that.
<p>
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.
</body>
</html>
@@ -8,6 +8,7 @@ class SuspiciousLiteralUnderscore {{
int i = 1_000_<warning descr="Group in number literal with underscores does not have length 3">00</warning>;
int j = 1_000_<warning descr="Group in number literal with underscores does not have length 3">0000</warning>;
long k = 1_000_000L;
int l = <error descr="Illegal underscore">100_</error>;
double g = 12_<warning descr="Group in number literal with underscores does not have length 3">34</warning>d;
double h = 1.123_<warning descr="Group in number literal with underscores does not have length 3">4567</warning>e3;