private -> internal where it's necessary
This commit is contained in:
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
|
||||
private object EditCommaSeparatedListHelper {
|
||||
internal object EditCommaSeparatedListHelper {
|
||||
public fun <TItem: JetElement> addItem(list: JetElement, allItems: List<TItem>, item: TItem): TItem {
|
||||
return addItemBefore(list, allItems, item, null)
|
||||
}
|
||||
|
||||
+14
-14
@@ -839,19 +839,19 @@ private fun getCompileTimeType(c: JetType): CompileTimeType<out Any>? {
|
||||
|
||||
private class CompileTimeType<T>
|
||||
|
||||
private val BYTE = CompileTimeType<Byte>()
|
||||
private val SHORT = CompileTimeType<Short>()
|
||||
private val INT = CompileTimeType<Int>()
|
||||
private val LONG = CompileTimeType<Long>()
|
||||
private val DOUBLE = CompileTimeType<Double>()
|
||||
private val FLOAT = CompileTimeType<Float>()
|
||||
private val CHAR = CompileTimeType<Char>()
|
||||
private val BOOLEAN = CompileTimeType<Boolean>()
|
||||
private val STRING = CompileTimeType<String>()
|
||||
private val ANY = CompileTimeType<Any>()
|
||||
internal val BYTE = CompileTimeType<Byte>()
|
||||
internal val SHORT = CompileTimeType<Short>()
|
||||
internal val INT = CompileTimeType<Int>()
|
||||
internal val LONG = CompileTimeType<Long>()
|
||||
internal val DOUBLE = CompileTimeType<Double>()
|
||||
internal val FLOAT = CompileTimeType<Float>()
|
||||
internal val CHAR = CompileTimeType<Char>()
|
||||
internal val BOOLEAN = CompileTimeType<Boolean>()
|
||||
internal val STRING = CompileTimeType<String>()
|
||||
internal val ANY = CompileTimeType<Any>()
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <A, B> binaryOperation(
|
||||
internal fun <A, B> binaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
b: CompileTimeType<B>,
|
||||
functionName: String,
|
||||
@@ -860,12 +860,12 @@ private fun <A, B> binaryOperation(
|
||||
) = BinaryOperationKey(a, b, functionName) to Pair(operation, checker) as Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun <A> unaryOperation(
|
||||
internal fun <A> unaryOperation(
|
||||
a: CompileTimeType<A>,
|
||||
functionName: String,
|
||||
operation: Function1<A, Any>,
|
||||
checker: Function1<Long, Long>
|
||||
) = UnaryOperationKey(a, functionName) to Pair(operation, checker) as Pair<Function1<Any?, Any>, Function1<Long, Long>>
|
||||
|
||||
private data class BinaryOperationKey<A, B>(val f: CompileTimeType<out A>, val s: CompileTimeType<out B>, val functionName: String)
|
||||
private data class UnaryOperationKey<A>(val f: CompileTimeType<out A>, val functionName: String)
|
||||
internal data class BinaryOperationKey<A, B>(val f: CompileTimeType<out A>, val s: CompileTimeType<out B>, val functionName: String)
|
||||
internal data class UnaryOperationKey<A>(val f: CompileTimeType<out A>, val functionName: String)
|
||||
|
||||
+5
-5
@@ -17,14 +17,14 @@
|
||||
package org.jetbrains.kotlin.resolve.constants.evaluate
|
||||
|
||||
import java.math.BigInteger
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
|
||||
/** This file is generated by org.jetbrains.kotlin.generators.evaluate:generate(). DO NOT MODIFY MANUALLY */
|
||||
|
||||
private val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { a, b -> BigInteger("0") }
|
||||
private val emptyUnaryFun: Function1<Long, Long> = { a -> 1.toLong() }
|
||||
internal val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { a, b -> BigInteger("0") }
|
||||
internal val emptyUnaryFun: Function1<Long, Long> = { a -> 1.toLong() }
|
||||
|
||||
private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>
|
||||
internal val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>
|
||||
= hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(
|
||||
unaryOperation(BOOLEAN, "not", { a -> a.not() }, emptyUnaryFun),
|
||||
unaryOperation(BOOLEAN, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||
@@ -102,7 +102,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
unaryOperation(STRING, "toString", { a -> a.toString() }, emptyUnaryFun)
|
||||
)
|
||||
|
||||
private val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>>
|
||||
internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>>
|
||||
= hashMapOf<BinaryOperationKey<*, *>, Pair<Function2<Any?, Any?, Any>, Function2<BigInteger, BigInteger, BigInteger>>>(
|
||||
binaryOperation(BOOLEAN, BOOLEAN, "and", { a, b -> a.and(b) }, emptyBinaryFun),
|
||||
binaryOperation(BOOLEAN, BOOLEAN, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
|
||||
+3
-4
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.load.java.structure.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.resolve.jvm.PLATFORM_TYPES
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.Variance.INVARIANT
|
||||
import org.jetbrains.kotlin.types.Variance.IN_VARIANCE
|
||||
@@ -44,7 +43,7 @@ import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.createProjection
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceAnnotations
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.util.HashSet
|
||||
import java.util.*
|
||||
|
||||
private val JAVA_LANG_CLASS_FQ_NAME: FqName = FqName("java.lang.Class")
|
||||
|
||||
@@ -337,7 +336,7 @@ class LazyJavaTypeResolver(
|
||||
|
||||
}
|
||||
|
||||
private fun makeStarProjection(
|
||||
internal fun makeStarProjection(
|
||||
typeParameter: TypeParameterDescriptor,
|
||||
attr: JavaTypeAttributes
|
||||
): TypeProjection {
|
||||
@@ -418,7 +417,7 @@ fun JavaTypeAttributes.toFlexible(flexibility: JavaTypeFlexibility) =
|
||||
// ErasedUpperBound(T : G<t>) = G<*> // UpperBound(T) is a type G<t> with arguments
|
||||
// ErasedUpperBound(T : A) = A // UpperBound(T) is a type A without arguments
|
||||
// ErasedUpperBound(T : F) = UpperBound(F) // UB(T) is another type parameter F
|
||||
private fun TypeParameterDescriptor.getErasedUpperBound(
|
||||
internal fun TypeParameterDescriptor.getErasedUpperBound(
|
||||
// Calculation of `potentiallyRecursiveTypeParameter.upperBounds` may recursively depend on `this.getErasedUpperBound`
|
||||
// E.g. `class A<T extends A, F extends A>`
|
||||
// To prevent recursive calls return defaultValue() instead
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public object RawTypeCapabilities : TypeCapabilities {
|
||||
}
|
||||
}
|
||||
|
||||
private object RawSubstitution : TypeSubstitution() {
|
||||
internal object RawSubstitution : TypeSubstitution() {
|
||||
override fun get(key: JetType) = TypeProjectionImpl(eraseType(key))
|
||||
|
||||
private val lowerTypeAttr = TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes().toFlexible(JavaTypeFlexibility.FLEXIBLE_LOWER_BOUND)
|
||||
|
||||
@@ -68,10 +68,10 @@ fun generate(): String {
|
||||
}
|
||||
}
|
||||
|
||||
p.println("private val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { a, b -> BigInteger(\"0\") }")
|
||||
p.println("private val emptyUnaryFun: Function1<Long, Long> = { a -> 1.toLong() }")
|
||||
p.println("internal val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { a, b -> BigInteger(\"0\") }")
|
||||
p.println("internal val emptyUnaryFun: Function1<Long, Long> = { a -> 1.toLong() }")
|
||||
p.println()
|
||||
p.println("private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>")
|
||||
p.println("internal val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>")
|
||||
p.println(" = hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(")
|
||||
p.pushIndent()
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.intellij.psi.util.CachedValuesManager
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
import java.util.LinkedHashSet
|
||||
import java.util.*
|
||||
|
||||
public val LIBRARY_NAME_PREFIX: String = "library "
|
||||
|
||||
@@ -111,7 +111,7 @@ public data class ModuleTestSourceInfo(override val module: Module) : ModuleSour
|
||||
})
|
||||
}
|
||||
|
||||
private fun ModuleSourceInfo.isTests() = this is ModuleTestSourceInfo
|
||||
internal fun ModuleSourceInfo.isTests() = this is ModuleTestSourceInfo
|
||||
|
||||
public fun Module.productionSourceInfo(): ModuleProductionSourceInfo = ModuleProductionSourceInfo(this)
|
||||
public fun Module.testSourceInfo(): ModuleTestSourceInfo = ModuleTestSourceInfo(this)
|
||||
@@ -160,7 +160,7 @@ public data class LibraryInfo(val project: Project, val library: Library) : Idea
|
||||
override fun toString() = "LibraryInfo(libraryName=${library.getName()})"
|
||||
}
|
||||
|
||||
private data class LibrarySourceInfo(val project: Project, val library: Library) : IdeaModuleInfo() {
|
||||
internal data class LibrarySourceInfo(val project: Project, val library: Library) : IdeaModuleInfo() {
|
||||
override val name: Name = Name.special("<sources for library ${library.getName()}>")
|
||||
|
||||
override fun contentScope() = GlobalSearchScope.EMPTY_SCOPE
|
||||
@@ -184,7 +184,7 @@ public data class SdkInfo(val project: Project, val sdk: Sdk) : IdeaModuleInfo()
|
||||
override fun dependencies(): List<IdeaModuleInfo> = listOf(this)
|
||||
}
|
||||
|
||||
private object NotUnderContentRootModuleInfo : IdeaModuleInfo() {
|
||||
internal object NotUnderContentRootModuleInfo : IdeaModuleInfo() {
|
||||
override val name: Name = Name.special("<special module for files not under source root>")
|
||||
|
||||
override fun contentScope() = GlobalSearchScope.EMPTY_SCOPE
|
||||
@@ -201,4 +201,4 @@ private data class LibraryWithoutSourceScope(project: Project, private val libra
|
||||
private data class SdkScope(project: Project, private val sdk: Sdk) :
|
||||
LibraryScopeBase(project, sdk.getRootProvider().getFiles(OrderRootType.CLASSES), arrayOf<VirtualFile>())
|
||||
|
||||
private fun IdeaModuleInfo.isLibraryClasses() = this is SdkInfo || this is LibraryInfo
|
||||
internal fun IdeaModuleInfo.isLibraryClasses() = this is SdkInfo || this is LibraryInfo
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
|
||||
private val LOG = Logger.getInstance(javaClass<KotlinCacheService>())
|
||||
internal val LOG = Logger.getInstance(javaClass<KotlinCacheService>())
|
||||
|
||||
public class KotlinCacheService(val project: Project) {
|
||||
companion object {
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
|
||||
private class PerFileAnalysisCache(val file: JetFile, val componentProvider: ComponentProvider) {
|
||||
internal class PerFileAnalysisCache(val file: JetFile, val componentProvider: ComponentProvider) {
|
||||
private val cache = HashMap<PsiElement, AnalysisResult>()
|
||||
|
||||
private fun lookUp(analyzableElement: JetElement): AnalysisResult? {
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.resolve.CompositeBindingContext
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
|
||||
|
||||
private class ProjectResolutionFacade(
|
||||
internal class ProjectResolutionFacade(
|
||||
val project: Project,
|
||||
computeModuleResolverProvider: () -> CachedValueProvider.Result<ModuleResolverProvider>
|
||||
) {
|
||||
@@ -85,7 +85,7 @@ private class ProjectResolutionFacade(
|
||||
}
|
||||
}
|
||||
|
||||
private class ResolutionFacadeImpl(
|
||||
internal class ResolutionFacadeImpl(
|
||||
private val projectFacade: ProjectResolutionFacade,
|
||||
private val moduleInfo: IdeaModuleInfo
|
||||
) : ResolutionFacade {
|
||||
@@ -128,4 +128,4 @@ private class ResolutionFacadeImpl(
|
||||
return projectFacade.resolverForDescriptor(moduleDescriptor).componentProvider.getService(serviceClass)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ class ClsStubBuilderContext(
|
||||
val typeParameters: TypeParameters
|
||||
)
|
||||
|
||||
private fun ClsStubBuilderContext.child(typeParameterList: List<ProtoBuf.TypeParameter>, name: Name? = null): ClsStubBuilderContext {
|
||||
internal fun ClsStubBuilderContext.child(typeParameterList: List<ProtoBuf.TypeParameter>, name: Name? = null): ClsStubBuilderContext {
|
||||
return ClsStubBuilderContext(
|
||||
this.components,
|
||||
this.nameResolver,
|
||||
|
||||
+2
-2
@@ -21,11 +21,11 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScopeImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.types.ErrorUtils.createErrorType
|
||||
import org.jetbrains.kotlin.types.TypeProjection
|
||||
import org.jetbrains.kotlin.types.TypeSubstitution
|
||||
@@ -54,7 +54,7 @@ private class ScopeWithMissingDependencies(val fqName: FqName, val containing: D
|
||||
}
|
||||
}
|
||||
|
||||
private class PackageFragmentProviderForMissingDependencies(val moduleDescriptor: ModuleDescriptor) : PackageFragmentProvider {
|
||||
internal class PackageFragmentProviderForMissingDependencies(val moduleDescriptor: ModuleDescriptor) : PackageFragmentProvider {
|
||||
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
|
||||
return listOf(PackageFragmentWithMissingDependencies(fqName, moduleDescriptor))
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ import org.jetbrains.org.objectweb.asm.Opcodes.ASM5
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
import java.util.*
|
||||
|
||||
private val RECEIVER_NAME = "\$receiver"
|
||||
private val THIS_NAME = "this"
|
||||
internal val RECEIVER_NAME = "\$receiver"
|
||||
internal val THIS_NAME = "this"
|
||||
|
||||
object KotlinEvaluationBuilder: EvaluatorBuilder {
|
||||
override fun build(codeFragment: PsiElement, position: SourcePosition?): ExpressionEvaluator {
|
||||
@@ -535,4 +535,4 @@ fun Type.getClassDescriptor(project: Project): ClassDescriptor? {
|
||||
classes.first().getJavaClassDescriptor()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.JetClass
|
||||
import org.jetbrains.kotlin.psi.JetFunction
|
||||
import org.jetbrains.kotlin.psi.JetNamedFunction
|
||||
import org.jetbrains.kotlin.psi.JetSecondaryConstructor
|
||||
import java.util.HashSet
|
||||
import java.util.*
|
||||
|
||||
fun collectContainingClasses(methods: Collection<PsiMethod>): Set<PsiClass> {
|
||||
val classes = HashSet<PsiClass>()
|
||||
@@ -41,7 +41,7 @@ fun collectContainingClasses(methods: Collection<PsiMethod>): Set<PsiClass> {
|
||||
return classes
|
||||
}
|
||||
|
||||
private fun getPsiClass(element: PsiElement?): PsiClass? {
|
||||
internal fun getPsiClass(element: PsiElement?): PsiClass? {
|
||||
return when {
|
||||
element == null -> null
|
||||
element is PsiClass -> element
|
||||
@@ -51,7 +51,7 @@ private fun getPsiClass(element: PsiElement?): PsiClass? {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPsiMethod(element: PsiElement?): PsiMethod? {
|
||||
internal fun getPsiMethod(element: PsiElement?): PsiMethod? {
|
||||
val parent = element?.getParent()
|
||||
return when {
|
||||
element == null -> null
|
||||
|
||||
@@ -16,34 +16,34 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.highlighter.markers
|
||||
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.search.PsiElementProcessor
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch
|
||||
import com.intellij.psi.PsiModifier
|
||||
import com.intellij.codeInsight.daemon.DaemonBundle
|
||||
import com.intellij.ide.util.MethodCellRenderer
|
||||
import com.intellij.codeInsight.daemon.impl.GutterIconTooltipHelper
|
||||
import java.awt.event.MouseEvent
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import javax.swing.JComponent
|
||||
import com.intellij.psi.util.PsiUtil
|
||||
import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator
|
||||
import com.intellij.codeInsight.navigation.ListBackgroundUpdaterTask
|
||||
import com.intellij.ide.util.MethodCellRenderer
|
||||
import com.intellij.ide.util.PsiElementListCellRenderer
|
||||
import com.intellij.openapi.progress.ProgressIndicator
|
||||
import com.intellij.util.CommonProcessors
|
||||
import com.intellij.psi.search.PsiElementProcessorAdapter
|
||||
import com.intellij.psi.PsiElement
|
||||
import gnu.trove.THashSet
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.search.searches.AllOverridingMethodsSearch
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.util.Pair
|
||||
import java.util.HashSet
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.PsiModifier
|
||||
import com.intellij.psi.search.PsiElementProcessor
|
||||
import com.intellij.psi.search.PsiElementProcessorAdapter
|
||||
import com.intellij.psi.search.searches.AllOverridingMethodsSearch
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch
|
||||
import com.intellij.psi.util.PsiUtil
|
||||
import com.intellij.util.CommonProcessors
|
||||
import com.intellij.util.Processor
|
||||
import gnu.trove.THashSet
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightMethodForTraitFakeOverride
|
||||
import java.awt.event.MouseEvent
|
||||
import java.util.*
|
||||
import javax.swing.JComponent
|
||||
|
||||
private fun <T> getOverriddenDeclarations(mappingToJava: MutableMap<PsiMethod, T>, classes: Set<PsiClass>): Set<T> {
|
||||
internal fun <T> getOverriddenDeclarations(mappingToJava: MutableMap<PsiMethod, T>, classes: Set<PsiClass>): Set<T> {
|
||||
val overridden = HashSet<T>()
|
||||
for (aClass in classes) {
|
||||
AllOverridingMethodsSearch.search(aClass)!!.forEach(object : Processor<Pair<PsiMethod, PsiMethod>> {
|
||||
|
||||
+1
-1
@@ -1069,7 +1069,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun JetNamedDeclaration.getReturnTypeReference(): JetTypeReference? {
|
||||
internal fun JetNamedDeclaration.getReturnTypeReference(): JetTypeReference? {
|
||||
return when (this) {
|
||||
is JetCallableDeclaration -> getTypeReference()
|
||||
is JetClassOrObject -> getDelegationSpecifiers().firstOrNull()?.getTypeReference()
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@ import java.util.LinkedHashSet
|
||||
/**
|
||||
* Special <code>Expression</code> for parameter names based on its type.
|
||||
*/
|
||||
private class ParameterNameExpression(
|
||||
internal class ParameterNameExpression(
|
||||
private val names: Array<String>,
|
||||
private val parameterTypeToNamesMap: Map<String, Array<String>>) : Expression() {
|
||||
init {
|
||||
@@ -102,7 +102,7 @@ private class ParameterNameExpression(
|
||||
/**
|
||||
* An <code>Expression</code> for type references and delegation specifiers.
|
||||
*/
|
||||
private abstract class TypeExpression(public val typeCandidates: List<TypeCandidate>) : Expression() {
|
||||
internal abstract class TypeExpression(public val typeCandidates: List<TypeCandidate>) : Expression() {
|
||||
class ForTypeReference(typeCandidates: List<TypeCandidate>) : TypeExpression(typeCandidates) {
|
||||
override val cachedLookupElements: Array<LookupElement> =
|
||||
typeCandidates.map { LookupElementBuilder.create(it, it.renderedType!!) }.toTypedArray()
|
||||
@@ -132,7 +132,7 @@ private abstract class TypeExpression(public val typeCandidates: List<TypeCandid
|
||||
/**
|
||||
* A sort-of dummy <code>Expression</code> for parameter lists, to allow us to update the parameter list as the user makes selections.
|
||||
*/
|
||||
private class TypeParameterListExpression(private val mandatoryTypeParameters: List<RenderedTypeParameter>,
|
||||
internal class TypeParameterListExpression(private val mandatoryTypeParameters: List<RenderedTypeParameter>,
|
||||
private val parameterTypeToTypeParameterNamesMap: Map<String, List<RenderedTypeParameter>>,
|
||||
insertLeadingSpace: Boolean) : Expression() {
|
||||
private val prefix = if (insertLeadingSpace) " <" else "<"
|
||||
@@ -185,7 +185,7 @@ private class TypeParameterListExpression(private val mandatoryTypeParameters: L
|
||||
override fun calculateLookupItems(context: ExpressionContext?) = arrayOf<LookupElement>()
|
||||
}
|
||||
|
||||
private object ValVarExpression: Expression() {
|
||||
internal object ValVarExpression: Expression() {
|
||||
private val cachedLookupElements = listOf("val", "var").map { LookupElementBuilder.create(it) }.toTypedArray<LookupElement>()
|
||||
|
||||
override fun calculateResult(context: ExpressionContext?): Result? = TextResult("val")
|
||||
|
||||
+6
-6
@@ -40,7 +40,7 @@ import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
|
||||
import java.util.*
|
||||
|
||||
private fun JetType.contains(inner: JetType): Boolean {
|
||||
internal fun JetType.contains(inner: JetType): Boolean {
|
||||
return JetTypeChecker.DEFAULT.equalTypes(this, inner) || getArguments().any { inner in it.getType() }
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ private fun JetType.render(typeParameterNameMap: Map<TypeParameterDescriptor, St
|
||||
return "$typeString$typeArgumentString$nullifier"
|
||||
}
|
||||
|
||||
private fun JetType.renderShort(typeParameterNameMap: Map<TypeParameterDescriptor, String>) = render(typeParameterNameMap, false)
|
||||
private fun JetType.renderLong(typeParameterNameMap: Map<TypeParameterDescriptor, String>) = render(typeParameterNameMap, true)
|
||||
internal fun JetType.renderShort(typeParameterNameMap: Map<TypeParameterDescriptor, String>) = render(typeParameterNameMap, false)
|
||||
internal fun JetType.renderLong(typeParameterNameMap: Map<TypeParameterDescriptor, String>) = render(typeParameterNameMap, true)
|
||||
|
||||
private fun getTypeParameterNamesNotInScope(typeParameters: Collection<TypeParameterDescriptor>, scope: JetScope): List<TypeParameterDescriptor> {
|
||||
internal fun getTypeParameterNamesNotInScope(typeParameters: Collection<TypeParameterDescriptor>, scope: JetScope): List<TypeParameterDescriptor> {
|
||||
return typeParameters.filter { typeParameter ->
|
||||
val classifier = scope.getClassifier(typeParameter.name, NoLookupLocation.FROM_IDE)
|
||||
classifier == null || classifier != typeParameter
|
||||
@@ -215,9 +215,9 @@ private fun JetNamedDeclaration.guessType(context: BindingContext): Array<JetTyp
|
||||
/**
|
||||
* Encapsulates a single type substitution of a <code>JetType</code> by another <code>JetType</code>.
|
||||
*/
|
||||
private class JetTypeSubstitution(public val forType: JetType, public val byType: JetType)
|
||||
internal class JetTypeSubstitution(public val forType: JetType, public val byType: JetType)
|
||||
|
||||
private fun JetType.substitute(substitution: JetTypeSubstitution, variance: Variance): JetType {
|
||||
internal fun JetType.substitute(substitution: JetTypeSubstitution, variance: Variance): JetType {
|
||||
val nullable = isMarkedNullable()
|
||||
val currentType = makeNotNullable()
|
||||
|
||||
|
||||
+6
-6
@@ -43,11 +43,11 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind as ClassDescriptorKind
|
||||
|
||||
private fun String.checkClassName(): Boolean = isNotEmpty() && Character.isUpperCase(first())
|
||||
internal fun String.checkClassName(): Boolean = isNotEmpty() && Character.isUpperCase(first())
|
||||
|
||||
private fun String.checkPackageName(): Boolean = isNotEmpty() && Character.isLowerCase(first())
|
||||
|
||||
private fun getTargetParentByQualifier(
|
||||
internal fun getTargetParentByQualifier(
|
||||
file: JetFile,
|
||||
isQualified: Boolean,
|
||||
qualifierDescriptor: DeclarationDescriptor?): PsiElement? {
|
||||
@@ -68,7 +68,7 @@ private fun getTargetParentByQualifier(
|
||||
return if (targetParent.canRefactor()) return targetParent else null
|
||||
}
|
||||
|
||||
private fun getTargetParentByCall(call: Call, file: JetFile): PsiElement? {
|
||||
internal fun getTargetParentByCall(call: Call, file: JetFile): PsiElement? {
|
||||
val receiver = call.getExplicitReceiver()
|
||||
return when (receiver) {
|
||||
ReceiverValue.NO_RECEIVER -> getTargetParentByQualifier(file, false, null)
|
||||
@@ -77,12 +77,12 @@ private fun getTargetParentByCall(call: Call, file: JetFile): PsiElement? {
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInnerClassExpected(call: Call): Boolean {
|
||||
internal fun isInnerClassExpected(call: Call): Boolean {
|
||||
val receiver = call.getExplicitReceiver()
|
||||
return receiver != ReceiverValue.NO_RECEIVER && receiver !is Qualifier
|
||||
}
|
||||
|
||||
private fun JetExpression.getInheritableTypeInfo(
|
||||
internal fun JetExpression.getInheritableTypeInfo(
|
||||
context: BindingContext,
|
||||
moduleDescriptor: ModuleDescriptor,
|
||||
containingDeclaration: PsiElement): Pair<TypeInfo, (ClassKind) -> Boolean> {
|
||||
@@ -108,7 +108,7 @@ private fun JetExpression.getInheritableTypeInfo(
|
||||
}
|
||||
}
|
||||
|
||||
private fun JetSimpleNameExpression.getCreatePackageFixIfApplicable(targetParent: PsiElement): IntentionAction? {
|
||||
internal fun JetSimpleNameExpression.getCreatePackageFixIfApplicable(targetParent: PsiElement): IntentionAction? {
|
||||
val name = getReferencedName()
|
||||
if (!name.checkPackageName()) return null
|
||||
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ data class ExtractionData(
|
||||
// Hack:
|
||||
// we can't get first element offset through getStatement()/getChildren() since they skip comments and whitespaces
|
||||
// So we take offset of the left brace instead and increase it by 2 (which is length of "{\n" separating block start and its first element)
|
||||
private fun JetExpression.getBlockContentOffset(): Int {
|
||||
internal fun JetExpression.getBlockContentOffset(): Int {
|
||||
(this as? JetBlockExpression)?.getLBrace()?.let {
|
||||
return it.getTextRange()!!.getStartOffset() + 2
|
||||
}
|
||||
|
||||
+3
-3
@@ -89,7 +89,7 @@ import org.jetbrains.kotlin.utils.DFS.Neighbors
|
||||
import org.jetbrains.kotlin.utils.DFS.VisitedWithSet
|
||||
import java.util.*
|
||||
|
||||
private val DEFAULT_RETURN_TYPE = KotlinBuiltIns.getInstance().getUnitType()
|
||||
internal val DEFAULT_RETURN_TYPE = KotlinBuiltIns.getInstance().getUnitType()
|
||||
private val DEFAULT_PARAMETER_TYPE = KotlinBuiltIns.getInstance().getNullableAnyType()
|
||||
|
||||
private fun DeclarationDescriptor.renderForMessage(): String =
|
||||
@@ -104,7 +104,7 @@ private fun JetType.renderForMessage(): String = TYPE_RENDERER.renderType(this)
|
||||
private fun JetDeclaration.renderForMessage(bindingContext: BindingContext): String? =
|
||||
bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, this]?.renderForMessage()
|
||||
|
||||
private fun JetType.isDefault(): Boolean = KotlinBuiltIns.isUnit(this)
|
||||
internal fun JetType.isDefault(): Boolean = KotlinBuiltIns.isUnit(this)
|
||||
|
||||
private fun List<Instruction>.getModifiedVarDescriptors(bindingContext: BindingContext): Map<VariableDescriptor, List<JetExpression>> {
|
||||
val result = HashMap<VariableDescriptor, MutableList<JetExpression>>()
|
||||
@@ -968,7 +968,7 @@ private fun ExtractionData.suggestFunctionNames(returnType: JetType): List<Strin
|
||||
return functionNames.toList()
|
||||
}
|
||||
|
||||
private fun JetNamedDeclaration.getGeneratedBody() =
|
||||
internal fun JetNamedDeclaration.getGeneratedBody() =
|
||||
when (this) {
|
||||
is JetNamedFunction -> getBodyExpression()
|
||||
else -> {
|
||||
|
||||
@@ -83,7 +83,7 @@ fun DeclarationDescriptor.renderForConflicts(): String {
|
||||
}
|
||||
}
|
||||
|
||||
private fun KotlinPullUpData.getClashingMemberInTargetClass(memberDescriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
internal fun KotlinPullUpData.getClashingMemberInTargetClass(memberDescriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
|
||||
val memberInSuper = memberDescriptor.substitute(sourceToTargetClassSubstitutor) ?: return null
|
||||
return targetClassDescriptor.findCallableMemberBySignature(memberInSuper as CallableMemberDescriptor)
|
||||
}
|
||||
|
||||
+12
-12
@@ -16,22 +16,22 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.decompiler.stubBuilder
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetFileStubBuilder
|
||||
import org.jetbrains.kotlin.test.JetTestUtils
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
import com.google.common.io.Files
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.util.indexing.FileContentImpl
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.google.common.io.Files
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.junit.Assert
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.indexing.FileContentImpl
|
||||
import org.jetbrains.kotlin.idea.stubs.AbstractStubBuilderTest
|
||||
import java.util.LinkedHashSet
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetFileStubBuilder
|
||||
import org.jetbrains.kotlin.test.JetTestUtils
|
||||
import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
public abstract class AbstractClsStubBuilderTest : LightCodeInsightFixtureTestCase() {
|
||||
fun doTest(sourcePath: String) {
|
||||
@@ -64,7 +64,7 @@ public abstract class AbstractClsStubBuilderTest : LightCodeInsightFixtureTestCa
|
||||
}
|
||||
}
|
||||
|
||||
private fun StubElement<out PsiElement>.serializeToString(): String {
|
||||
internal fun StubElement<out PsiElement>.serializeToString(): String {
|
||||
return AbstractStubBuilderTest.serializeStubToString(this)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.google.dart.compiler.backend.js.ast.metadata
|
||||
|
||||
private class MetadataProperty<in T : HasMetadata, R>(val default: R) {
|
||||
internal class MetadataProperty<in T : HasMetadata, R>(val default: R) {
|
||||
fun get(thisRef: T, desc: PropertyMetadata): R {
|
||||
if (!thisRef.hasData(desc.name)) return default
|
||||
return thisRef.getData<R>(desc.name)
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.inline.clean
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.JsVisitorWithContextImpl
|
||||
import com.google.dart.compiler.backend.js.ast.JsNode
|
||||
import com.google.dart.compiler.backend.js.ast.JsContext
|
||||
import com.google.dart.compiler.backend.js.ast.JsNode
|
||||
import com.google.dart.compiler.backend.js.ast.JsVisitorWithContextImpl
|
||||
|
||||
private class NodeRemover<T>(val klass: Class<T>, val predicate: (T) -> Boolean): JsVisitorWithContextImpl() {
|
||||
internal class NodeRemover<T>(val klass: Class<T>, val predicate: (T) -> Boolean): JsVisitorWithContextImpl() {
|
||||
|
||||
override fun <T : JsNode> doTraverse(node: T, ctx: JsContext<*>) {
|
||||
if (klass.isInstance(node)) {
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.js.inline.clean
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.*
|
||||
import com.google.dart.compiler.backend.js.ast.JsNode
|
||||
import org.jetbrains.kotlin.js.inline.util.IdentitySet
|
||||
import java.util.*
|
||||
|
||||
import java.util.IdentityHashMap
|
||||
|
||||
private class ReferenceTracker<Reference, RemoveCandidate : JsNode> {
|
||||
internal class ReferenceTracker<Reference, RemoveCandidate : JsNode> {
|
||||
private val reachable = IdentityHashMap<Reference, Boolean>()
|
||||
private val removableCandidates = IdentityHashMap<Reference, RemoveCandidate>()
|
||||
private val referenceFromTo = IdentityHashMap<Reference, MutableSet<Reference>>()
|
||||
|
||||
@@ -70,11 +70,11 @@ public fun lazy<T>(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> =
|
||||
public fun lazy<T>(lock: Any?, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
|
||||
|
||||
|
||||
private fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<T> {
|
||||
internal fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<T> {
|
||||
return arrayOfNulls<Any>(size) as Array<T>
|
||||
}
|
||||
|
||||
private fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?): dynamic {
|
||||
internal fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?): dynamic {
|
||||
val result = source.slice(0, newSize)
|
||||
var index: Int = source.length
|
||||
if (newSize > index) {
|
||||
@@ -84,10 +84,10 @@ private fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?):
|
||||
return result
|
||||
}
|
||||
|
||||
private fun <T> arrayPlusCollection(array: dynamic, collection: Collection<T>): dynamic {
|
||||
internal fun <T> arrayPlusCollection(array: dynamic, collection: Collection<T>): dynamic {
|
||||
val result = array.slice(0)
|
||||
result.length += collection.size()
|
||||
var index: Int = array.length
|
||||
for (element in collection) result[index++] = element
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package kotlin
|
||||
|
||||
private class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||
internal class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||
@Volatile private var sequenceRef: Sequence<T>? = sequence
|
||||
//private val lock = Any()
|
||||
|
||||
@@ -26,4 +26,4 @@ private class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||
sequenceRef = null
|
||||
return sequence.iterator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ package kotlin
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.nio.charset.Charset
|
||||
import java.util.Arrays
|
||||
import kotlin.jvm.internal.Intrinsic
|
||||
|
||||
// Array "constructor"
|
||||
@@ -104,6 +103,6 @@ public inline fun <reified T> Collection<T>.toTypedArray(): Array<T> {
|
||||
public inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: arrayOf<T>()
|
||||
|
||||
/** Internal unsafe construction of array based on reference array type */
|
||||
private fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<out T> {
|
||||
internal fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<out T> {
|
||||
return java.lang.reflect.Array.newInstance(reference.javaClass.componentType, size) as Array<out T>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package kotlin
|
||||
import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
private object EmptyIterator : ListIterator<Nothing> {
|
||||
internal object EmptyIterator : ListIterator<Nothing> {
|
||||
override fun hasNext(): Boolean = false
|
||||
override fun hasPrevious(): Boolean = false
|
||||
override fun nextIndex(): Int = 0
|
||||
@@ -15,7 +15,7 @@ private object EmptyIterator : ListIterator<Nothing> {
|
||||
override fun previous(): Nothing = throw NoSuchElementException()
|
||||
}
|
||||
|
||||
private object EmptyList : List<Nothing>, Serializable {
|
||||
internal object EmptyList : List<Nothing>, Serializable {
|
||||
override fun equals(other: Any?): Boolean = other is List<*> && other.isEmpty()
|
||||
override fun hashCode(): Int = 1
|
||||
override fun toString(): String = "[]"
|
||||
@@ -125,7 +125,7 @@ public fun <T> Iterable<T>.collectionSizeOrDefault(default: Int): Int = if (this
|
||||
private fun <T> Collection<T>.safeToConvertToSet() = size() > 2 && this is ArrayList
|
||||
|
||||
/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */
|
||||
private fun <T> Iterable<T>.convertToSetForSetOperationWith(source: Iterable<T>): Collection<T> =
|
||||
internal fun <T> Iterable<T>.convertToSetForSetOperationWith(source: Iterable<T>): Collection<T> =
|
||||
when(this) {
|
||||
is Set -> this
|
||||
is Collection ->
|
||||
@@ -137,7 +137,7 @@ private fun <T> Iterable<T>.convertToSetForSetOperationWith(source: Iterable<T>)
|
||||
}
|
||||
|
||||
/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */
|
||||
private fun <T> Iterable<T>.convertToSetForSetOperation(): Collection<T> =
|
||||
internal fun <T> Iterable<T>.convertToSetForSetOperation(): Collection<T> =
|
||||
when(this) {
|
||||
is Set -> this
|
||||
is Collection -> if (this.safeToConvertToSet()) toHashSet() else this
|
||||
|
||||
@@ -79,7 +79,7 @@ public fun <K, V> linkedMapOf(vararg values: Pair<K, V>): LinkedHashMap<K, V> {
|
||||
|
||||
private val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1
|
||||
|
||||
private fun mapCapacity(expectedSize: Int): Int {
|
||||
internal fun mapCapacity(expectedSize: Int): Int {
|
||||
if (expectedSize < 3) {
|
||||
return expectedSize + 1
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public fun <T, R> Sequence<Pair<T, R>>.unzip(): Pair<List<T>, List<R>> {
|
||||
* @param sendWhen If `true`, values for which the predicate returns `true` are returned. Otherwise,
|
||||
* values for which the predicate returns `false` are returned
|
||||
*/
|
||||
private class FilteringSequence<T>(private val sequence: Sequence<T>,
|
||||
internal class FilteringSequence<T>(private val sequence: Sequence<T>,
|
||||
private val sendWhen: Boolean = true,
|
||||
private val predicate: (T) -> Boolean
|
||||
) : Sequence<T> {
|
||||
@@ -142,7 +142,7 @@ private class FilteringSequence<T>(private val sequence: Sequence<T>,
|
||||
* in the underlying [sequence].
|
||||
*/
|
||||
|
||||
private class TransformingSequence<T, R>
|
||||
internal class TransformingSequence<T, R>
|
||||
constructor(private val sequence: Sequence<T>, private val transformer: (T) -> R) : Sequence<R> {
|
||||
override fun iterator(): Iterator<R> = object : Iterator<R> {
|
||||
val iterator = sequence.iterator()
|
||||
@@ -161,7 +161,7 @@ constructor(private val sequence: Sequence<T>, private val transformer: (T) -> R
|
||||
* in the underlying [sequence], where the transformer function takes the index of the value in the underlying
|
||||
* sequence along with the value itself.
|
||||
*/
|
||||
private class TransformingIndexedSequence<T, R>
|
||||
internal class TransformingIndexedSequence<T, R>
|
||||
constructor(private val sequence: Sequence<T>, private val transformer: (Int, T) -> R) : Sequence<R> {
|
||||
override fun iterator(): Iterator<R> = object : Iterator<R> {
|
||||
val iterator = sequence.iterator()
|
||||
@@ -180,7 +180,7 @@ constructor(private val sequence: Sequence<T>, private val transformer: (Int, T)
|
||||
* A sequence which combines values from the underlying [sequence] with their indices and returns them as
|
||||
* [IndexedValue] objects.
|
||||
*/
|
||||
private class IndexingSequence<T>
|
||||
internal class IndexingSequence<T>
|
||||
constructor(private val sequence: Sequence<T>) : Sequence<IndexedValue<T>> {
|
||||
override fun iterator(): Iterator<IndexedValue<T>> = object : Iterator<IndexedValue<T>> {
|
||||
val iterator = sequence.iterator()
|
||||
@@ -200,7 +200,7 @@ constructor(private val sequence: Sequence<T>) : Sequence<IndexedValue<T>> {
|
||||
* [transform] function and returns the values returned by that function. The sequence stops returning
|
||||
* values as soon as one of the underlying sequences stops returning values.
|
||||
*/
|
||||
private class MergingSequence<T1, T2, V>
|
||||
internal class MergingSequence<T1, T2, V>
|
||||
constructor(private val sequence1: Sequence<T1>,
|
||||
private val sequence2: Sequence<T2>,
|
||||
private val transform: (T1, T2) -> V
|
||||
@@ -218,7 +218,7 @@ private class MergingSequence<T1, T2, V>
|
||||
}
|
||||
}
|
||||
|
||||
private class FlatteningSequence<T, R>
|
||||
internal class FlatteningSequence<T, R>
|
||||
constructor(private val sequence: Sequence<T>,
|
||||
private val transformer: (T) -> Sequence<R>
|
||||
) : Sequence<R> {
|
||||
@@ -257,7 +257,7 @@ private class FlatteningSequence<T, R>
|
||||
}
|
||||
}
|
||||
|
||||
private class MultiSequence<T>
|
||||
internal class MultiSequence<T>
|
||||
constructor(private val sequence: Sequence<Sequence<T>>) : Sequence<T> {
|
||||
override fun iterator(): Iterator<T> = object : Iterator<T> {
|
||||
val iterator = sequence.iterator()
|
||||
@@ -298,7 +298,7 @@ constructor(private val sequence: Sequence<Sequence<T>>) : Sequence<T> {
|
||||
* A sequence that returns at most [count] values from the underlying [sequence], and stops returning values
|
||||
* as soon as that count is reached.
|
||||
*/
|
||||
private class TakeSequence<T>
|
||||
internal class TakeSequence<T>
|
||||
constructor(private val sequence: Sequence<T>,
|
||||
private val count: Int
|
||||
) : Sequence<T> {
|
||||
@@ -327,7 +327,7 @@ private class TakeSequence<T>
|
||||
* A sequence that returns values from the underlying [sequence] while the [predicate] function returns
|
||||
* `true`, and stops returning values once the function returns `false` for the next element.
|
||||
*/
|
||||
private class TakeWhileSequence<T>
|
||||
internal class TakeWhileSequence<T>
|
||||
constructor(private val sequence: Sequence<T>,
|
||||
private val predicate: (T) -> Boolean
|
||||
) : Sequence<T> {
|
||||
@@ -373,7 +373,7 @@ private class TakeWhileSequence<T>
|
||||
* A sequence that skips the specified number of values from the underlying [sequence] and returns
|
||||
* all values after that.
|
||||
*/
|
||||
private class DropSequence<T>
|
||||
internal class DropSequence<T>
|
||||
constructor(private val sequence: Sequence<T>,
|
||||
private val count: Int
|
||||
) : Sequence<T> {
|
||||
@@ -409,7 +409,7 @@ private class DropSequence<T>
|
||||
* A sequence that skips the values from the underlying [sequence] while the given [predicate] returns `true` and returns
|
||||
* all values after that.
|
||||
*/
|
||||
private class DropWhileSequence<T>
|
||||
internal class DropWhileSequence<T>
|
||||
constructor(private val sequence: Sequence<T>,
|
||||
private val predicate: (T) -> Boolean
|
||||
) : Sequence<T> {
|
||||
@@ -452,7 +452,7 @@ private class DropWhileSequence<T>
|
||||
}
|
||||
}
|
||||
|
||||
private class DistinctSequence<T, K>(private val source : Sequence<T>, private val keySelector : (T) -> K) : Sequence<T> {
|
||||
internal class DistinctSequence<T, K>(private val source : Sequence<T>, private val keySelector : (T) -> K) : Sequence<T> {
|
||||
override fun iterator(): Iterator<T> = DistinctIterator(source.iterator(), keySelector)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package kotlin
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
|
||||
private class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||
internal class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||
private val sequenceRef = AtomicReference(sequence)
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serializable
|
||||
import java.util.*
|
||||
|
||||
|
||||
private object EmptySet : Set<Nothing>, Serializable {
|
||||
internal object EmptySet : Set<Nothing>, Serializable {
|
||||
override fun equals(other: Any?): Boolean = other is Set<*> && other.isEmpty()
|
||||
override fun hashCode(): Int = 0
|
||||
override fun toString(): String = "[]"
|
||||
@@ -59,4 +59,4 @@ public fun sortedSetOf<T>(vararg values: T): TreeSet<T> = values.toCollection(Tr
|
||||
* Returns a new [SortedSet] with the given [comparator] and elements.
|
||||
*/
|
||||
@JvmVersion
|
||||
public fun sortedSetOf<T>(comparator: Comparator<in T>, vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>(comparator))
|
||||
public fun sortedSetOf<T>(comparator: Comparator<in T>, vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>(comparator))
|
||||
|
||||
@@ -14,22 +14,22 @@ import kotlin.text.Regex
|
||||
/**
|
||||
* Returns the index within this string of the first occurrence of the specified character, starting from the specified offset.
|
||||
*/
|
||||
private fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).indexOf(ch.toInt(), fromIndex)
|
||||
internal fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).indexOf(ch.toInt(), fromIndex)
|
||||
|
||||
/**
|
||||
* Returns the index within this string of the first occurrence of the specified substring, starting from the specified offset.
|
||||
*/
|
||||
private fun String.nativeIndexOf(str: String, fromIndex: Int): Int = (this as java.lang.String).indexOf(str, fromIndex)
|
||||
internal fun String.nativeIndexOf(str: String, fromIndex: Int): Int = (this as java.lang.String).indexOf(str, fromIndex)
|
||||
|
||||
/**
|
||||
* Returns the index within this string of the last occurrence of the specified character.
|
||||
*/
|
||||
private fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(ch.toInt(), fromIndex)
|
||||
internal fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(ch.toInt(), fromIndex)
|
||||
|
||||
/**
|
||||
* Returns the index within this string of the last occurrence of the specified character, starting from the specified offset.
|
||||
*/
|
||||
private fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(str, fromIndex)
|
||||
internal fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(str, fromIndex)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ public enum class LazyThreadSafetyMode {
|
||||
|
||||
private object UNINITIALIZED_VALUE
|
||||
|
||||
private open class LazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializable {
|
||||
internal open class LazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializable {
|
||||
private var initializer: (() -> T)? = initializer
|
||||
@Volatile private var _value: Any? = UNINITIALIZED_VALUE
|
||||
protected open val lock: Any
|
||||
@@ -88,9 +88,9 @@ private open class LazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializab
|
||||
private fun writeReplace(): Any = InitializedLazyImpl(value)
|
||||
}
|
||||
|
||||
private class ExternallySynchronizedLazyImpl<out T>(override val lock: Any, initializer: () -> T): LazyImpl<T>(initializer)
|
||||
internal class ExternallySynchronizedLazyImpl<out T>(override val lock: Any, initializer: () -> T): LazyImpl<T>(initializer)
|
||||
|
||||
private class UnsafeLazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializable {
|
||||
internal class UnsafeLazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializable {
|
||||
private var initializer: (() -> T)? = initializer
|
||||
private var _value: Any? = UNINITIALIZED_VALUE
|
||||
|
||||
|
||||
@@ -32,6 +32,6 @@ public fun <T: Comparable<T>> T.rangeTo(that: T): ComparableRange<T> {
|
||||
}
|
||||
|
||||
|
||||
private fun checkStepIsPositive(isPositive: Boolean, step: Number) {
|
||||
internal fun checkStepIsPositive(isPositive: Boolean, step: Number) {
|
||||
if (!isPositive) throw IllegalArgumentException("Step must be positive, was: $step")
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import javax.lang.model.element.TypeElement
|
||||
import javax.lang.model.type.NoType
|
||||
import javax.lang.model.type.TypeVisitor
|
||||
|
||||
private class RoundEnvironmentWrapper(
|
||||
internal class RoundEnvironmentWrapper(
|
||||
val processingEnv: ProcessingEnvironment,
|
||||
val parent: RoundEnvironment,
|
||||
val roundNumber: Int,
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import org.gradle.api.logging.Logger
|
||||
import java.io.FileNotFoundException
|
||||
import java.util.*
|
||||
|
||||
private fun Any.loadKotlinVersionFromResource(log: Logger): String {
|
||||
internal fun Any.loadKotlinVersionFromResource(log: Logger): String {
|
||||
log.kotlinDebug("Loading version information")
|
||||
val props = Properties()
|
||||
val propFileName = "project.properties"
|
||||
@@ -35,4 +35,4 @@ private fun Any.loadKotlinVersionFromResource(log: Logger): String {
|
||||
val projectVersion = props["project.version"] as String
|
||||
log.kotlinDebug("Found project version [$projectVersion]")
|
||||
return projectVersion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user