mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-2
@@ -25,6 +25,7 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.sun.jdi.BooleanValue;
|
||||
import com.sun.jdi.Value;
|
||||
|
||||
class ConditionalExpressionEvaluator implements Evaluator {
|
||||
private final Evaluator myConditionEvaluator;
|
||||
@@ -44,8 +45,8 @@ class ConditionalExpressionEvaluator implements Evaluator {
|
||||
|
||||
@Override
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
Object condition = UnBoxingEvaluator.unbox(myConditionEvaluator.evaluate(context), context);
|
||||
if (!(condition instanceof BooleanValue)) {
|
||||
Value condition = (Value)myConditionEvaluator.evaluate(context);
|
||||
if (condition == null || !(condition instanceof BooleanValue)) {
|
||||
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.boolean.condition.expected"));
|
||||
}
|
||||
return ((BooleanValue)condition).booleanValue()? myThenEvaluator.evaluate(context) : myElseEvaluator.evaluate(context);
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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,6 +18,7 @@ package com.intellij.debugger.engine.evaluation.expression;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -26,7 +27,7 @@ import com.sun.jdi.ObjectReference;
|
||||
public class DisableGC implements Evaluator{
|
||||
private final Evaluator myDelegate;
|
||||
|
||||
public DisableGC(Evaluator delegate) {
|
||||
public DisableGC(@NotNull Evaluator delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class DoWhileStatementEvaluator extends LoopEvaluator {
|
||||
while (true) {
|
||||
if (body(context)) break;
|
||||
|
||||
value = UnBoxingEvaluator.unbox(myConditionEvaluator.evaluate(context), context);
|
||||
value = myConditionEvaluator.evaluate(context);
|
||||
if (!(value instanceof BooleanValue)) {
|
||||
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
|
||||
}
|
||||
|
||||
+7
-4
@@ -233,7 +233,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
Evaluator bodyEvaluator = accept(statement.getBody());
|
||||
Evaluator conditionEvaluator = accept(statement.getCondition());
|
||||
if (conditionEvaluator != null) {
|
||||
myResult = new DoWhileStatementEvaluator(conditionEvaluator, bodyEvaluator, getLabel(statement));
|
||||
myResult = new DoWhileStatementEvaluator(new UnBoxingEvaluator(conditionEvaluator), bodyEvaluator, getLabel(statement));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
Evaluator bodyEvaluator = accept(statement.getBody());
|
||||
Evaluator conditionEvaluator = accept(statement.getCondition());
|
||||
if (conditionEvaluator != null) {
|
||||
myResult = new WhileStatementEvaluator(conditionEvaluator, bodyEvaluator, getLabel(statement));
|
||||
myResult = new WhileStatementEvaluator(new UnBoxingEvaluator(conditionEvaluator), bodyEvaluator, getLabel(statement));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +250,9 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
public void visitForStatement(PsiForStatement statement) {
|
||||
Evaluator initializerEvaluator = accept(statement.getInitialization());
|
||||
Evaluator conditionEvaluator = accept(statement.getCondition());
|
||||
if (conditionEvaluator != null) {
|
||||
conditionEvaluator = new UnBoxingEvaluator(conditionEvaluator);
|
||||
}
|
||||
Evaluator updateEvaluator = accept(statement.getUpdate());
|
||||
Evaluator bodyEvaluator = accept(statement.getBody());
|
||||
if (bodyEvaluator != null) {
|
||||
@@ -302,7 +305,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
if(condition == null) return;
|
||||
condition.accept(this);
|
||||
|
||||
myResult = new IfStatementEvaluator(myResult, thenEvaluator, elseEvaluator);
|
||||
myResult = new IfStatementEvaluator(new UnBoxingEvaluator(myResult), thenEvaluator, elseEvaluator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -582,7 +585,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
if (myResult == null) {
|
||||
throwEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", condition.getText())); return;
|
||||
}
|
||||
Evaluator conditionEvaluator = myResult;
|
||||
Evaluator conditionEvaluator = new UnBoxingEvaluator(myResult);
|
||||
thenExpression.accept(this);
|
||||
if (myResult == null) {
|
||||
throwEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", thenExpression.getText())); return;
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public abstract class ForStatementEvaluatorBase extends LoopEvaluator {
|
||||
|
||||
while (true) {
|
||||
// condition
|
||||
Object codition = UnBoxingEvaluator.unbox(evaluateCondition(context), context);
|
||||
Object codition = evaluateCondition(context);
|
||||
if (codition instanceof Boolean) {
|
||||
if (!(Boolean)codition) break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public class IfStatementEvaluator implements Evaluator {
|
||||
}
|
||||
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
Object value = UnBoxingEvaluator.unbox(myConditionEvaluator.evaluate(context), context);
|
||||
Object value = myConditionEvaluator.evaluate(context);
|
||||
if(!(value instanceof BooleanValue)) {
|
||||
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@ import com.sun.jdi.ClassType;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -52,7 +53,7 @@ public class UnBoxingEvaluator implements Evaluator{
|
||||
return TYPES_TO_CONVERSION_METHOD_MAP.containsKey(typeName);
|
||||
}
|
||||
|
||||
public UnBoxingEvaluator(Evaluator operand) {
|
||||
public UnBoxingEvaluator(@NotNull Evaluator operand) {
|
||||
myOperand = new DisableGC(operand);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class WhileStatementEvaluator extends LoopEvaluator {
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
Object value;
|
||||
while (true) {
|
||||
value = UnBoxingEvaluator.unbox(myConditionEvaluator.evaluate(context), context);
|
||||
value = myConditionEvaluator.evaluate(context);
|
||||
if (!(value instanceof BooleanValue)) {
|
||||
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.BootstrapUtil;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoop;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.oio.OioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
@@ -73,7 +72,7 @@ public final class NettyUtil {
|
||||
try {
|
||||
int attemptCount = 0;
|
||||
|
||||
if (bootstrap.group() instanceof NioEventLoop) {
|
||||
if (bootstrap.group() instanceof NioEventLoopGroup) {
|
||||
while (true) {
|
||||
ChannelFuture future = bootstrap.connect(remoteAddress).awaitUninterruptibly();
|
||||
if (future.isSuccess()) {
|
||||
|
||||
+24
@@ -62,4 +62,28 @@ public class CCDirectoryNode extends PsiDirectoryNode {
|
||||
data.setPresentableText(valueName);
|
||||
}
|
||||
|
||||
private static int getIndex(@NotNull final String fullName, @NotNull final String logicalName) {
|
||||
if (!fullName.startsWith(logicalName)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(fullName.substring(logicalName.length())) - 1;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeSortWeight(boolean sortByType) {
|
||||
String name = myValue.getName();
|
||||
String lessonDirName = "lesson";
|
||||
String taskDirName = "task";
|
||||
if (name.startsWith(lessonDirName) || name.startsWith(taskDirName)) {
|
||||
String logicalName = name.contains(lessonDirName) ? lessonDirName : taskDirName;
|
||||
int index = getIndex(name, logicalName) + 1;
|
||||
return index != -1 ? index : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user