Add missing public modifiers in project code
This commit is contained in:
@@ -20,10 +20,10 @@ import org.jetbrains.jet.utils.DFS
|
|||||||
import java.util.HashSet
|
import java.util.HashSet
|
||||||
|
|
||||||
public trait FunctionHandle {
|
public trait FunctionHandle {
|
||||||
val isDeclaration: Boolean
|
public val isDeclaration: Boolean
|
||||||
val isAbstract: Boolean
|
public val isAbstract: Boolean
|
||||||
|
|
||||||
fun getOverridden(): Iterable<FunctionHandle>
|
public fun getOverridden(): Iterable<FunctionHandle>
|
||||||
}
|
}
|
||||||
|
|
||||||
public data class Bridge<Signature>(
|
public data class Bridge<Signature>(
|
||||||
|
|||||||
+4
-4
@@ -28,7 +28,7 @@ import org.jetbrains.jet.lang.resolve.java.diagnostics.JvmDeclarationOriginKind.
|
|||||||
|
|
||||||
public enum class MemberKind { FIELD; METHOD }
|
public enum class MemberKind { FIELD; METHOD }
|
||||||
|
|
||||||
public data class RawSignature(val name: String, val desc: String, val kind: MemberKind)
|
public data class RawSignature(public val name: String, public val desc: String, public val kind: MemberKind)
|
||||||
|
|
||||||
public enum class JvmDeclarationOriginKind {
|
public enum class JvmDeclarationOriginKind {
|
||||||
OTHER
|
OTHER
|
||||||
@@ -39,9 +39,9 @@ public enum class JvmDeclarationOriginKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class JvmDeclarationOrigin(
|
public class JvmDeclarationOrigin(
|
||||||
val originKind: JvmDeclarationOriginKind,
|
public val originKind: JvmDeclarationOriginKind,
|
||||||
val element: PsiElement?,
|
public val element: PsiElement?,
|
||||||
val descriptor: DeclarationDescriptor?
|
public val descriptor: DeclarationDescriptor?
|
||||||
) {
|
) {
|
||||||
class object {
|
class object {
|
||||||
public val NO_ORIGIN: JvmDeclarationOrigin = JvmDeclarationOrigin(OTHER, null, null)
|
public val NO_ORIGIN: JvmDeclarationOrigin = JvmDeclarationOrigin(OTHER, null, null)
|
||||||
|
|||||||
+2
-2
@@ -20,6 +20,6 @@ import com.intellij.psi.PsiElement
|
|||||||
import org.jetbrains.jet.lang.psi.JetDeclaration
|
import org.jetbrains.jet.lang.psi.JetDeclaration
|
||||||
|
|
||||||
public trait KotlinLightElement<T: JetDeclaration, D: PsiElement> {
|
public trait KotlinLightElement<T: JetDeclaration, D: PsiElement> {
|
||||||
val origin: T?
|
public val origin: T?
|
||||||
val delegate: D
|
public val delegate: D
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@ package org.jetbrains.jet.lang.resolve.java.jvmSignature
|
|||||||
|
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor
|
||||||
|
|
||||||
trait KotlinToJvmSignatureMapper {
|
public trait KotlinToJvmSignatureMapper {
|
||||||
fun mapToJvmMethodSignature(function: FunctionDescriptor): JvmMethodSignature
|
public fun mapToJvmMethodSignature(function: FunctionDescriptor): JvmMethodSignature
|
||||||
}
|
}
|
||||||
|
|
||||||
fun erasedSignaturesEqualIgnoringReturnTypes(subFunction: JvmMethodSignature, superFunction: JvmMethodSignature): Boolean {
|
fun erasedSignaturesEqualIgnoringReturnTypes(subFunction: JvmMethodSignature, superFunction: JvmMethodSignature): Boolean {
|
||||||
|
|||||||
@@ -20,24 +20,24 @@ import org.jetbrains.jet.storage.StorageManager
|
|||||||
import org.jetbrains.jet.storage.ExceptionTracker
|
import org.jetbrains.jet.storage.ExceptionTracker
|
||||||
import org.jetbrains.jet.storage.LockBasedStorageManager
|
import org.jetbrains.jet.storage.LockBasedStorageManager
|
||||||
|
|
||||||
trait GlobalContext {
|
public trait GlobalContext {
|
||||||
val storageManager: StorageManager
|
public val storageManager: StorageManager
|
||||||
val exceptionTracker: ExceptionTracker
|
public val exceptionTracker: ExceptionTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
open class SimpleGlobalContext(
|
public open class SimpleGlobalContext(
|
||||||
override val storageManager: StorageManager,
|
override val storageManager: StorageManager,
|
||||||
override val exceptionTracker: ExceptionTracker
|
override val exceptionTracker: ExceptionTracker
|
||||||
) : GlobalContext
|
) : GlobalContext
|
||||||
|
|
||||||
open class GlobalContextImpl(
|
public open class GlobalContextImpl(
|
||||||
storageManager: LockBasedStorageManager,
|
storageManager: LockBasedStorageManager,
|
||||||
exceptionTracker: ExceptionTracker
|
exceptionTracker: ExceptionTracker
|
||||||
) : SimpleGlobalContext(storageManager, exceptionTracker) {
|
) : SimpleGlobalContext(storageManager, exceptionTracker) {
|
||||||
override val storageManager: LockBasedStorageManager = super.storageManager as LockBasedStorageManager
|
override val storageManager: LockBasedStorageManager = super.storageManager as LockBasedStorageManager
|
||||||
}
|
}
|
||||||
|
|
||||||
fun GlobalContext(): GlobalContextImpl {
|
public fun GlobalContext(): GlobalContextImpl {
|
||||||
val tracker = ExceptionTracker()
|
val tracker = ExceptionTracker()
|
||||||
return GlobalContextImpl(LockBasedStorageManager.createWithExceptionHandling(tracker), tracker)
|
return GlobalContextImpl(LockBasedStorageManager.createWithExceptionHandling(tracker), tracker)
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.cfg.pseudocode.instructions.special.LocalFunctionD
|
|||||||
import org.jetbrains.jet.lang.cfg.pseudocode.instructions.Instruction
|
import org.jetbrains.jet.lang.cfg.pseudocode.instructions.Instruction
|
||||||
import org.jetbrains.jet.lang.cfg.pseudocode.instructions.special.SubroutineEnterInstruction
|
import org.jetbrains.jet.lang.cfg.pseudocode.instructions.special.SubroutineEnterInstruction
|
||||||
|
|
||||||
fun Pseudocode.traverse(
|
public fun Pseudocode.traverse(
|
||||||
traversalOrder: TraversalOrder,
|
traversalOrder: TraversalOrder,
|
||||||
analyzeInstruction: (Instruction) -> Unit
|
analyzeInstruction: (Instruction) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -37,7 +37,7 @@ fun Pseudocode.traverse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <D> Pseudocode.traverse(
|
public fun <D> Pseudocode.traverse(
|
||||||
traversalOrder: TraversalOrder,
|
traversalOrder: TraversalOrder,
|
||||||
edgesMap: Map<Instruction, Edges<D>>,
|
edgesMap: Map<Instruction, Edges<D>>,
|
||||||
analyzeInstruction: (Instruction, D, D) -> Unit
|
analyzeInstruction: (Instruction, D, D) -> Unit
|
||||||
@@ -189,7 +189,7 @@ fun traverseFollowingInstructions(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class TraversalOrder {
|
public enum class TraversalOrder {
|
||||||
FORWARD
|
FORWARD
|
||||||
BACKWARD
|
BACKWARD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ public object AllTypes : TypePredicate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo: simplify computed type predicate when possible
|
// todo: simplify computed type predicate when possible
|
||||||
fun and(predicates: Collection<TypePredicate>): TypePredicate =
|
public fun and(predicates: Collection<TypePredicate>): TypePredicate =
|
||||||
when (predicates.size) {
|
when (predicates.size) {
|
||||||
0 -> AllTypes
|
0 -> AllTypes
|
||||||
1 -> predicates.first()
|
1 -> predicates.first()
|
||||||
else -> ForAllTypes(predicates.toList())
|
else -> ForAllTypes(predicates.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun or(predicates: Collection<TypePredicate>): TypePredicate? =
|
public fun or(predicates: Collection<TypePredicate>): TypePredicate? =
|
||||||
when (predicates.size) {
|
when (predicates.size) {
|
||||||
0 -> null
|
0 -> null
|
||||||
1 -> predicates.first()
|
1 -> predicates.first()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ fun getReceiverTypePredicate(resolvedCall: ResolvedCall<*>, receiverValue: Recei
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getExpectedTypePredicate(value: PseudoValue, bindingContext: BindingContext): TypePredicate {
|
public fun getExpectedTypePredicate(value: PseudoValue, bindingContext: BindingContext): TypePredicate {
|
||||||
val pseudocode = value.createdAt?.owner
|
val pseudocode = value.createdAt?.owner
|
||||||
if (pseudocode == null) return AllTypes
|
if (pseudocode == null) return AllTypes
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public abstract class JetCodeFragment(
|
|||||||
_myImports.addAll(imports.split(IMPORT_SEPARATOR))
|
_myImports.addAll(imports.split(IMPORT_SEPARATOR))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun importsAsImportList(): JetImportList? {
|
public fun importsAsImportList(): JetImportList? {
|
||||||
return JetPsiFactory(this).createFile(_myImports.makeString("\n")).getImportList()
|
return JetPsiFactory(this).createFile(_myImports.makeString("\n")).getImportList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ public abstract class JetCodeFragment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
class object {
|
class object {
|
||||||
val IMPORT_SEPARATOR = ","
|
public val IMPORT_SEPARATOR: String = ","
|
||||||
|
|
||||||
fun getImportsForElement(elementAtCaret: PsiElement): String {
|
public fun getImportsForElement(elementAtCaret: PsiElement): String {
|
||||||
val containingFile = elementAtCaret.getContainingFile()
|
val containingFile = elementAtCaret.getContainingFile()
|
||||||
if (containingFile !is JetFile) return ""
|
if (containingFile !is JetFile) return ""
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap
|
|||||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic
|
import org.jetbrains.jet.lang.diagnostics.Diagnostic
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
|
||||||
class CompositeBindingContext private (
|
public class CompositeBindingContext private (
|
||||||
private val delegates: List<BindingContext>
|
private val delegates: List<BindingContext>
|
||||||
) : BindingContext {
|
) : BindingContext {
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ import org.jetbrains.jet.lang.diagnostics.Diagnostic
|
|||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
|
|
||||||
public trait Diagnostics : Iterable<Diagnostic> {
|
public trait Diagnostics : Iterable<Diagnostic> {
|
||||||
fun all(): Collection<Diagnostic>
|
public fun all(): Collection<Diagnostic>
|
||||||
|
|
||||||
fun forElement(psiElement: PsiElement): Collection<Diagnostic>
|
public fun forElement(psiElement: PsiElement): Collection<Diagnostic>
|
||||||
|
|
||||||
fun isEmpty(): Boolean
|
public fun isEmpty(): Boolean
|
||||||
|
|
||||||
fun noSuppression(): Diagnostics
|
public fun noSuppression(): Diagnostics
|
||||||
|
|
||||||
class object {
|
class object {
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ package org.jetbrains.jet.lang.resolve.calls.model
|
|||||||
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor
|
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor
|
||||||
|
|
||||||
trait ArgumentMapping {
|
public trait ArgumentMapping {
|
||||||
fun isError(): Boolean
|
public fun isError(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
object ArgumentUnmapped: ArgumentMapping {
|
public object ArgumentUnmapped: ArgumentMapping {
|
||||||
override fun isError(): Boolean = true
|
override fun isError(): Boolean = true
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ArgumentMatchStatus(val isError: Boolean = true) {
|
public enum class ArgumentMatchStatus(val isError: Boolean = true) {
|
||||||
SUCCESS : ArgumentMatchStatus(false)
|
SUCCESS : ArgumentMatchStatus(false)
|
||||||
TYPE_MISMATCH : ArgumentMatchStatus()
|
TYPE_MISMATCH : ArgumentMatchStatus()
|
||||||
ARGUMENT_HAS_NO_TYPE : ArgumentMatchStatus()
|
ARGUMENT_HAS_NO_TYPE : ArgumentMatchStatus()
|
||||||
@@ -36,9 +36,9 @@ enum class ArgumentMatchStatus(val isError: Boolean = true) {
|
|||||||
MATCH_MODULO_UNINFERRED_TYPES : ArgumentMatchStatus()
|
MATCH_MODULO_UNINFERRED_TYPES : ArgumentMatchStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ArgumentMatch : ArgumentMapping {
|
public trait ArgumentMatch : ArgumentMapping {
|
||||||
val valueParameter: ValueParameterDescriptor
|
public val valueParameter: ValueParameterDescriptor
|
||||||
val status: ArgumentMatchStatus
|
public val status: ArgumentMatchStatus
|
||||||
|
|
||||||
override fun isError(): Boolean = status.isError
|
override fun isError(): Boolean = status.isError
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import org.jetbrains.jet.lang.psi.JetCallableDeclaration
|
|||||||
import org.jetbrains.jet.lang.psi.psiUtil.isExtensionDeclaration
|
import org.jetbrains.jet.lang.psi.psiUtil.isExtensionDeclaration
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
|
|
||||||
fun JetClassOrObject.toLightClass(): KotlinLightClass? = LightClassUtil.getPsiClass(this) as KotlinLightClass?
|
public fun JetClassOrObject.toLightClass(): KotlinLightClass? = LightClassUtil.getPsiClass(this) as KotlinLightClass?
|
||||||
|
|
||||||
public fun JetDeclaration.toLightElements(): List<PsiNamedElement> =
|
public fun JetDeclaration.toLightElements(): List<PsiNamedElement> =
|
||||||
when (this) {
|
when (this) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.evaluate.ConstantExpressionEvaluator
|
|||||||
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace
|
import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace
|
||||||
import org.jetbrains.jet.lang.types.TypeUtils
|
import org.jetbrains.jet.lang.types.TypeUtils
|
||||||
|
|
||||||
abstract class AbstractEvaluateExpressionTest : AbstractAnnotationDescriptorResolveTest() {
|
public abstract class AbstractEvaluateExpressionTest : AbstractAnnotationDescriptorResolveTest() {
|
||||||
|
|
||||||
// Test directives should look like [// val testedPropertyName: expectedValue]
|
// Test directives should look like [// val testedPropertyName: expectedValue]
|
||||||
fun doConstantTest(path: String) {
|
fun doConstantTest(path: String) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package org.jetbrains.jet
|
|||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
|
|
||||||
fun JsonObject.getString(name: String): String {
|
public fun JsonObject.getString(name: String): String {
|
||||||
val member = getNullableString(name)
|
val member = getNullableString(name)
|
||||||
if (member == null) {
|
if (member == null) {
|
||||||
throw IllegalStateException("Member with name '$name' is expected in '$this'")
|
throw IllegalStateException("Member with name '$name' is expected in '$this'")
|
||||||
@@ -27,4 +27,4 @@ fun JsonObject.getString(name: String): String {
|
|||||||
return member
|
return member
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JsonObject.getNullableString(name: String): String? = this[name]?.getAsString()
|
public fun JsonObject.getNullableString(name: String): String? = this[name]?.getAsString()
|
||||||
@@ -20,7 +20,7 @@ import java.util.HashMap
|
|||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
|
|
||||||
deprecated("Replace with filterKeys when bootstrapped")
|
deprecated("Replace with filterKeys when bootstrapped")
|
||||||
fun <K, V> Map<K, V>.filterKeys_tmp(predicate: (K)->Boolean): Map<K, V> {
|
public fun <K, V> Map<K, V>.filterKeys_tmp(predicate: (K)->Boolean): Map<K, V> {
|
||||||
val result = HashMap<K, V>()
|
val result = HashMap<K, V>()
|
||||||
for ((k, v) in this) {
|
for ((k, v) in this) {
|
||||||
if (predicate(k)) {
|
if (predicate(k)) {
|
||||||
@@ -30,6 +30,6 @@ fun <K, V> Map<K, V>.filterKeys_tmp(predicate: (K)->Boolean): Map<K, V> {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T: Any> T?.singletonOrEmptyList(): List<T> = if (this != null) Collections.singletonList(this) else Collections.emptyList()
|
public fun <T: Any> T?.singletonOrEmptyList(): List<T> = if (this != null) Collections.singletonList(this) else Collections.emptyList()
|
||||||
|
|
||||||
fun <T: Any> T?.singletonOrEmptySet(): Set<T> = if (this != null) Collections.singleton(this) else Collections.emptySet()
|
public fun <T: Any> T?.singletonOrEmptySet(): Set<T> = if (this != null) Collections.singleton(this) else Collections.emptySet()
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ class LazyPackageFragmentForJavaPackage(
|
|||||||
override fun createMemberScope() = LazyPackageFragmentScopeForJavaPackage(c, jPackage, this)
|
override fun createMemberScope() = LazyPackageFragmentScopeForJavaPackage(c, jPackage, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
class LazyPackageFragmentForJavaClass(
|
public class LazyPackageFragmentForJavaClass(
|
||||||
c: LazyJavaResolverContext,
|
c: LazyJavaResolverContext,
|
||||||
containingDeclaration: ModuleDescriptor,
|
containingDeclaration: ModuleDescriptor,
|
||||||
private val jClass: JavaClass
|
private val jClass: JavaClass
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ public trait PackageFragmentDescriptor : ClassOrPackageFragmentDescriptor {
|
|||||||
|
|
||||||
override fun getContainingDeclaration(): ModuleDescriptor
|
override fun getContainingDeclaration(): ModuleDescriptor
|
||||||
|
|
||||||
val fqName: FqName
|
public val fqName: FqName
|
||||||
|
|
||||||
fun getMemberScope(): JetScope
|
public fun getMemberScope(): JetScope
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import java.util.Collections
|
|||||||
|
|
||||||
public trait Annotations : Iterable<AnnotationDescriptor> {
|
public trait Annotations : Iterable<AnnotationDescriptor> {
|
||||||
|
|
||||||
fun isEmpty(): Boolean
|
public fun isEmpty(): Boolean
|
||||||
|
|
||||||
fun findAnnotation(fqName: FqName): AnnotationDescriptor?
|
public fun findAnnotation(fqName: FqName): AnnotationDescriptor?
|
||||||
|
|
||||||
class object {
|
class object {
|
||||||
val EMPTY: Annotations = object : Annotations {
|
public val EMPTY: Annotations = object : Annotations {
|
||||||
override fun isEmpty() = true
|
override fun isEmpty() = true
|
||||||
|
|
||||||
override fun findAnnotation(fqName: FqName) = null
|
override fun findAnnotation(fqName: FqName) = null
|
||||||
|
|||||||
+1
-1
@@ -20,5 +20,5 @@ import org.jetbrains.jet.lang.resolve.name.FqName
|
|||||||
|
|
||||||
// marker for DescriptorRenderer to treat specially in decompiler mode
|
// marker for DescriptorRenderer to treat specially in decompiler mode
|
||||||
public trait MissingDependencyErrorClass {
|
public trait MissingDependencyErrorClass {
|
||||||
val fullFqName: FqName
|
public val fullFqName: FqName
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,13 @@ public trait StorageManager {
|
|||||||
* NOTE: if compute() has side-effects the WEAK reference kind is dangerous: the side-effects will be repeated if
|
* NOTE: if compute() has side-effects the WEAK reference kind is dangerous: the side-effects will be repeated if
|
||||||
* the value gets collected and then re-computed
|
* the value gets collected and then re-computed
|
||||||
*/
|
*/
|
||||||
fun createMemoizedFunction<K, V: Any>(compute: (K) -> V): MemoizedFunctionToNotNull<K, V>
|
public fun createMemoizedFunction<K, V: Any>(compute: (K) -> V): MemoizedFunctionToNotNull<K, V>
|
||||||
|
|
||||||
fun createMemoizedFunctionWithNullableValues<K, V: Any>(compute: (K) -> V?): MemoizedFunctionToNullable<K, V>
|
public fun createMemoizedFunctionWithNullableValues<K, V: Any>(compute: (K) -> V?): MemoizedFunctionToNullable<K, V>
|
||||||
|
|
||||||
fun createLazyValue<T: Any>(computable: () -> T): NotNullLazyValue<T>
|
public fun createLazyValue<T: Any>(computable: () -> T): NotNullLazyValue<T>
|
||||||
|
|
||||||
fun createRecursionTolerantLazyValue<T: Any>(computable: () -> T, onRecursiveCall: T): NotNullLazyValue<T>
|
public fun createRecursionTolerantLazyValue<T: Any>(computable: () -> T, onRecursiveCall: T): NotNullLazyValue<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param onRecursiveCall is called if the computation calls itself recursively.
|
* @param onRecursiveCall is called if the computation calls itself recursively.
|
||||||
@@ -41,17 +41,17 @@ public trait StorageManager {
|
|||||||
* otherwise it's executed and its result is returned
|
* otherwise it's executed and its result is returned
|
||||||
* @param postCompute is called after the value is computed, but before any other thread sees it
|
* @param postCompute is called after the value is computed, but before any other thread sees it
|
||||||
*/
|
*/
|
||||||
fun createLazyValueWithPostCompute<T: Any>(computable: () -> T, onRecursiveCall: ((Boolean) -> T)?, postCompute: (T) -> Unit): NotNullLazyValue<T>
|
public fun createLazyValueWithPostCompute<T: Any>(computable: () -> T, onRecursiveCall: ((Boolean) -> T)?, postCompute: (T) -> Unit): NotNullLazyValue<T>
|
||||||
|
|
||||||
fun createNullableLazyValue<T: Any>(computable: () -> T?): NullableLazyValue<T>
|
public fun createNullableLazyValue<T: Any>(computable: () -> T?): NullableLazyValue<T>
|
||||||
|
|
||||||
fun createRecursionTolerantNullableLazyValue<T: Any>(computable: () -> T?, onRecursiveCall: T?): NullableLazyValue<T>
|
public fun createRecursionTolerantNullableLazyValue<T: Any>(computable: () -> T?, onRecursiveCall: T?): NullableLazyValue<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code postCompute} is called after the value is computed, but before any other thread sees it (the current thread may
|
* {@code postCompute} is called after the value is computed, but before any other thread sees it (the current thread may
|
||||||
* see it in between)
|
* see it in between)
|
||||||
*/
|
*/
|
||||||
fun createNullableLazyValueWithPostCompute<T: Any>(computable: () -> T?, postCompute: (T?) -> Unit): NullableLazyValue<T>
|
public fun createNullableLazyValueWithPostCompute<T: Any>(computable: () -> T?, postCompute: (T?) -> Unit): NullableLazyValue<T>
|
||||||
|
|
||||||
fun compute<T>(computable: () -> T): T
|
public fun compute<T>(computable: () -> T): T
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ public trait MemoizedFunctionToNotNull<P, R: Any> : Function1<P, R>
|
|||||||
public trait MemoizedFunctionToNullable<P, R: Any> : Function1<P, R?>
|
public trait MemoizedFunctionToNullable<P, R: Any> : Function1<P, R?>
|
||||||
|
|
||||||
public trait NotNullLazyValue<T: Any> : Function0<T> {
|
public trait NotNullLazyValue<T: Any> : Function0<T> {
|
||||||
fun isComputed(): Boolean
|
public fun isComputed(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait NullableLazyValue<T: Any> : Function0<T?> {
|
public trait NullableLazyValue<T: Any> : Function0<T?> {
|
||||||
fun isComputed(): Boolean
|
public fun isComputed(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> NotNullLazyValue<T>.get(_this: Any?, p: PropertyMetadata): T = invoke()
|
public fun <T> NotNullLazyValue<T>.get(_this: Any?, p: PropertyMetadata): T = invoke()
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.util
|
package org.jetbrains.kotlin.util
|
||||||
|
|
||||||
fun <T: Any, R> T?.inn(then: (T) -> R, _else: R): R = if (this != null) then(this) else _else
|
public fun <T: Any, R> T?.inn(then: (T) -> R, _else: R): R = if (this != null) then(this) else _else
|
||||||
|
|
||||||
fun <T: Any> T?.sure(message: String): T = this ?: throw AssertionError(message)
|
public fun <T: Any> T?.sure(message: String): T = this ?: throw AssertionError(message)
|
||||||
|
|
||||||
fun <T> T.printAndReturn(message: String = ""): T {
|
fun <T> T.printAndReturn(message: String = ""): T {
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
|
|||||||
@@ -32,25 +32,25 @@ import org.jetbrains.org.objectweb.asm.tree.IincInsnNode
|
|||||||
|
|
||||||
class UnsupportedByteCodeException(message: String) : RuntimeException(message)
|
class UnsupportedByteCodeException(message: String) : RuntimeException(message)
|
||||||
|
|
||||||
trait Eval {
|
public trait Eval {
|
||||||
fun loadClass(classType: Type): Value
|
public fun loadClass(classType: Type): Value
|
||||||
fun loadString(str: String): Value
|
public fun loadString(str: String): Value
|
||||||
fun newInstance(classType: Type): Value
|
public fun newInstance(classType: Type): Value
|
||||||
fun isInstanceOf(value: Value, targetType: Type): Boolean
|
public fun isInstanceOf(value: Value, targetType: Type): Boolean
|
||||||
|
|
||||||
fun newArray(arrayType: Type, size: Int): Value
|
public fun newArray(arrayType: Type, size: Int): Value
|
||||||
fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value
|
public fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value
|
||||||
fun getArrayLength(array: Value): Value
|
public fun getArrayLength(array: Value): Value
|
||||||
fun getArrayElement(array: Value, index: Value): Value
|
public fun getArrayElement(array: Value, index: Value): Value
|
||||||
fun setArrayElement(array: Value, index: Value, newValue: Value)
|
public fun setArrayElement(array: Value, index: Value, newValue: Value)
|
||||||
|
|
||||||
fun getStaticField(fieldDesc: FieldDescription): Value
|
public fun getStaticField(fieldDesc: FieldDescription): Value
|
||||||
fun setStaticField(fieldDesc: FieldDescription, newValue: Value)
|
public fun setStaticField(fieldDesc: FieldDescription, newValue: Value)
|
||||||
fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value
|
public fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value
|
||||||
|
|
||||||
fun getField(instance: Value, fieldDesc: FieldDescription): Value
|
public fun getField(instance: Value, fieldDesc: FieldDescription): Value
|
||||||
fun setField(instance: Value, fieldDesc: FieldDescription, newValue: Value)
|
public fun setField(instance: Value, fieldDesc: FieldDescription, newValue: Value)
|
||||||
fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean = false): Value
|
public fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean = false): Value
|
||||||
}
|
}
|
||||||
|
|
||||||
class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(ASM5) {
|
class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(ASM5) {
|
||||||
|
|||||||
@@ -28,29 +28,29 @@ import org.jetbrains.org.objectweb.asm.tree.TryCatchBlockNode
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import org.jetbrains.eval4j.ExceptionThrown.ExceptionKind
|
import org.jetbrains.eval4j.ExceptionThrown.ExceptionKind
|
||||||
|
|
||||||
trait InterpreterResult {
|
public trait InterpreterResult {
|
||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExceptionThrown(val exception: Value, val kind: ExceptionKind): InterpreterResult {
|
public class ExceptionThrown(public val exception: Value, public val kind: ExceptionKind): InterpreterResult {
|
||||||
override fun toString(): String = "Thrown $exception: $kind"
|
override fun toString(): String = "Thrown $exception: $kind"
|
||||||
|
|
||||||
enum class ExceptionKind {
|
public enum class ExceptionKind {
|
||||||
FROM_EVALUATED_CODE
|
FROM_EVALUATED_CODE
|
||||||
FROM_EVALUATOR
|
FROM_EVALUATOR
|
||||||
BROKEN_CODE
|
BROKEN_CODE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class ValueReturned(val result: Value): InterpreterResult {
|
public data class ValueReturned(public val result: Value): InterpreterResult {
|
||||||
override fun toString(): String = "Returned $result"
|
override fun toString(): String = "Returned $result"
|
||||||
}
|
}
|
||||||
|
|
||||||
class AbnormalTermination(val message: String): InterpreterResult {
|
public class AbnormalTermination(public val message: String): InterpreterResult {
|
||||||
override fun toString(): String = "Terminated abnormally: $message"
|
override fun toString(): String = "Terminated abnormally: $message"
|
||||||
}
|
}
|
||||||
|
|
||||||
trait InterpretationEventHandler {
|
public trait InterpretationEventHandler {
|
||||||
|
|
||||||
class object {
|
class object {
|
||||||
object NONE : InterpretationEventHandler {
|
object NONE : InterpretationEventHandler {
|
||||||
@@ -78,7 +78,7 @@ class ThrownFromEvaluatedCodeException(val exception: Value): RuntimeException()
|
|||||||
override fun toString(): String = "Thrown from evaluated code: $exception"
|
override fun toString(): String = "Thrown from evaluated code: $exception"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun interpreterLoop(
|
public fun interpreterLoop(
|
||||||
m: MethodNode,
|
m: MethodNode,
|
||||||
initialState: Frame<Value>,
|
initialState: Frame<Value>,
|
||||||
eval: Eval,
|
eval: Eval,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.sun.jdi.Method
|
|||||||
val CLASS = Type.getType(javaClass<Class<*>>())
|
val CLASS = Type.getType(javaClass<Class<*>>())
|
||||||
val BOOTSTRAP_CLASS_DESCRIPTORS = setOf("Ljava/lang/String;", "Ljava/lang/ClassLoader;", "Ljava/lang/Class;")
|
val BOOTSTRAP_CLASS_DESCRIPTORS = setOf("Ljava/lang/String;", "Ljava/lang/ClassLoader;", "Ljava/lang/Class;")
|
||||||
|
|
||||||
class JDIEval(
|
public class JDIEval(
|
||||||
private val vm: jdi.VirtualMachine,
|
private val vm: jdi.VirtualMachine,
|
||||||
private val classLoader: jdi.ClassLoaderReference,
|
private val classLoader: jdi.ClassLoaderReference,
|
||||||
private val thread: jdi.ThreadReference,
|
private val thread: jdi.ThreadReference,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
|||||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||||
import com.sun.jdi
|
import com.sun.jdi
|
||||||
|
|
||||||
fun makeInitialFrame(methodNode: MethodNode, arguments: List<Value>): Frame<Value> {
|
public fun makeInitialFrame(methodNode: MethodNode, arguments: List<Value>): Frame<Value> {
|
||||||
val isStatic = (methodNode.access and ACC_STATIC) != 0
|
val isStatic = (methodNode.access and ACC_STATIC) != 0
|
||||||
|
|
||||||
val params = Type.getArgumentTypes(methodNode.desc)
|
val params = Type.getArgumentTypes(methodNode.desc)
|
||||||
@@ -51,7 +51,7 @@ class JDIFailureException(message: String?, cause: Throwable? = null): RuntimeEx
|
|||||||
|
|
||||||
fun <T: Any> T?.sure(message: String? = null): T = this ?: throw JDIFailureException(message)
|
fun <T: Any> T?.sure(message: String? = null): T = this ?: throw JDIFailureException(message)
|
||||||
|
|
||||||
fun jdi.Value?.asValue(): Value {
|
public fun jdi.Value?.asValue(): Value {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
null -> NULL_VALUE
|
null -> NULL_VALUE
|
||||||
is jdi.VoidValue -> VOID_VALUE
|
is jdi.VoidValue -> VOID_VALUE
|
||||||
@@ -76,7 +76,7 @@ val Value.jdiObj: jdi.ObjectReference?
|
|||||||
val Value.jdiClass: jdi.ClassObjectReference?
|
val Value.jdiClass: jdi.ClassObjectReference?
|
||||||
get() = this.jdiObj as jdi.ClassObjectReference?
|
get() = this.jdiObj as jdi.ClassObjectReference?
|
||||||
|
|
||||||
fun Value.asJdiValue(vm: jdi.VirtualMachine, expectedType: Type): jdi.Value? {
|
public fun Value.asJdiValue(vm: jdi.VirtualMachine, expectedType: Type): jdi.Value? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
NULL_VALUE -> null
|
NULL_VALUE -> null
|
||||||
VOID_VALUE -> vm.mirrorOfVoid()
|
VOID_VALUE -> vm.mirrorOfVoid()
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ val MethodDescription.parameterTypes: List<Type>
|
|||||||
get() = Type.getArgumentTypes(desc).toList()
|
get() = Type.getArgumentTypes(desc).toList()
|
||||||
|
|
||||||
|
|
||||||
class FieldDescription(
|
public class FieldDescription(
|
||||||
ownerInternalName: String,
|
ownerInternalName: String,
|
||||||
name: String,
|
name: String,
|
||||||
desc: String,
|
desc: String,
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ package org.jetbrains.eval4j
|
|||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||||
|
|
||||||
trait Value : org.jetbrains.org.objectweb.asm.tree.analysis.Value {
|
public trait Value : org.jetbrains.org.objectweb.asm.tree.analysis.Value {
|
||||||
val asmType: Type
|
public val asmType: Type
|
||||||
val valid: Boolean
|
public val valid: Boolean
|
||||||
override fun getSize(): Int = asmType.getSize()
|
override fun getSize(): Int = asmType.getSize()
|
||||||
|
|
||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
@@ -57,7 +57,7 @@ abstract class AbstractValueBase<V>(
|
|||||||
override val asmType: Type
|
override val asmType: Type
|
||||||
) : Value {
|
) : Value {
|
||||||
override val valid = true
|
override val valid = true
|
||||||
abstract val value: V
|
public abstract val value: V
|
||||||
|
|
||||||
override fun toString() = "$value: $asmType"
|
override fun toString() = "$value: $asmType"
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ class IntValue(value: Int, asmType: Type): AbstractValue<Int>(value, asmType)
|
|||||||
class LongValue(value: Long): AbstractValue<Long>(value, Type.LONG_TYPE)
|
class LongValue(value: Long): AbstractValue<Long>(value, Type.LONG_TYPE)
|
||||||
class FloatValue(value: Float): AbstractValue<Float>(value, Type.FLOAT_TYPE)
|
class FloatValue(value: Float): AbstractValue<Float>(value, Type.FLOAT_TYPE)
|
||||||
class DoubleValue(value: Double): AbstractValue<Double>(value, Type.DOUBLE_TYPE)
|
class DoubleValue(value: Double): AbstractValue<Double>(value, Type.DOUBLE_TYPE)
|
||||||
class ObjectValue(value: Any?, asmType: Type): AbstractValue<Any?>(value, asmType)
|
public class ObjectValue(value: Any?, asmType: Type): AbstractValue<Any?>(value, asmType)
|
||||||
class NewObjectValue(asmType: Type): AbstractValueBase<Any?>(asmType) {
|
class NewObjectValue(asmType: Type): AbstractValueBase<Any?>(asmType) {
|
||||||
override var value: Any? = null
|
override var value: Any? = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase
|
|||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||||
|
|
||||||
abstract class AbstractDataFlowValueRenderingTest: JetLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractDataFlowValueRenderingTest: JetLightCodeInsightFixtureTestCase() {
|
||||||
override fun getTestDataPath() : String {
|
override fun getTestDataPath() : String {
|
||||||
return PluginTestCaseBase.getTestDataPathBase() + "/dataFlowValueRendering/"
|
return PluginTestCaseBase.getTestDataPathBase() + "/dataFlowValueRendering/"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
|||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
import org.jetbrains.jet.InTextDirectivesUtils
|
import org.jetbrains.jet.InTextDirectivesUtils
|
||||||
|
|
||||||
abstract class AbstractSmartCompletionHandlerTest() : CompletionHandlerTestBase() {
|
public abstract class AbstractSmartCompletionHandlerTest() : CompletionHandlerTestBase() {
|
||||||
private val INVOCATION_COUNT_PREFIX = "INVOCATION_COUNT:"
|
private val INVOCATION_COUNT_PREFIX = "INVOCATION_COUNT:"
|
||||||
private val LOOKUP_STRING_PREFIX = "ELEMENT:"
|
private val LOOKUP_STRING_PREFIX = "ELEMENT:"
|
||||||
private val ELEMENT_TEXT_PREFIX = "ELEMENT_TEXT:"
|
private val ELEMENT_TEXT_PREFIX = "ELEMENT_TEXT:"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.intellij.debugger.engine.BasicStepMethodFilter
|
|||||||
import com.intellij.openapi.util.Computable
|
import com.intellij.openapi.util.Computable
|
||||||
import org.jetbrains.jet.plugin.refactoring.runReadAction
|
import org.jetbrains.jet.plugin.refactoring.runReadAction
|
||||||
|
|
||||||
abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestCase() {
|
public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestCase() {
|
||||||
|
|
||||||
protected fun doStepIntoTest(path: String) {
|
protected fun doStepIntoTest(path: String) {
|
||||||
createDebugProcess(path)
|
createDebugProcess(path)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.intellij.psi.util.PsiFormatUtilBase
|
|||||||
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase
|
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase
|
||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
|
|
||||||
abstract class AbstractSmartStepIntoTest : JetLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractSmartStepIntoTest : JetLightCodeInsightFixtureTestCase() {
|
||||||
private val fixture: JavaCodeInsightTestFixture
|
private val fixture: JavaCodeInsightTestFixture
|
||||||
get() = myFixture
|
get() = myFixture
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName
|
|||||||
import org.jetbrains.jet.InTextDirectivesUtils
|
import org.jetbrains.jet.InTextDirectivesUtils
|
||||||
import org.jetbrains.jet.lang.psi.JetCodeFragment
|
import org.jetbrains.jet.lang.psi.JetCodeFragment
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentHighlightingTest : AbstractJetPsiCheckerTest() {
|
public abstract class AbstractCodeFragmentHighlightingTest : AbstractJetPsiCheckerTest() {
|
||||||
override fun doTest(filePath: String) {
|
override fun doTest(filePath: String) {
|
||||||
myFixture.configureByCodeFragment(filePath)
|
myFixture.configureByCodeFragment(filePath)
|
||||||
myFixture.checkHighlighting(true, false, false)
|
myFixture.checkHighlighting(true, false, false)
|
||||||
@@ -50,7 +50,7 @@ abstract class AbstractCodeFragmentHighlightingTest : AbstractJetPsiCheckerTest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class AbstractCodeFragmentCompletionTest : AbstractJvmBasicCompletionTest() {
|
public abstract class AbstractCodeFragmentCompletionTest : AbstractJvmBasicCompletionTest() {
|
||||||
override fun setUpFixture(testPath: String) {
|
override fun setUpFixture(testPath: String) {
|
||||||
myFixture.configureByCodeFragment(testPath)
|
myFixture.configureByCodeFragment(testPath)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase
|
|||||||
import com.intellij.codeInsight.CodeInsightSettings
|
import com.intellij.codeInsight.CodeInsightSettings
|
||||||
import org.jetbrains.jet.InTextDirectivesUtils
|
import org.jetbrains.jet.InTextDirectivesUtils
|
||||||
|
|
||||||
abstract class AbstractShortenRefsTest : JetLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractShortenRefsTest : JetLightCodeInsightFixtureTestCase() {
|
||||||
override fun getTestDataPath() = JetTestCaseBuilder.getHomeDirectory()
|
override fun getTestDataPath() = JetTestCaseBuilder.getHomeDirectory()
|
||||||
override fun getProjectDescriptor() = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
|||||||
import com.intellij.testFramework.LightProjectDescriptor
|
import com.intellij.testFramework.LightProjectDescriptor
|
||||||
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor
|
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor
|
||||||
|
|
||||||
abstract class AbstractJavaToKotlinConverterTest() : LightCodeInsightFixtureTestCase() {
|
public abstract class AbstractJavaToKotlinConverterTest() : LightCodeInsightFixtureTestCase() {
|
||||||
val testHeaderPattern = Pattern.compile("//(element|expression|statement|method|class|file|comp)\n")
|
val testHeaderPattern = Pattern.compile("//(element|expression|statement|method|class|file|comp)\n")
|
||||||
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
|
|||||||
Reference in New Issue
Block a user