From c8b7a52f38ca1dca40fa0b08905714b2fa66546c Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Tue, 19 Sep 2017 20:38:41 +0300 Subject: [PATCH] Convert generic types api to kotlin [2/2] --- .../psi/impl/JavaChainTransformerImpl.java | 10 +- .../impl/TraceExpressionBuilderImpl.java | 2 +- .../trace/impl/handler/DistinctHandler.java | 11 +-- .../handler/OptionalTerminatorHandler.java | 2 +- .../trace/impl/handler/PeekTracerHandler.java | 4 +- .../trace/impl/handler/TerminatorHandler.java | 2 +- .../trace/impl/handler/type/GenericType.kt | 44 +++++---- .../impl/handler/type/GenericTypeImpl.kt | 56 +++-------- .../impl/handler/type/GenericTypeUtil.kt | 93 ++++++++----------- .../ui/impl/EvaluationAwareTraceWindow.java | 6 +- .../PrimitiveObjectBuilderPositiveTest.java | 21 +++-- .../positive/TerminationCallTypeTest.java | 10 +- 12 files changed, 109 insertions(+), 152 deletions(-) diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java index 9802b436f683..ede3c8389a0b 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java @@ -52,7 +52,7 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java { final PsiType qualifierType = qualifierExpression == null ? null : qualifierExpression.getType(); final GenericType typeAfterQualifier = qualifierType == null ? getGenericTypeOfThis(qualifierExpression) - : GenericTypeUtil.fromStreamPsiType(qualifierType); + : GenericTypeUtil.INSTANCE.fromStreamPsiType(qualifierType); final QualifierExpressionImpl qualifier = qualifierExpression == null ? new QualifierExpressionImpl("", TextRange.EMPTY_RANGE, typeAfterQualifier) @@ -71,8 +71,8 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java { private GenericType getGenericTypeOfThis(PsiExpression expression) { final PsiClass klass = ClassUtils.getContainingClass(expression); - return klass == null ? GenericType.OBJECT - : GenericTypeUtil.fromPsiClass(klass); + return klass == null ? GenericType.Companion.getOBJECT() + : GenericTypeUtil.INSTANCE.fromPsiClass(klass); } @NotNull @@ -141,11 +141,11 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java { @NotNull private static GenericType resolveType(@NotNull PsiMethodCallExpression call) { - return GenericTypeUtil.fromStreamPsiType(extractType(call)); + return GenericTypeUtil.INSTANCE.fromStreamPsiType(extractType(call)); } @NotNull private static GenericType resolveTerminationCallType(@NotNull PsiMethodCallExpression call) { - return GenericTypeUtil.fromPsiType(extractType(call)); + return GenericTypeUtil.INSTANCE.fromPsiType(extractType(call)); } } diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/TraceExpressionBuilderImpl.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/TraceExpressionBuilderImpl.java index c6a63555db81..27fefd775edc 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/TraceExpressionBuilderImpl.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/TraceExpressionBuilderImpl.java @@ -162,7 +162,7 @@ public class TraceExpressionBuilderImpl implements TraceExpressionBuilder { final String resultExpression; final String additionalDeclarations; final String additionalEvaluation; - if (resultType.equals(GenericType.VOID)) { + if (resultType.equals(GenericType.Companion.getVOID())) { additionalDeclarations = ""; additionalEvaluation = chain.getText() + ";" + LINE_SEPARATOR; resultExpression = "new Object[1]"; diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/DistinctHandler.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/DistinctHandler.java index f532c81f789e..ec53b44e88d5 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/DistinctHandler.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/DistinctHandler.java @@ -18,13 +18,10 @@ package com.intellij.debugger.streams.trace.impl.handler; import com.intellij.debugger.streams.trace.dsl.CodeBlock; import com.intellij.debugger.streams.trace.dsl.Expression; import com.intellij.debugger.streams.trace.dsl.impl.TextExpression; -import com.intellij.debugger.streams.trace.dsl.impl.java.JavaCodeBlock; -import com.intellij.debugger.streams.trace.dsl.impl.java.JavaStatementFactory; import com.intellij.debugger.streams.trace.impl.TraceExpressionBuilderImpl; import com.intellij.debugger.streams.trace.impl.handler.type.ClassTypeImpl; import com.intellij.debugger.streams.trace.impl.handler.type.GenericType; import com.intellij.debugger.streams.wrapper.IntermediateStreamCall; -import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -50,9 +47,11 @@ public class DistinctHandler extends HandlerBase.Intermediate { final String variablePrefix = "distinct" + callNumber; final String storeMapType = String.format("java.util.Map", myBeforeType.getGenericTypeName()); myStoreMapVariable = - new HashMapVariableImpl(variablePrefix + "Store", GenericType.OBJECT, new ClassTypeImpl(storeMapType), false); - myResolveMapVariable = new HashMapVariableImpl(variablePrefix + "Resolve", GenericType.INT, GenericType.INT, false); - myReverseUtilMapVariable = new HashMapVariableImpl(variablePrefix + "ReverseUtil", GenericType.INT, GenericType.INT, false); + new HashMapVariableImpl(variablePrefix + "Store", GenericType.Companion.getOBJECT(), new ClassTypeImpl(storeMapType), false); + myResolveMapVariable = new HashMapVariableImpl(variablePrefix + "Resolve", GenericType.Companion.getINT(), + GenericType.Companion.getINT(), false); + myReverseUtilMapVariable = new HashMapVariableImpl(variablePrefix + "ReverseUtil", GenericType.Companion.getINT(), + GenericType.Companion.getINT(), false); } @NotNull diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/OptionalTerminatorHandler.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/OptionalTerminatorHandler.java index dbdb9c8c9d2b..d628961b8e42 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/OptionalTerminatorHandler.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/OptionalTerminatorHandler.java @@ -38,7 +38,7 @@ public class OptionalTerminatorHandler implements TerminatorCallHandler { public OptionalTerminatorHandler(@NotNull TerminatorStreamCall call, @NotNull String resultExpression) { myTerminatorHandler = new TerminatorHandler(call.getTypeBefore()); - myOptionalType = GenericTypeUtil.unwrapOptional(call.getResultType()); + myOptionalType = GenericTypeUtil.INSTANCE.unwrapOptional(call.getResultType()); myResultExpression = resultExpression; } diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/PeekTracerHandler.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/PeekTracerHandler.java index d6c17ba7e929..bf2f710adb36 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/PeekTracerHandler.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/PeekTracerHandler.java @@ -46,8 +46,8 @@ public class PeekTracerHandler extends HandlerBase.Intermediate { myTypeAfter = typeAfter; final String variablePrefix = String.format("%sPeek%d", name, num); - myBeforeVariable = new HashMapVariableImpl(variablePrefix + "before", GenericType.INT, typeBefore, true); - myAfterVariable = new HashMapVariableImpl(variablePrefix + "after", GenericType.INT, typeAfter, true); + myBeforeVariable = new HashMapVariableImpl(variablePrefix + "before", GenericType.Companion.getINT(), typeBefore, true); + myAfterVariable = new HashMapVariableImpl(variablePrefix + "after", GenericType.Companion.getINT(), typeAfter, true); } @NotNull diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/TerminatorHandler.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/TerminatorHandler.java index 06b4db11812d..e8b2777caa3f 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/TerminatorHandler.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/TerminatorHandler.java @@ -30,7 +30,7 @@ public class TerminatorHandler extends HandlerBase.Terminator { private final PeekTracerHandler myPeekTracerHandler; public TerminatorHandler(@NotNull GenericType beforeType) { - myPeekTracerHandler = new PeekTracerHandler(Integer.MAX_VALUE, "terminator", beforeType, GenericType.OBJECT); + myPeekTracerHandler = new PeekTracerHandler(Integer.MAX_VALUE, "terminator", beforeType, GenericType.Companion.getOBJECT()); } @NotNull diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericType.kt b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericType.kt index c7aa2b5ed40b..43131df0a681 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericType.kt +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericType.kt @@ -13,33 +13,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.debugger.streams.trace.impl.handler.type; +package com.intellij.debugger.streams.trace.impl.handler.type -import com.intellij.psi.CommonClassNames; -import org.jetbrains.annotations.NotNull; +import com.intellij.psi.CommonClassNames /** * @author Vitaliy.Bibaev */ -public interface GenericType { - @NotNull - String getVariableTypeName(); +interface GenericType { + val variableTypeName: String - @NotNull - String getGenericTypeName(); + val genericTypeName: String - @NotNull - String getDefaultValue(); + val defaultValue: String - GenericType BOOLEAN = new GenericTypeImpl("boolean", "java.lang.Boolean", "false"); - GenericType INT = new GenericTypeImpl("int", "java.lang.Integer", "0"); - GenericType DOUBLE = new GenericTypeImpl("double", "java.lang.Double", "0."); - GenericType LONG = new GenericTypeImpl("long", "java.lang.Long", "0L"); - GenericType OBJECT = new ClassTypeImpl("java.lang.Object"); - GenericType VOID = new GenericTypeImpl("void", "java.lang.Void", "null"); + interface CompositeType : GenericType { + val elementType: GenericType + } - GenericType OPTIONAL = new ClassTypeImpl(CommonClassNames.JAVA_UTIL_OPTIONAL); - GenericType OPTIONAL_INT = new ClassTypeImpl("java.util.OptionalInt"); - GenericType OPTIONAL_LONG = new ClassTypeImpl("java.util.OptionalLong"); - GenericType OPTIONAL_DOUBLE = new ClassTypeImpl("java.util.OptionalDouble"); + companion object { + val BOOLEAN: GenericType = GenericTypeImpl("boolean", "java.lang.Boolean", "false") + val INT: GenericType = GenericTypeImpl("int", "java.lang.Integer", "0") + val DOUBLE: GenericType = GenericTypeImpl("double", "java.lang.Double", "0.") + val LONG: GenericType = GenericTypeImpl("long", "java.lang.Long", "0L") + + val OBJECT: GenericType = ClassTypeImpl("java.lang.Object", "new java.lang.Object()") + val VOID: GenericType = GenericTypeImpl("void", "java.lang.Void", "null") + val OPTIONAL: GenericType = ClassTypeImpl(CommonClassNames.JAVA_UTIL_OPTIONAL) + val OPTIONAL_INT: GenericType = ClassTypeImpl("java.util.OptionalInt") + + val OPTIONAL_LONG: GenericType = ClassTypeImpl("java.util.OptionalLong") + + val OPTIONAL_DOUBLE: GenericType = ClassTypeImpl("java.util.OptionalDouble") + } } diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeImpl.kt b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeImpl.kt index b985ba9722b3..d8026a616303 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeImpl.kt +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeImpl.kt @@ -13,60 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.debugger.streams.trace.impl.handler.type; +package com.intellij.debugger.streams.trace.impl.handler.type -import org.jetbrains.annotations.NotNull; - -import java.util.Objects; +import java.util.Objects /** * @author Vitaliy.Bibaev */ -public class GenericTypeImpl implements GenericType { - private final String myPrimitiveName; - private final String myGenericName; - private final String myDefaultValue; +open class GenericTypeImpl(override val variableTypeName: String, + override val genericTypeName: String, + override val defaultValue: String) : GenericType { - @Override - public int hashCode() { - return Objects.hash(myPrimitiveName, myGenericName); + override fun hashCode(): Int { + return Objects.hash(variableTypeName, genericTypeName) } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - if (obj instanceof GenericType) { - final GenericType type = (GenericType)obj; - return myPrimitiveName.equals(type.getVariableTypeName()) && myGenericName.equals(type.getGenericTypeName()); - } - - return false; - } - - public GenericTypeImpl(@NotNull String primitiveName, @NotNull String genericName, @NotNull String defaultValue) { - myPrimitiveName = primitiveName; - myGenericName = genericName; - myDefaultValue = defaultValue; - } - - @NotNull - @Override - public String getVariableTypeName() { - return myPrimitiveName; - } - - @NotNull - @Override - public String getGenericTypeName() { - return myGenericName; - } - - @NotNull - @Override - public String getDefaultValue() { - return myDefaultValue; + return other is GenericType && variableTypeName == other.variableTypeName && genericTypeName == other.genericTypeName } } diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeUtil.kt b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeUtil.kt index d586258c58d2..db215ffbf8c7 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeUtil.kt +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/trace/impl/handler/type/GenericTypeUtil.kt @@ -13,77 +13,64 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.debugger.streams.trace.impl.handler.type; +package com.intellij.debugger.streams.trace.impl.handler.type -import com.intellij.psi.CommonClassNames; -import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiType; -import com.intellij.psi.util.InheritanceUtil; -import com.intellij.psi.util.TypeConversionUtil; -import one.util.streamex.StreamEx; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; +import com.intellij.psi.CommonClassNames +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiType +import com.intellij.psi.util.InheritanceUtil +import com.intellij.psi.util.TypeConversionUtil +import one.util.streamex.StreamEx +import org.jetbrains.annotations.Contract /** * @author Vitaliy.Bibaev */ -public class GenericTypeUtil { - private static final Set OPTIONAL_TYPES = StreamEx - .of(GenericType.OPTIONAL, GenericType.OPTIONAL_INT, GenericType.OPTIONAL_LONG, GenericType.OPTIONAL_DOUBLE) - .toSet(); +object GenericTypeUtil { + private val OPTIONAL_TYPES = StreamEx + .of(GenericType.OPTIONAL, GenericType.OPTIONAL_INT, GenericType.OPTIONAL_LONG, + GenericType.OPTIONAL_DOUBLE) + .toSet() - @NotNull - public static GenericType fromStreamPsiType(@NotNull PsiType streamPsiType) { - if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) return GenericType.INT; - if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) return GenericType.LONG; - if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) return GenericType.DOUBLE; - if (PsiType.VOID.equals(streamPsiType)) return GenericType.VOID; + fun fromStreamPsiType(streamPsiType: PsiType): GenericType { + if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) return GenericType.INT + if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) return GenericType.LONG + if (InheritanceUtil.isInheritor(streamPsiType, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) + return GenericType + .DOUBLE + return if (PsiType.VOID == streamPsiType) GenericType.VOID else GenericType.OBJECT - return GenericType.OBJECT; } - @NotNull - public static GenericType fromPsiClass(@NotNull PsiClass psiClass) { - if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) return GenericType.INT; - if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) return GenericType.LONG; - if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) return GenericType.DOUBLE; + fun fromPsiClass(psiClass: PsiClass): GenericType { + if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM)) return GenericType.INT + if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM)) return GenericType.LONG + return if (InheritanceUtil.isInheritor(psiClass, CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM)) GenericType.DOUBLE + else GenericType.OBJECT - return GenericType.OBJECT; } - @NotNull - public static GenericType fromPsiType(@NotNull PsiType type) { - if (PsiType.VOID.equals(type)) return GenericType.VOID; - if (PsiType.INT.equals(type)) return GenericType.INT; - if (PsiType.DOUBLE.equals(type)) return GenericType.DOUBLE; - if (PsiType.LONG.equals(type)) return GenericType.LONG; - if (PsiType.BOOLEAN.equals(type)) return GenericType.BOOLEAN; - return new ClassTypeImpl(TypeConversionUtil.erasure(type).getCanonicalText()); + fun fromPsiType(type: PsiType): GenericType { + if (PsiType.VOID == type) return GenericType.VOID + if (PsiType.INT == type) return GenericType.INT + if (PsiType.DOUBLE == type) return GenericType.DOUBLE + if (PsiType.LONG == type) return GenericType.LONG + return if (PsiType.BOOLEAN == type) GenericType.BOOLEAN else ClassTypeImpl(TypeConversionUtil.erasure(type).canonicalText) } @Contract(pure = true) - private static boolean isOptional(@NotNull GenericType type) { - return OPTIONAL_TYPES.contains(type); + private fun isOptional(type: GenericType): Boolean { + return OPTIONAL_TYPES.contains(type) } - @NotNull - public static GenericType unwrapOptional(@NotNull GenericType type) { - assert isOptional(type); + fun unwrapOptional(type: GenericType): GenericType { + assert(isOptional(type)) - if (type.equals(GenericType.OPTIONAL_INT)) { - return GenericType.INT; + return when (type) { + GenericType.OPTIONAL_INT -> GenericType.INT + GenericType.OPTIONAL_LONG -> GenericType.LONG + GenericType.OPTIONAL_DOUBLE -> GenericType.DOUBLE + else -> GenericType.OBJECT } - - if (type.equals(GenericType.OPTIONAL_LONG)) { - return GenericType.LONG; - } - - if (type.equals(GenericType.OPTIONAL_DOUBLE)) { - return GenericType.DOUBLE; - } - - return GenericType.OBJECT; } } diff --git a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java index aff9813b3d92..9ff3906b4952 100644 --- a/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java +++ b/plugins/stream-debugger/src/main/java/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java @@ -124,7 +124,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper { for (int i = 1; i < myTabContents.size(); i++) { if (i == myTabContents.size() - 1 && (resolvedTrace.exceptionThrown() || - resolvedTrace.getSourceChain().getTerminationCall().getResultType().equals(GenericType.VOID))) { + resolvedTrace.getSourceChain().getTerminationCall().getResultType().equals(GenericType.Companion.getVOID()))) { break; } @@ -145,7 +145,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper { myTabsPane.insertTab("Exception", AllIcons.Nodes.ErrorIntroduction, new ExceptionView(context, result), "", 0); myTabsPane.setSelectedIndex(0); } - else if (resolvedTrace.getSourceChain().getTerminationCall().getResultType().equals(GenericType.VOID)) { + else if (resolvedTrace.getSourceChain().getTerminationCall().getResultType().equals(GenericType.Companion.getVOID())) { resultTab.setContent(new JBLabel("There is no result of such stream chain", SwingConstants.CENTER), BorderLayout.CENTER); } @@ -204,7 +204,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper { final ResolvedStreamCall.Terminator terminator = chain.getTerminator(); final IntermediateState afterTerminationState = terminator.getStateAfter(); - if (afterTerminationState != null && !terminator.getCall().getResultType().equals(GenericType.VOID)) { + if (afterTerminationState != null && !terminator.getCall().getResultType().equals(GenericType.Companion.getVOID())) { final TraceControllerImpl terminationController = new TraceControllerImpl(afterTerminationState); diff --git a/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/PrimitiveObjectBuilderPositiveTest.java b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/PrimitiveObjectBuilderPositiveTest.java index 269824556b12..4005ca21d8da 100644 --- a/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/PrimitiveObjectBuilderPositiveTest.java +++ b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/PrimitiveObjectBuilderPositiveTest.java @@ -30,43 +30,44 @@ import static com.intellij.debugger.streams.trace.impl.handler.type.GenericType. */ public class PrimitiveObjectBuilderPositiveTest extends StreamChainBuilderPositiveTestBase { public void testSimpleObject() { - doTest(OBJECT); + doTest(Companion.getOBJECT()); } public void testSimpleInt() { - doTest(INT); + doTest(Companion.getINT()); } public void testSimpleDouble() { - doTest(DOUBLE); + doTest(Companion.getDOUBLE()); } public void testSimpleLong() { - doTest(LONG); + doTest(Companion.getLONG()); } public void testObj2Int() { - doTest(OBJECT, INT); + doTest(Companion.getOBJECT(), Companion.getINT()); } public void testObj2Long() { - doTest(OBJECT, LONG); + doTest(Companion.getOBJECT(), Companion.getLONG()); } public void testObj2Double() { - doTest(OBJECT, DOUBLE); + doTest(Companion.getOBJECT(), Companion.getDOUBLE()); } public void testPrimitiveIdentity() { - doTest(INT, INT); + doTest(Companion.getINT(), Companion.getINT()); } public void testPrimitive2Obj() { - doTest(DOUBLE, OBJECT); + doTest(Companion.getDOUBLE(), Companion.getOBJECT()); } public void testFewTransitions() { - doTest(OBJECT, INT, INT, OBJECT, DOUBLE, OBJECT, LONG); + doTest(Companion.getOBJECT(), Companion.getINT(), Companion.getINT(), Companion.getOBJECT(), Companion.getDOUBLE(), + Companion.getOBJECT(), Companion.getLONG()); } private void doTest(@NotNull GenericType producerAfterType, diff --git a/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/TerminationCallTypeTest.java b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/TerminationCallTypeTest.java index b80369f26d03..5b14a0a8be44 100644 --- a/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/TerminationCallTypeTest.java +++ b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/chain/positive/TerminationCallTypeTest.java @@ -28,23 +28,23 @@ import java.util.List; */ public class TerminationCallTypeTest extends StreamChainBuilderPositiveTestBase { public void testVoidType() throws Exception { - doTest(GenericType.VOID); + doTest(GenericType.Companion.getVOID()); } public void testBooleanType() throws Exception { - doTest(GenericType.BOOLEAN); + doTest(GenericType.Companion.getBOOLEAN()); } public void testIntType() throws Exception { - doTest(GenericType.INT); + doTest(GenericType.Companion.getINT()); } public void testDoubleType() throws Exception { - doTest(GenericType.DOUBLE); + doTest(GenericType.Companion.getDOUBLE()); } public void testLongType() throws Exception { - doTest(GenericType.LONG); + doTest(GenericType.Companion.getLONG()); } public void testReferenceType() throws Exception {