Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladimir.Orlov
2017-06-14 12:56:42 +03:00
5 changed files with 17 additions and 12 deletions
@@ -87,7 +87,8 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
if (psiExpression != null && !findCommentsOutsideExpression(body, psiExpression)) {
if (LambdaUtil.isExpressionStatementExpression(psiExpression)) {
final PsiCall call = LambdaUtil.treeWalkUp(body);
if (call != null && call.resolveMethod() != null) {
PsiMethod oldTarget;
if (call != null && (oldTarget = call.resolveMethod()) != null) {
final int offsetInTopCall = body.getTextRange().getStartOffset() - call.getTextRange().getStartOffset();
PsiCall copyCall = LambdaUtil.copyTopLevelCall(call);
if (copyCall == null) return null;
@@ -96,7 +97,7 @@ public class RedundantLambdaCodeBlockInspection extends BaseJavaBatchLocalInspec
final PsiElement parent = codeBlock.getParent();
if (parent instanceof PsiLambdaExpression) {
codeBlock.replace(psiExpression);
if (copyCall.resolveMethod() == null || ((PsiLambdaExpression)parent).getFunctionalInterfaceType() == null) {
if (copyCall.resolveMethod() != oldTarget || ((PsiLambdaExpression)parent).getFunctionalInterfaceType() == null) {
return null;
}
}
@@ -52,7 +52,7 @@ public interface PsiFunctionalExpression extends PsiExpression, Iconable, Naviga
*
* When a generic functional interface is parameterized by wildcards, there are many different instantiations that could satisfy the wildcard
* and produce different function types. Sometimes, it is possible to known from the context, such as the parameter types of a lambda expression,
* which function type is intended (§15.27.3). Other times, it is necessary to pick one; in these circumstances, the bounds are used.
* which function type is intended (15.27.3). Other times, it is necessary to pick one; in these circumstances, the bounds are used.
*/
@Nullable
PsiType getGroundTargetType(PsiType functionalInterfaceType);
@@ -9,6 +9,8 @@ class A {
}
public static void main(String[] args) {
submit((Runnable) () -> new A());
submit(() -> {
new A();
});
}
}
@@ -31,6 +31,8 @@ public abstract class BaseSyncScrollable implements SyncScrollSupport.SyncScroll
@Override
public int transfer(@NotNull Side baseSide, int line) {
if (line < 0) return -1;
ScrollHelper helper = new ScrollHelper(baseSide, line);
processHelper(helper);
@@ -43,10 +45,7 @@ public abstract class BaseSyncScrollable implements SyncScrollSupport.SyncScroll
if (master2 == line) return slave2;
if (master2 < line) return (line - master2) + slave2;
assert master1 != master2;
return Math.min(slave1 + (line - master1), slave2); // old
//return (line - master1) * (slave2 - slave1) / (master2 - master1) + slave1; // new
return Math.min(slave1 + (line - master1), slave2);
}
protected static class ScrollHelper {
@@ -33,10 +33,13 @@ abstract class HeavyDiffTestCase : DiffTestCase() {
}
override fun tearDown() {
projectFixture?.tearDown()
project = null
super.tearDown()
try {
project = null
projectFixture?.tearDown()
}
finally {
super.tearDown()
}
}
override fun runBare() {