Apply project code style settings to sequence debugger code

This commit is contained in:
Vitaliy.Bibaev
2018-06-09 11:12:48 +03:00
committed by Yan Zhulanow
parent 245a358ea8
commit 2d22267cf1
67 changed files with 1480 additions and 1413 deletions
@@ -1,7 +1,6 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.collections package org.jetbrains.kotlin.idea.debugger.sequence.lib.collections
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.interpret.FilterTraceInterpreter
import com.intellij.debugger.streams.lib.IntermediateOperation import com.intellij.debugger.streams.lib.IntermediateOperation
import com.intellij.debugger.streams.lib.TerminalOperation import com.intellij.debugger.streams.lib.TerminalOperation
import com.intellij.debugger.streams.lib.impl.LibrarySupportBase import com.intellij.debugger.streams.lib.impl.LibrarySupportBase
@@ -16,6 +15,7 @@ import com.intellij.debugger.streams.wrapper.TerminatorStreamCall
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.BothSemanticHandlerWrapper import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.BothSemanticHandlerWrapper
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.BothSemanticsHandler import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.BothSemanticsHandler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.FilterCallHandler import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.FilterCallHandler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.interpret.FilterTraceInterpreter
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -31,10 +31,10 @@ class KotlinCollectionLibrarySupport : LibrarySupportBase() {
addTerminationOperationsSupport(operation) addTerminationOperationsSupport(operation)
} }
private abstract class CollectionOperation(override val name: String, private abstract class CollectionOperation(
override val name: String,
handler: BothSemanticsHandler handler: BothSemanticsHandler
) ) : IntermediateOperation, TerminalOperation {
: IntermediateOperation, TerminalOperation {
private val wrapper = BothSemanticHandlerWrapper(handler) private val wrapper = BothSemanticHandlerWrapper(handler)
@@ -45,8 +45,8 @@ class KotlinCollectionLibrarySupport : LibrarySupportBase() {
wrapper.createTerminatorHandler(call, resultExpression, dsl) wrapper.createTerminatorHandler(call, resultExpression, dsl)
} }
private class FilterOperation(name: String, handler: BothSemanticsHandler, valueToAccept: Boolean) private class FilterOperation(name: String, handler: BothSemanticsHandler, valueToAccept: Boolean) :
: CollectionOperation(name, handler) { CollectionOperation(name, handler) {
override val traceInterpreter: CallTraceInterpreter = FilterTraceInterpreter(valueToAccept) override val traceInterpreter: CallTraceInterpreter = FilterTraceInterpreter(valueToAccept)
override val valuesOrderResolver: ValuesOrderResolver = FilterResolver() override val valuesOrderResolver: ValuesOrderResolver = FilterResolver()
} }
@@ -1,17 +1,17 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.collections package org.jetbrains.kotlin.idea.debugger.sequence.lib.collections
import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.collections.KotlinCollectionChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCollectionsPeekCallFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder
import com.intellij.debugger.streams.lib.LibrarySupport import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.trace.TraceExpressionBuilder import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.collections.KotlinCollectionChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCollectionsPeekCallFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -29,6 +29,6 @@ class KotlinCollectionSupportProvider : LibrarySupportProvider {
override fun getLibrarySupport(): LibrarySupport = support override fun getLibrarySupport(): LibrarySupport = support
override fun getExpressionBuilder(project: Project): TraceExpressionBuilder override fun getExpressionBuilder(project: Project): TraceExpressionBuilder =
= KotlinTraceExpressionBuilder(dsl, support.createHandlerFactory(dsl)) KotlinTraceExpressionBuilder(dsl, support.createHandlerFactory(dsl))
} }
@@ -1,6 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.java package org.jetbrains.kotlin.idea.debugger.sequence.lib.java
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.lib.impl.StandardLibrarySupport
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.PackageBasedCallChecker import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.PackageBasedCallChecker
@@ -9,13 +16,6 @@ import org.jetbrains.kotlin.idea.debugger.sequence.psi.java.JavaStreamChainTypeE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.JavaPeekCallFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.JavaPeekCallFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.lib.impl.StandardLibrarySupport
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,6 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.java package org.jetbrains.kotlin.idea.debugger.sequence.lib.java
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.lib.impl.StreamExLibrarySupport
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.PackageBasedCallChecker import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.PackageBasedCallChecker
@@ -9,13 +16,6 @@ import org.jetbrains.kotlin.idea.debugger.sequence.psi.java.JavaStreamChainTypeE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.JavaPeekCallFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.JavaPeekCallFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.lib.impl.StreamExLibrarySupport
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,6 +1,12 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence package org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil import org.jetbrains.kotlin.idea.debugger.sequence.lib.LibraryUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.TerminatedChainBuilder import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.TerminatedChainBuilder
@@ -9,12 +15,6 @@ import org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence.SequenceTypeExtr
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCollectionsPeekCallFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCollectionsPeekCallFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinStatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.KotlinTraceExpressionBuilder
import com.intellij.debugger.streams.lib.LibrarySupport
import com.intellij.debugger.streams.lib.LibrarySupportProvider
import com.intellij.debugger.streams.trace.TraceExpressionBuilder
import com.intellij.debugger.streams.trace.dsl.impl.DslImpl
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import com.intellij.openapi.project.Project
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,30 +1,38 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence package org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.ChunkedResolver
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.FilteredMapResolver
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.WindowedResolver
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence.FilterIsInstanceHandler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence.KotlinDistinctByHandler
import com.intellij.debugger.streams.lib.IntermediateOperation import com.intellij.debugger.streams.lib.IntermediateOperation
import com.intellij.debugger.streams.lib.impl.* import com.intellij.debugger.streams.lib.impl.*
import com.intellij.debugger.streams.resolve.AppendResolver import com.intellij.debugger.streams.resolve.AppendResolver
import com.intellij.debugger.streams.resolve.PairMapResolver import com.intellij.debugger.streams.resolve.PairMapResolver
import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctTraceHandler import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctTraceHandler
import com.intellij.debugger.streams.trace.impl.interpret.SimplePeekCallTraceInterpreter import com.intellij.debugger.streams.trace.impl.interpret.SimplePeekCallTraceInterpreter
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.ChunkedResolver
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.FilteredMapResolver
import org.jetbrains.kotlin.idea.debugger.sequence.resolve.WindowedResolver
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence.FilterIsInstanceHandler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence.KotlinDistinctByHandler
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinSequencesSupport : LibrarySupportBase() { class KotlinSequencesSupport : LibrarySupportBase() {
init { init {
addIntermediateOperationsSupport(*filterOperations("filter", "filterNot", "filterIndexed", addIntermediateOperationsSupport(
"drop", "dropWhile", "minus", "minusElement", "take", "takeWhile", "onEach", "asSequence")) *filterOperations(
"filter", "filterNot", "filterIndexed",
"drop", "dropWhile", "minus", "minusElement", "take", "takeWhile", "onEach", "asSequence"
)
)
addIntermediateOperationsSupport(FilterIsInstanceOperationHandler()) addIntermediateOperationsSupport(FilterIsInstanceOperationHandler())
addIntermediateOperationsSupport(*mapOperations("map", "mapIndexed", "requireNoNulls", "withIndex", addIntermediateOperationsSupport(
"zip", "constrainOnce")) *mapOperations(
"map", "mapIndexed", "requireNoNulls", "withIndex",
"zip", "constrainOnce"
)
)
addIntermediateOperationsSupport(*flatMapOperations("flatMap", "flatten")) addIntermediateOperationsSupport(*flatMapOperations("flatMap", "flatten"))
@@ -55,8 +63,8 @@ class KotlinSequencesSupport : LibrarySupportBase() {
private fun sortedOperations(vararg names: String): Array<IntermediateOperation> = private fun sortedOperations(vararg names: String): Array<IntermediateOperation> =
names.map { SortedOperation(it) }.toTypedArray() names.map { SortedOperation(it) }.toTypedArray()
private class FilterIsInstanceOperationHandler() private class FilterIsInstanceOperationHandler() : IntermediateOperationBase(
: IntermediateOperationBase("filterIsInstance", ::FilterIsInstanceHandler, "filterIsInstance", ::FilterIsInstanceHandler,
SimplePeekCallTraceInterpreter(), FilteredMapResolver() SimplePeekCallTraceInterpreter(), FilteredMapResolver()
) )
} }
@@ -1,14 +1,14 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collections package org.jetbrains.kotlin.idea.debugger.sequence.psi.collections
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl
import org.jetbrains.kotlin.idea.debugger.sequence.psi.resolveType
import com.intellij.debugger.streams.psi.ChainTransformer import com.intellij.debugger.streams.psi.ChainTransformer
import com.intellij.debugger.streams.wrapper.QualifierExpression import com.intellij.debugger.streams.wrapper.QualifierExpression
import com.intellij.debugger.streams.wrapper.StreamChain import com.intellij.debugger.streams.wrapper.StreamChain
import com.intellij.debugger.streams.wrapper.impl.StreamChainImpl import com.intellij.debugger.streams.wrapper.impl.StreamChainImpl
import com.intellij.psi.PsiElement import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.idea.debugger.sequence.psi.impl.KotlinChainTransformerImpl
import org.jetbrains.kotlin.idea.debugger.sequence.psi.resolveType
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
@@ -34,8 +34,7 @@ class CollectionChainTransformer : ChainTransformer<KtCallExpression> {
* We use asIterable to avoid further issues with the transformed expression evaluation * We use asIterable to avoid further issues with the transformed expression evaluation
* TODO: Avoid showing "asIterable()" in the tab name in trace window * TODO: Avoid showing "asIterable()" in the tab name in trace window
*/ */
private class WrappedQualifier(private val qualifierExpression: QualifierExpression) private class WrappedQualifier(private val qualifierExpression: QualifierExpression) : QualifierExpression by qualifierExpression {
: QualifierExpression by qualifierExpression {
override val text: String override val text: String
get() = qualifierExpression.text + ".asIterable()" get() = qualifierExpression.text + ".asIterable()"
} }
@@ -16,9 +16,11 @@ class KotlinCollectionChainBuilder
: KotlinChainBuilderBase(CollectionChainTransformer()) { : KotlinChainBuilderBase(CollectionChainTransformer()) {
private companion object { private companion object {
// TODO: Avoid enumeration of all available types // TODO: Avoid enumeration of all available types
val SUPPORTED_RECEIVERS = setOf("kotlin.collections.Iterable", "kotlin.CharSequence", "kotlin.Array", val SUPPORTED_RECEIVERS = setOf(
"kotlin.collections.Iterable", "kotlin.CharSequence", "kotlin.Array",
"kotlin.BooleanArray", "kotlin.ByteArray", "kotlin.ShortArray", "kotlin.CharArray", "kotlin.IntArray", "kotlin.BooleanArray", "kotlin.ByteArray", "kotlin.ShortArray", "kotlin.CharArray", "kotlin.IntArray",
"kotlin.LongArray", "kotlin.DoubleArray", "kotlin.FloatArray") "kotlin.LongArray", "kotlin.DoubleArray", "kotlin.FloatArray"
)
} }
private fun isCollectionTransformationCall(expression: KtCallExpression): Boolean { private fun isCollectionTransformationCall(expression: KtCallExpression): Boolean {
@@ -1,13 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collections package org.jetbrains.kotlin.idea.debugger.sequence.psi.collections
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.ANY
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.supertypes import org.jetbrains.kotlin.types.typeUtil.supertypes
@@ -30,14 +30,20 @@ class KotlinChainTransformerImpl(private val typeExtractor: CallTypeExtractor) :
for (call in callChain.subList(0, callChain.size - 1)) { for (call in callChain.subList(0, callChain.size - 1)) {
val (typeBefore, typeAfter) = typeExtractor.extractIntermediateCallTypes(call) val (typeBefore, typeAfter) = typeExtractor.extractIntermediateCallTypes(call)
intermediateCalls += IntermediateStreamCallImpl(call.callName(), intermediateCalls += IntermediateStreamCallImpl(call.callName(),
call.valueArguments.map { createCallArgument(call, it) }, typeBefore, typeAfter, call.textRange) call.valueArguments.map { createCallArgument(call, it) },
typeBefore,
typeAfter,
call.textRange
)
} }
val terminationsPsiCall = callChain.last() val terminationsPsiCall = callChain.last()
val (typeBeforeTerminator, resultType) = typeExtractor.extractTerminalCallTypes(terminationsPsiCall) val (typeBeforeTerminator, resultType) = typeExtractor.extractTerminalCallTypes(terminationsPsiCall)
val terminationCall = TerminatorStreamCallImpl(terminationsPsiCall.callName(), val terminationCall = TerminatorStreamCallImpl(
terminationsPsiCall.callName(),
terminationsPsiCall.valueArguments.map { createCallArgument(terminationsPsiCall, it) }, terminationsPsiCall.valueArguments.map { createCallArgument(terminationsPsiCall, it) },
typeBeforeTerminator, resultType, terminationsPsiCall.textRange) typeBeforeTerminator, resultType, terminationsPsiCall.textRange
)
val typeAfterQualifier = val typeAfterQualifier =
if (intermediateCalls.isEmpty()) typeBeforeTerminator else intermediateCalls.first().typeBefore if (intermediateCalls.isEmpty()) typeBeforeTerminator else intermediateCalls.first().typeBefore
@@ -1,11 +1,11 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.impl package org.jetbrains.kotlin.idea.debugger.sequence.psi.impl
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.psi.StreamCallChecker import org.jetbrains.kotlin.idea.debugger.sequence.psi.StreamCallChecker
import org.jetbrains.kotlin.idea.debugger.sequence.psi.receiverType import org.jetbrains.kotlin.idea.debugger.sequence.psi.receiverType
import org.jetbrains.kotlin.idea.debugger.sequence.psi.resolveType import org.jetbrains.kotlin.idea.debugger.sequence.psi.resolveType
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
@@ -21,8 +21,10 @@ class PackageBasedCallChecker(private val supportedPackage: String) : StreamCall
return checkReceiverSupported(expression) && checkResultSupported(expression, false) return checkReceiverSupported(expression) && checkResultSupported(expression, false)
} }
private fun checkResultSupported(expression: KtCallExpression, private fun checkResultSupported(
shouldSupportResult: Boolean): Boolean { expression: KtCallExpression,
shouldSupportResult: Boolean
): Boolean {
val resultType = expression.resolveType() val resultType = expression.resolveType()
return shouldSupportResult == isSupportedType(resultType) return shouldSupportResult == isSupportedType(resultType)
} }
@@ -1,19 +1,19 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.impl package org.jetbrains.kotlin.idea.debugger.sequence.psi.impl
import com.intellij.debugger.streams.psi.ChainTransformer
import org.jetbrains.kotlin.idea.debugger.sequence.psi.StreamCallChecker import org.jetbrains.kotlin.idea.debugger.sequence.psi.StreamCallChecker
import org.jetbrains.kotlin.idea.debugger.sequence.psi.previousCall import org.jetbrains.kotlin.idea.debugger.sequence.psi.previousCall
import com.intellij.debugger.streams.psi.ChainTransformer
import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtCallExpression
import java.util.* import java.util.*
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
open class TerminatedChainBuilder(transformer: ChainTransformer<KtCallExpression>, open class TerminatedChainBuilder(
transformer: ChainTransformer<KtCallExpression>,
private val callChecker: StreamCallChecker private val callChecker: StreamCallChecker
) ) : KotlinChainBuilderBase(transformer) {
: KotlinChainBuilderBase(transformer) {
override val existenceChecker: ExistenceChecker = MyExistenceChecker() override val existenceChecker: ExistenceChecker = MyExistenceChecker()
override fun createChainsBuilder(): ChainBuilder = MyBuilderVisitor() override fun createChainsBuilder(): ChainBuilder = MyBuilderVisitor()
@@ -1,12 +1,12 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.trace.impl.handler.type.ClassTypeImpl 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.trace.impl.handler.type.GenericType
import com.intellij.psi.CommonClassNames import com.intellij.psi.CommonClassNames
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.getImmediateSuperclassNotAny import org.jetbrains.kotlin.types.typeUtil.getImmediateSuperclassNotAny
@@ -1,12 +1,12 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.trace.impl.handler.type.ClassTypeImpl 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.trace.impl.handler.type.GenericType
import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.supertypes import org.jetbrains.kotlin.types.typeUtil.supertypes
@@ -11,8 +11,7 @@ import com.intellij.debugger.streams.trace.impl.handler.type.ArrayType
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinArrayVariable(override val type: ArrayType, override val name: String) class KotlinArrayVariable(override val type: ArrayType, override val name: String) : VariableImpl(type, name), ArrayVariable {
: VariableImpl(type, name), ArrayVariable {
override fun get(index: Expression): Expression = TextExpression("$name[${index.toCode()}]!!") override fun get(index: Expression): Expression = TextExpression("$name[${index.toCode()}]!!")
override fun set(index: Expression, value: Expression): Expression = TextExpression("$name[${index.toCode()}] = ${value.toCode()}") override fun set(index: Expression, value: Expression): Expression = TextExpression("$name[${index.toCode()}] = ${value.toCode()}")
@@ -1,9 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.OnEachCall
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.OnEachCall
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -9,9 +9,11 @@ import com.intellij.debugger.streams.trace.dsl.Variable
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinForEachLoop(private val iterateVariable: Variable, class KotlinForEachLoop(
private val iterateVariable: Variable,
private val collection: Expression, private val collection: Expression,
private val loopBody: ForLoopBody) : Convertable { private val loopBody: ForLoopBody
) : Convertable {
override fun toCode(indent: Int): String = override fun toCode(indent: Int): String =
"for (${iterateVariable.name} in ${collection.toCode()}) {\n".withIndent(indent) + "for (${iterateVariable.name} in ${collection.toCode()}) {\n".withIndent(indent) +
loopBody.toCode(indent + 1) + loopBody.toCode(indent + 1) +
@@ -9,10 +9,12 @@ import com.intellij.debugger.streams.trace.dsl.VariableDeclaration
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinForLoop(private val initialization: VariableDeclaration, class KotlinForLoop(
private val initialization: VariableDeclaration,
private val condition: Expression, private val condition: Expression,
private val afterThought: Expression, private val afterThought: Expression,
private val loopBody: ForLoopBody) : Convertable { private val loopBody: ForLoopBody
) : Convertable {
override fun toCode(indent: Int): String = override fun toCode(indent: Int): String =
initialization.toCode(indent) + "\n" + initialization.toCode(indent) + "\n" +
"while (${condition.toCode()}) {\n".withIndent(indent) + "while (${condition.toCode()}) {\n".withIndent(indent) +
@@ -1,18 +1,19 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.debugger.streams.kotlin.trace.dsl package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl
import com.intellij.debugger.streams.trace.dsl.Expression import com.intellij.debugger.streams.trace.dsl.Expression
import com.intellij.debugger.streams.trace.dsl.ForLoopBody import com.intellij.debugger.streams.trace.dsl.ForLoopBody
import com.intellij.debugger.streams.trace.dsl.StatementFactory import com.intellij.debugger.streams.trace.dsl.StatementFactory
import com.intellij.debugger.streams.trace.dsl.Variable import com.intellij.debugger.streams.trace.dsl.Variable
import com.intellij.debugger.streams.trace.dsl.impl.TextExpression import com.intellij.debugger.streams.trace.dsl.impl.TextExpression
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCodeBlock
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinForLoopBody(override val loopVariable: Variable, class KotlinForLoopBody(
statementFactory: StatementFactory) : KotlinCodeBlock(statementFactory), ForLoopBody { override val loopVariable: Variable,
statementFactory: StatementFactory
) : KotlinCodeBlock(statementFactory), ForLoopBody {
private companion object { private companion object {
val BREAK = TextExpression("break") val BREAK = TextExpression("break")
} }
@@ -9,8 +9,8 @@ import com.intellij.debugger.streams.trace.dsl.impl.common.IfBranchBase
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinIfBranch(condition: Expression, thenBlock: CodeBlock, statementFactory: StatementFactory) class KotlinIfBranch(condition: Expression, thenBlock: CodeBlock, statementFactory: StatementFactory) :
: IfBranchBase(condition, thenBlock, statementFactory) { IfBranchBase(condition, thenBlock, statementFactory) {
override fun toCode(indent: Int): String { override fun toCode(indent: Int): String {
val elseBlockVar = elseBlock val elseBlockVar = elseBlock
val ifThen = "if (${condition.toCode(0)}) {\n".withIndent(indent) + val ifThen = "if (${condition.toCode(0)}) {\n".withIndent(indent) +
@@ -4,10 +4,9 @@ package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl
import com.intellij.debugger.streams.trace.dsl.Expression import com.intellij.debugger.streams.trace.dsl.Expression
import com.intellij.debugger.streams.trace.dsl.LambdaBody import com.intellij.debugger.streams.trace.dsl.LambdaBody
import com.intellij.debugger.streams.trace.dsl.StatementFactory import com.intellij.debugger.streams.trace.dsl.StatementFactory
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinCodeBlock
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinLambdaBody(override val lambdaArg: Expression, statementFactory: StatementFactory) class KotlinLambdaBody(override val lambdaArg: Expression, statementFactory: StatementFactory) : KotlinCodeBlock(statementFactory),
: KotlinCodeBlock(statementFactory), LambdaBody LambdaBody
@@ -10,8 +10,7 @@ import com.intellij.debugger.streams.trace.impl.handler.type.ListType
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinListVariable(override val type: ListType, name: String) class KotlinListVariable(override val type: ListType, name: String) : VariableImpl(type, name), ListVariable {
: VariableImpl(type, name), ListVariable {
override fun get(index: Expression): Expression = call("get", index) override fun get(index: Expression): Expression = call("get", index)
override fun set(index: Expression, newValue: Expression): Expression = call("set", index, newValue) override fun set(index: Expression, newValue: Expression): Expression = call("set", index, newValue)
override fun add(element: Expression): Expression = call("add", element) override fun add(element: Expression): Expression = call("add", element)
@@ -1,7 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl
import com.intellij.debugger.streams.trace.dsl.* import com.intellij.debugger.streams.trace.dsl.Expression
import com.intellij.debugger.streams.trace.dsl.Lambda
import com.intellij.debugger.streams.trace.dsl.VariableDeclaration
import com.intellij.debugger.streams.trace.dsl.impl.TextExpression import com.intellij.debugger.streams.trace.dsl.impl.TextExpression
import com.intellij.debugger.streams.trace.dsl.impl.common.MapVariableBase import com.intellij.debugger.streams.trace.dsl.impl.common.MapVariableBase
import com.intellij.debugger.streams.trace.impl.handler.type.MapType import com.intellij.debugger.streams.trace.impl.handler.type.MapType
@@ -1,7 +1,6 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl package org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl
import com.intellij.debugger.streams.kotlin.trace.dsl.*
import com.intellij.debugger.streams.trace.dsl.* import com.intellij.debugger.streams.trace.dsl.*
import com.intellij.debugger.streams.trace.dsl.impl.AssignmentStatement import com.intellij.debugger.streams.trace.dsl.impl.AssignmentStatement
import com.intellij.debugger.streams.trace.dsl.impl.TextExpression import com.intellij.debugger.streams.trace.dsl.impl.TextExpression
@@ -16,7 +15,8 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
override fun createNewListExpression(elementType: GenericType, vararg args: Expression): Expression = override fun createNewListExpression(elementType: GenericType, vararg args: Expression): Expression =
TextExpression("kotlin.collections.mutableListOf<${elementType.genericTypeName}>(${StatementFactory.commaSeparate(*args)})") TextExpression("kotlin.collections.mutableListOf<${elementType.genericTypeName}>(${StatementFactory.commaSeparate(*args)})")
override fun createListVariable(elementType: GenericType, name: String): ListVariable = KotlinListVariable(types.list(elementType), name) override fun createListVariable(elementType: GenericType, name: String): ListVariable =
KotlinListVariable(types.list(elementType), name)
override fun not(expression: Expression): Expression = TextExpression("!${expression.toCode()}") override fun not(expression: Expression): Expression = TextExpression("!${expression.toCode()}")
@@ -37,8 +37,10 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
override fun createForEachLoop(iterateVariable: Variable, collection: Expression, loopBody: ForLoopBody): Convertable = override fun createForEachLoop(iterateVariable: Variable, collection: Expression, loopBody: ForLoopBody): Convertable =
KotlinForEachLoop(iterateVariable, collection, loopBody) KotlinForEachLoop(iterateVariable, collection, loopBody)
override fun createForLoop(initialization: VariableDeclaration, condition: Expression, override fun createForLoop(
afterThought: Expression, loopBody: ForLoopBody): Convertable = initialization: VariableDeclaration, condition: Expression,
afterThought: Expression, loopBody: ForLoopBody
): Convertable =
KotlinForLoop(initialization, condition, afterThought, loopBody) KotlinForLoop(initialization, condition, afterThought, loopBody)
override fun createEmptyLambdaBody(argName: String): LambdaBody = KotlinLambdaBody(TextExpression(argName), this) override fun createEmptyLambdaBody(argName: String): LambdaBody = KotlinLambdaBody(TextExpression(argName), this)
@@ -24,8 +24,10 @@ object KotlinTypes : Types {
val NULLABLE_ANY: GenericType = nullable { ANY } val NULLABLE_ANY: GenericType = nullable { ANY }
override val TIME: GenericType = ClassTypeImpl("java.util.concurrent.atomic.AtomicInteger", override val TIME: GenericType = ClassTypeImpl(
"java.util.concurrent.atomic.AtomicInteger()") "java.util.concurrent.atomic.AtomicInteger",
"java.util.concurrent.atomic.AtomicInteger()"
)
override fun list(elementsType: GenericType): ListType = override fun list(elementsType: GenericType): ListType =
ListTypeImpl(elementsType, { "kotlin.collections.MutableList<$it>" }, "kotlin.collections.mutableListOf()") ListTypeImpl(elementsType, { "kotlin.collections.MutableList<$it>" }, "kotlin.collections.mutableListOf()")
@@ -44,14 +46,18 @@ object KotlinTypes : Types {
} }
override fun map(keyType: GenericType, valueType: GenericType): MapType = override fun map(keyType: GenericType, valueType: GenericType): MapType =
MapTypeImpl(keyType, valueType, MapTypeImpl(
keyType, valueType,
{ keys, values -> "kotlin.collections.MutableMap<$keys, $values>" }, { keys, values -> "kotlin.collections.MutableMap<$keys, $values>" },
"kotlin.collections.mutableMapOf()") "kotlin.collections.mutableMapOf()"
)
override fun linkedMap(keyType: GenericType, valueType: GenericType): MapType = override fun linkedMap(keyType: GenericType, valueType: GenericType): MapType =
MapTypeImpl(keyType, valueType, MapTypeImpl(
keyType, valueType,
{ keys, values -> "kotlin.collections.MutableMap<$keys, $values>" }, { keys, values -> "kotlin.collections.MutableMap<$keys, $values>" },
"kotlin.collections.linkedMapOf()") "kotlin.collections.linkedMapOf()"
)
override fun nullable(typeSelector: Types.() -> GenericType): GenericType { override fun nullable(typeSelector: Types.() -> GenericType): GenericType {
val type = this.typeSelector() val type = this.typeSelector()
@@ -59,8 +65,10 @@ object KotlinTypes : Types {
return when (type) { return when (type) {
is ArrayType -> ArrayTypeImpl(type.elementType, { "kotlin.Array<$it>?" }, { type.sizedDeclaration(it) }) is ArrayType -> ArrayTypeImpl(type.elementType, { "kotlin.Array<$it>?" }, { type.sizedDeclaration(it) })
is ListType -> ListTypeImpl(type.elementType, { "kotlin.collections.MutableList<$it>?" }, type.defaultValue) is ListType -> ListTypeImpl(type.elementType, { "kotlin.collections.MutableList<$it>?" }, type.defaultValue)
is MapType -> MapTypeImpl(type.keyType, type.valueType, { keys, values -> "kotlin.collections.MutableMap<$keys, $values>?" }, is MapType -> MapTypeImpl(
type.defaultValue) type.keyType, type.valueType, { keys, values -> "kotlin.collections.MutableMap<$keys, $values>?" },
type.defaultValue
)
else -> ClassTypeImpl(type.genericTypeName + '?', type.defaultValue) else -> ClassTypeImpl(type.genericTypeName + '?', type.defaultValue)
} }
} }
@@ -7,9 +7,11 @@ import com.intellij.debugger.streams.trace.dsl.VariableDeclaration
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinVariableDeclaration(override val variable: Variable, class KotlinVariableDeclaration(
override val variable: Variable,
override val isMutable: Boolean, override val isMutable: Boolean,
private val init: String = "") : VariableDeclaration { private val init: String = ""
) : VariableDeclaration {
override fun toCode(indent: Int): String { override fun toCode(indent: Int): String {
val prefix = if (isMutable) "var" else "val" val prefix = if (isMutable) "var" else "val"
val suffix = if (init.trim().isEmpty()) "" else " = $init" val suffix = if (init.trim().isEmpty()) "" else " = $init"
@@ -1,13 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.debugger.streams.wrapper.CallArgument import com.intellij.debugger.streams.wrapper.CallArgument
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.StreamCallType import com.intellij.debugger.streams.wrapper.StreamCallType
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -11,10 +11,10 @@ import com.intellij.debugger.streams.wrapper.StreamCall
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
abstract class CollectionHandlerBase(order: Int, private val dsl: Dsl, abstract class CollectionHandlerBase(
order: Int, private val dsl: Dsl,
private val call: StreamCall, private val internalHandler: BothSemanticsHandler private val call: StreamCall, private val internalHandler: BothSemanticsHandler
) ) : TraceHandler {
: TraceHandler {
private val declarations: List<VariableDeclaration> = internalHandler.variablesDeclaration(call, order, dsl) private val declarations: List<VariableDeclaration> = internalHandler.variablesDeclaration(call, order, dsl)
protected val variables: List<Variable> = declarations.map(VariableDeclaration::variable) protected val variables: List<Variable> = declarations.map(VariableDeclaration::variable)
@@ -2,7 +2,9 @@
package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections
import com.intellij.debugger.streams.trace.IntermediateCallHandler import com.intellij.debugger.streams.trace.IntermediateCallHandler
import com.intellij.debugger.streams.trace.dsl.* import com.intellij.debugger.streams.trace.dsl.CodeBlock
import com.intellij.debugger.streams.trace.dsl.Dsl
import com.intellij.debugger.streams.trace.dsl.Expression
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
/** /**
@@ -13,8 +15,7 @@ class CollectionIntermediateHandler(
private val call: IntermediateStreamCall, private val call: IntermediateStreamCall,
private val dsl: Dsl, private val dsl: Dsl,
private val internalHandler: BothSemanticsHandler private val internalHandler: BothSemanticsHandler
) ) : IntermediateCallHandler, CollectionHandlerBase(order, dsl, call, internalHandler) {
: IntermediateCallHandler, CollectionHandlerBase(order, dsl, call, internalHandler) {
override fun prepareResult(): CodeBlock { override fun prepareResult(): CodeBlock {
return internalHandler.prepareResult(dsl, variables) return internalHandler.prepareResult(dsl, variables)
@@ -8,18 +8,16 @@ 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.TextExpression
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.TerminatorStreamCall import com.intellij.debugger.streams.wrapper.TerminatorStreamCall
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.BothSemanticsHandler
import org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.collections.CollectionHandlerBase
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class CollectionTerminatorHandler(private val call: TerminatorStreamCall, class CollectionTerminatorHandler(
private val call: TerminatorStreamCall,
private val resultExpression: String, private val resultExpression: String,
private val dsl: Dsl, private val dsl: Dsl,
private val internalHandler: BothSemanticsHandler private val internalHandler: BothSemanticsHandler
) ) : TerminatorCallHandler, CollectionHandlerBase(Int.MAX_VALUE, dsl, call, internalHandler) {
: TerminatorCallHandler, CollectionHandlerBase(Int.MAX_VALUE, dsl, call, internalHandler) {
override fun prepareResult(): CodeBlock { override fun prepareResult(): CodeBlock {
val prepareResult = internalHandler.prepareResult(dsl, variables) val prepareResult = internalHandler.prepareResult(dsl, variables)
@@ -32,8 +32,10 @@ class FilterCallHandler : BothSemanticsHandler {
// TODO: use generic types in CallArgument // TODO: use generic types in CallArgument
val oldFilterPredicate = dsl.variable(ClassTypeImpl(predicate.type), oldPredicateVariableName(order)) val oldFilterPredicate = dsl.variable(ClassTypeImpl(predicate.type), oldPredicateVariableName(order))
return listOf(timeToObjectMap.defaultDeclaration(), predicateResultMap.defaultDeclaration(), return listOf(
dsl.declaration(oldFilterPredicate, TextExpression(predicate.text), false)) timeToObjectMap.defaultDeclaration(), predicateResultMap.defaultDeclaration(),
dsl.declaration(oldFilterPredicate, TextExpression(predicate.text), false)
)
} }
override fun prepareResult(dsl: Dsl, variables: List<Variable>): CodeBlock { override fun prepareResult(dsl: Dsl, variables: List<Variable>): CodeBlock {
@@ -1,7 +1,6 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.trace.dsl.CodeBlock import com.intellij.debugger.streams.trace.dsl.CodeBlock
import com.intellij.debugger.streams.trace.dsl.Dsl import com.intellij.debugger.streams.trace.dsl.Dsl
import com.intellij.debugger.streams.trace.dsl.Expression import com.intellij.debugger.streams.trace.dsl.Expression
@@ -13,6 +12,7 @@ import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl
import com.intellij.openapi.util.TextRange.EMPTY_RANGE import com.intellij.openapi.util.TextRange.EMPTY_RANGE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,7 +1,6 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler.sequence
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.trace.dsl.* import com.intellij.debugger.streams.trace.dsl.*
import com.intellij.debugger.streams.trace.dsl.impl.TextExpression import com.intellij.debugger.streams.trace.dsl.impl.TextExpression
import com.intellij.debugger.streams.trace.impl.handler.type.ClassTypeImpl import com.intellij.debugger.streams.trace.impl.handler.type.ClassTypeImpl
@@ -11,13 +10,13 @@ import com.intellij.debugger.streams.wrapper.CallArgument
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
/** /**
* Based on com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler * Based on com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStreamCall, dsl: Dsl) class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) {
: HandlerBase.Intermediate(dsl) {
private companion object { private companion object {
val KEY_EXTRACTOR_VARIABLE_PREFIX = "keyExtractor" val KEY_EXTRACTOR_VARIABLE_PREFIX = "keyExtractor"
val TRANSITIONS_ARRAY_NAME = "transitionsArray" val TRANSITIONS_ARRAY_NAME = "transitionsArray"
@@ -41,8 +40,10 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
override fun additionalVariablesDeclaration(): List<VariableDeclaration> { override fun additionalVariablesDeclaration(): List<VariableDeclaration> {
val extractor = dsl.declaration(extractorVariable, TextExpression(keyExtractor.text), false) val extractor = dsl.declaration(extractorVariable, TextExpression(keyExtractor.text), false)
val variables = val variables =
mutableListOf(extractor, beforeTimes.defaultDeclaration(), beforeValues.defaultDeclaration(), mutableListOf(
time2ValueAfter.defaultDeclaration(), keys.defaultDeclaration()) extractor, beforeTimes.defaultDeclaration(), beforeValues.defaultDeclaration(),
time2ValueAfter.defaultDeclaration(), keys.defaultDeclaration()
)
variables.addAll(peekHandler.additionalVariablesDeclaration()) variables.addAll(peekHandler.additionalVariablesDeclaration())
return variables return variables
@@ -113,9 +114,11 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
} }
private fun CodeContext.integerIteration(border: Expression, block: CodeBlock, init: ForLoopBody.() -> Unit) { private fun CodeContext.integerIteration(border: Expression, block: CodeBlock, init: ForLoopBody.() -> Unit) {
block.forLoop(declaration(variable(types.INT, "i"), TextExpression("0"), true), block.forLoop(
declaration(variable(types.INT, "i"), TextExpression("0"), true),
TextExpression("i < ${border.toCode()}"), TextExpression("i < ${border.toCode()}"),
TextExpression("i = i + 1"), init) TextExpression("i = i + 1"), init
)
} }
private fun IntermediateStreamCall.updateArguments(args: List<CallArgument>): IntermediateStreamCall = private fun IntermediateStreamCall.updateArguments(args: List<CallArgument>): IntermediateStreamCall =
@@ -8,10 +8,11 @@ import com.intellij.debugger.streams.wrapper.StreamCall
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
class ValuesOrder(private val call: StreamCall, class ValuesOrder(
private val call: StreamCall,
private val before: Map<Int, TraceElement>, private val before: Map<Int, TraceElement>,
private val after: Map<Int, TraceElement>) private val after: Map<Int, TraceElement>
: TraceInfo { ) : TraceInfo {
override fun getValuesOrderBefore(): Map<Int, TraceElement> = before override fun getValuesOrderBefore(): Map<Int, TraceElement> = before
override fun getCall(): StreamCall = call override fun getCall(): StreamCall = call
@@ -31,6 +31,7 @@ import java.util.*
abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : StreamChainBuilderTestCase() { abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : StreamChainBuilderTestCase() {
override fun getTestDataPath(): String = override fun getTestDataPath(): String =
Paths.get(File("").absolutePath, "idea/testData/debugger/sequence/psi/$relativeTestPath/").toString() Paths.get(File("").absolutePath, "idea/testData/debugger/sequence/psi/$relativeTestPath/").toString()
override fun getFileExtension(): String = ".kt" override fun getFileExtension(): String = ".kt"
abstract val kotlinChainBuilder: StreamChainBuilder abstract val kotlinChainBuilder: StreamChainBuilder
override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder
@@ -49,7 +50,13 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) :
ApplicationManager.getApplication().runWriteAction { ApplicationManager.getApplication().runWriteAction {
if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) { if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) {
val stdLibPath = ForTestCompileRuntime.runtimeJarForTests() val stdLibPath = ForTestCompileRuntime.runtimeJarForTests()
PsiTestUtil.addLibrary(testRootDisposable, LightPlatformTestCase.getModule(), stdLibName, stdLibPath.parent, stdLibPath.name) PsiTestUtil.addLibrary(
testRootDisposable,
LightPlatformTestCase.getModule(),
stdLibName,
stdLibPath.parent,
stdLibPath.name
)
} }
} }
LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount() LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount()
@@ -68,7 +75,8 @@ abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) :
private fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) { private fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>() val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>()
val vFileToViewProviderMap = ((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap val vFileToViewProviderMap =
((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
for ((file, viewProvider) in vFileToViewProviderMap) { for ((file, viewProvider) in vFileToViewProviderMap) {
if (file.isStdLibFile && viewProvider is KotlinDecompiledFileViewProvider) { if (file.isStdLibFile && viewProvider is KotlinDecompiledFileViewProvider) {
stdLibViewProviders.add(viewProvider) stdLibViewProviders.add(viewProvider)
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollect
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
@Suppress("unused")
abstract class AbstractCollectionTraceTestCase : KotlinTraceTestCase() { abstract class AbstractCollectionTraceTestCase : KotlinTraceTestCase() {
override val librarySupportProvider: LibrarySupportProvider = KotlinCollectionSupportProvider() override val librarySupportProvider: LibrarySupportProvider = KotlinCollectionSupportProvider()
} }
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibraryS
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
@Suppress("unused")
abstract class AbstractJavaStreamTraceTestCase : KotlinTraceTestCase() { abstract class AbstractJavaStreamTraceTestCase : KotlinTraceTestCase() {
override val librarySupportProvider: LibrarySupportProvider = JavaStandardLibrarySupportProvider() override val librarySupportProvider: LibrarySupportProvider = JavaStandardLibrarySupportProvider()
} }
@@ -15,7 +15,9 @@ import org.junit.runner.RunWith;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /**
* This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY
*/
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence") @TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@@ -26,7 +28,8 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInSequence() throws Exception { public void testAllFilesPresentInSequence() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "terminal"); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "terminal");
} }
@TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence/append") @TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence/append")
@@ -38,7 +41,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInAppend() throws Exception { public void testAllFilesPresentInAppend() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/append"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/append"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("PlusArray.kt") @TestMetadata("PlusArray.kt")
@@ -71,7 +76,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInDistinct() throws Exception { public void testAllFilesPresentInDistinct() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/distinct"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/distinct"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("Distinct.kt") @TestMetadata("Distinct.kt")
@@ -119,7 +126,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInFilter() throws Exception { public void testAllFilesPresentInFilter() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/filter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/filter"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("Drop.kt") @TestMetadata("Drop.kt")
@@ -182,7 +191,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInFlatMap() throws Exception { public void testAllFilesPresentInFlatMap() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/flatMap"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/flatMap"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("FlatMap.kt") @TestMetadata("FlatMap.kt")
@@ -205,7 +216,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInMap() throws Exception { public void testAllFilesPresentInMap() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/map"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/map"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("Map.kt") @TestMetadata("Map.kt")
@@ -238,7 +251,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInMisc() throws Exception { public void testAllFilesPresentInMisc() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/misc"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/misc"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("AsSequence.kt") @TestMetadata("AsSequence.kt")
@@ -326,7 +341,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
} }
public void testAllFilesPresentInSort() throws Exception { public void testAllFilesPresentInSort() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/sort"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/sort"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("Sorted.kt") @TestMetadata("Sorted.kt")
@@ -1,16 +1,18 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi package org.jetbrains.kotlin.idea.debugger.sequence.psi
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
*/ */
abstract class TypedChainTestCase(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) { abstract class TypedChainTestCase(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
protected fun doTest(producerAfterType: GenericType, protected fun doTest(
vararg intermediateAfterTypes: GenericType) { producerAfterType: GenericType,
vararg intermediateAfterTypes: GenericType
) {
val elementAtCaret = configureAndGetElementAtCaret() val elementAtCaret = configureAndGetElementAtCaret()
assertNotNull(elementAtCaret) assertNotNull(elementAtCaret)
val chains = chainBuilder.build(elementAtCaret) val chains = chainBuilder.build(elementAtCaret)
@@ -1,9 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,10 +1,10 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,9 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,9 +1,9 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,13 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.DOUBLE import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.DOUBLE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.INT import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.INT
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.LONG import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.LONG
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev
@@ -1,10 +1,10 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. // Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence.KotlinSequenceSupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence.KotlinSequenceSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/** /**
* @author Vitaliy.Bibaev * @author Vitaliy.Bibaev