Code cleanup: removed redundant semicolons
This commit is contained in:
+2281
File diff suppressed because it is too large
Load Diff
@@ -87,7 +87,7 @@ abstract class KotlinCompilerBaseTask : Task() {
|
|||||||
val compiler = compilerClass.newInstance()
|
val compiler = compilerClass.newInstance()
|
||||||
val exec = compilerClass.getMethod("execFullPathsInMessages", PrintStream::class.java, Array<String>::class.java)
|
val exec = compilerClass.getMethod("execFullPathsInMessages", PrintStream::class.java, Array<String>::class.java)
|
||||||
|
|
||||||
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]");
|
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
|
||||||
|
|
||||||
val result = exec(compiler, System.err, args.toTypedArray())
|
val result = exec(compiler, System.err, args.toTypedArray())
|
||||||
exitCode = (result as Enum<*>).ordinal
|
exitCode = (result as Enum<*>).ordinal
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ object CodegenUtilKt {
|
|||||||
toInterface: ClassDescriptor,
|
toInterface: ClassDescriptor,
|
||||||
delegateExpressionType: KotlinType? = null
|
delegateExpressionType: KotlinType? = null
|
||||||
): Map<CallableMemberDescriptor, CallableDescriptor> {
|
): Map<CallableMemberDescriptor, CallableDescriptor> {
|
||||||
if (delegateExpressionType?.isDynamic() ?: false) return mapOf();
|
if (delegateExpressionType?.isDynamic() ?: false) return mapOf()
|
||||||
|
|
||||||
return descriptor.defaultType.memberScope.getContributedDescriptors().asSequence()
|
return descriptor.defaultType.memberScope.getContributedDescriptors().asSequence()
|
||||||
.filterIsInstance<CallableMemberDescriptor>()
|
.filterIsInstance<CallableMemberDescriptor>()
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ open class BranchedValue(
|
|||||||
v.visitLabel(branchJumpLabel)
|
v.visitLabel(branchJumpLabel)
|
||||||
v.iconst(0)
|
v.iconst(0)
|
||||||
v.visitLabel(endLabel)
|
v.visitLabel(endLabel)
|
||||||
coerceTo(type, v);
|
coerceTo(type, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
open fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
||||||
if (arg1 is CondJump) arg1.condJump(jumpLabel, v, jumpIfFalse) else arg1.put(operandType, v)
|
if (arg1 is CondJump) arg1.condJump(jumpLabel, v, jumpIfFalse) else arg1.put(operandType, v)
|
||||||
arg2?.put(operandType, v)
|
arg2?.put(operandType, v)
|
||||||
v.visitJumpInsn(patchOpcode(if (jumpIfFalse) opcode else negatedOperations[opcode]!!, v), jumpLabel);
|
v.visitJumpInsn(patchOpcode(if (jumpIfFalse) opcode else negatedOperations[opcode]!!, v), jumpLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
open fun loopJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen;
|
package org.jetbrains.kotlin.codegen
|
||||||
|
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen;
|
package org.jetbrains.kotlin.codegen
|
||||||
|
|
||||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
|
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class DefaultCallArgs(val size: Int) {
|
|||||||
for (i in 0..size - 1) {
|
for (i in 0..size - 1) {
|
||||||
if (i != 0 && i % Integer.SIZE == 0) {
|
if (i != 0 && i % Integer.SIZE == 0) {
|
||||||
masks.add(mask)
|
masks.add(mask)
|
||||||
mask = 0;
|
mask = 0
|
||||||
}
|
}
|
||||||
mask = mask or if (bits.get(i)) 1 shl (i % Integer.SIZE) else 0
|
mask = mask or if (bits.get(i)) 1 shl (i % Integer.SIZE) else 0
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,6 @@ class DefaultCallArgs(val size: Int) {
|
|||||||
val parameterType = if (isConstructor) AsmTypes.DEFAULT_CONSTRUCTOR_MARKER else AsmTypes.OBJECT_TYPE
|
val parameterType = if (isConstructor) AsmTypes.DEFAULT_CONSTRUCTOR_MARKER else AsmTypes.OBJECT_TYPE
|
||||||
callGenerator.putValueIfNeeded(parameterType, StackValue.constant(null, parameterType))
|
callGenerator.putValueIfNeeded(parameterType, StackValue.constant(null, parameterType))
|
||||||
}
|
}
|
||||||
return toInts.isNotEmpty();
|
return toInts.isNotEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -156,7 +156,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
|
|||||||
val delegateOwner = delegateFunctionDescriptor.containingDeclaration
|
val delegateOwner = delegateFunctionDescriptor.containingDeclaration
|
||||||
if (delegateOwner is ClassDescriptor && delegateOwner.isCompanionObject) {
|
if (delegateOwner is ClassDescriptor && delegateOwner.isCompanionObject) {
|
||||||
val singletonValue = StackValue.singleton(delegateOwner, typeMapper)
|
val singletonValue = StackValue.singleton(delegateOwner, typeMapper)
|
||||||
singletonValue.put(singletonValue.type, v);
|
singletonValue.put(singletonValue.type, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class InterfaceImplBodyCodegen(
|
|||||||
override fun generateKotlinMetadataAnnotation() {
|
override fun generateKotlinMetadataAnnotation() {
|
||||||
(v as InterfaceImplClassBuilder).stopCounting()
|
(v as InterfaceImplClassBuilder).stopCounting()
|
||||||
|
|
||||||
writeSyntheticClassMetadata(v);
|
writeSyntheticClassMetadata(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun done() {
|
override fun done() {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class AsmTypeRemapper(val typeRemapper: TypeRemapper, val isDefaultGeneration: B
|
|||||||
|
|
||||||
override fun createRemappingSignatureAdapter(v: SignatureVisitor?): SignatureVisitor {
|
override fun createRemappingSignatureAdapter(v: SignatureVisitor?): SignatureVisitor {
|
||||||
if (isDefaultGeneration) {
|
if (isDefaultGeneration) {
|
||||||
return super.createRemappingSignatureAdapter(v);
|
return super.createRemappingSignatureAdapter(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
return object : RemappingSignatureAdapter(v, this) {
|
return object : RemappingSignatureAdapter(v, this) {
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ abstract class CoveringTryCatchNodeProcessor(parameterSize: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort<TryCatchBlockNodeInfo>(intervals, comp)
|
Collections.sort<TryCatchBlockNodeInfo>(intervals, comp)
|
||||||
return intervals;
|
return intervals
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun substituteTryBlockNodes(node: MethodNode) {
|
protected fun substituteTryBlockNodes(node: MethodNode) {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ReifiedTypeInliner(private val parametersMapping: TypeParameterMappings?)
|
|||||||
Opcodes.INVOKESTATIC,
|
Opcodes.INVOKESTATIC,
|
||||||
IntrinsicMethods.INTRINSICS_CLASS_NAME, NEED_CLASS_REIFICATION_MARKER_METHOD_NAME,
|
IntrinsicMethods.INTRINSICS_CLASS_NAME, NEED_CLASS_REIFICATION_MARKER_METHOD_NAME,
|
||||||
Type.getMethodDescriptor(Type.VOID_TYPE), false
|
Type.getMethodDescriptor(Type.VOID_TYPE), false
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ open class NestedSourceMapper(
|
|||||||
value, key ->
|
value, key ->
|
||||||
if (key.dest in value) 0 else RangeMapping.Comparator.compare(value, key)
|
if (key.dest in value) 0 else RangeMapping.Comparator.compare(value, key)
|
||||||
})
|
})
|
||||||
return if (index < 0) null else ranges[index];
|
return if (index < 0) null else ranges[index]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ open class DefaultSourceMapper(val sourceInfo: SourceInfo) : SourceMapper {
|
|||||||
|
|
||||||
protected val origin: RawFileMapping
|
protected val origin: RawFileMapping
|
||||||
|
|
||||||
var callSiteMarker: CallSiteMarker? = null;
|
var callSiteMarker: CallSiteMarker? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
lastMappedWithChanges = null
|
lastMappedWithChanges = null
|
||||||
field = value
|
field = value
|
||||||
|
|||||||
@@ -105,6 +105,6 @@ class AnonymousObjectTransformationInfo internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun createTransformer(inliningContext: InliningContext, sameModule: Boolean): ObjectTransformer<*> {
|
override fun createTransformer(inliningContext: InliningContext, sameModule: Boolean): ObjectTransformer<*> {
|
||||||
return AnonymousObjectTransformer(this, inliningContext, sameModule);
|
return AnonymousObjectTransformer(this, inliningContext, sameModule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.intrinsics;
|
package org.jetbrains.kotlin.codegen.intrinsics
|
||||||
|
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil.correctElementType
|
import org.jetbrains.kotlin.codegen.AsmUtil.correctElementType
|
||||||
import org.jetbrains.kotlin.codegen.Callable
|
import org.jetbrains.kotlin.codegen.Callable
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class BinaryOp(private val opcode: Int) : IntrinsicMethod() {
|
|||||||
|
|
||||||
return createBinaryIntrinsicCallable(returnType, paramType, operandType) {
|
return createBinaryIntrinsicCallable(returnType, paramType, operandType) {
|
||||||
v ->
|
v ->
|
||||||
v.visitInsn(returnType.getOpcode(opcode));
|
v.visitInsn(returnType.getOpcode(opcode))
|
||||||
if (operandType != returnType)
|
if (operandType != returnType)
|
||||||
StackValue.coerce(operandType, returnType, v)
|
StackValue.coerce(operandType, returnType, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ object TypeIntrinsics {
|
|||||||
private val OBJECT_TYPE = Type.getObjectType("java/lang/Object")
|
private val OBJECT_TYPE = Type.getObjectType("java/lang/Object")
|
||||||
|
|
||||||
private fun getAsMutableCollectionDescriptor(asmType: Type): String =
|
private fun getAsMutableCollectionDescriptor(asmType: Type): String =
|
||||||
Type.getMethodDescriptor(asmType, OBJECT_TYPE);
|
Type.getMethodDescriptor(asmType, OBJECT_TYPE)
|
||||||
|
|
||||||
private val BEFORE_CHECKCAST_TO_FUNCTION_OF_ARITY = "beforeCheckcastToFunctionOfArity"
|
private val BEFORE_CHECKCAST_TO_FUNCTION_OF_ARITY = "beforeCheckcastToFunctionOfArity"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.optimization.boxing;
|
package org.jetbrains.kotlin.codegen.optimization.boxing
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen.optimization.boxing;
|
package org.jetbrains.kotlin.codegen.optimization.boxing
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
PathUtil.getKotlinPathsForCompiler()
|
PathUtil.getKotlinPathsForCompiler()
|
||||||
|
|
||||||
messageSeverityCollector.report(CompilerMessageSeverity.LOGGING, "Using Kotlin home directory " + paths.homePath, CompilerMessageLocation.NO_LOCATION)
|
messageSeverityCollector.report(CompilerMessageSeverity.LOGGING, "Using Kotlin home directory " + paths.homePath, CompilerMessageLocation.NO_LOCATION)
|
||||||
PerformanceCounter.setTimeCounterEnabled(arguments.reportPerf);
|
PerformanceCounter.setTimeCounterEnabled(arguments.reportPerf)
|
||||||
|
|
||||||
val configuration = CompilerConfiguration()
|
val configuration = CompilerConfiguration()
|
||||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageSeverityCollector)
|
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageSeverityCollector)
|
||||||
@@ -280,9 +280,9 @@ open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
|
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
|
||||||
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
||||||
configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, arguments.declarationsOutputPath)
|
configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, arguments.declarationsOutputPath)
|
||||||
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, arguments.inheritMultifileParts);
|
configuration.put(JVMConfigurationKeys.INHERIT_MULTIFILE_PARTS, arguments.inheritMultifileParts)
|
||||||
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage);
|
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage)
|
||||||
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf);
|
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getClasspath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
private fun getClasspath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class JvmPackagePartProvider(val env: KotlinCoreEnvironment) : PackagePartProvid
|
|||||||
env.configuration.getList(CommonConfigurationKeys.CONTENT_ROOTS).
|
env.configuration.getList(CommonConfigurationKeys.CONTENT_ROOTS).
|
||||||
filterIsInstance<JvmClasspathRoot>().
|
filterIsInstance<JvmClasspathRoot>().
|
||||||
mapNotNull {
|
mapNotNull {
|
||||||
env.contentRootToVirtualFile(it);
|
env.contentRootToVirtualFile(it)
|
||||||
}.filter { it.findChild("META-INF") != null }.toMutableList()
|
}.filter { it.findChild("META-INF") != null }.toMutableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -128,7 +128,7 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
|
|
||||||
result.throwIfError()
|
result.throwIfError()
|
||||||
|
|
||||||
val generationStates = ArrayList<GenerationState>();
|
val generationStates = ArrayList<GenerationState>()
|
||||||
|
|
||||||
for (module in chunk) {
|
for (module in chunk) {
|
||||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||||
@@ -144,7 +144,7 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
module.getModuleName(), onIndependentPartCompilationEnd)
|
module.getModuleName(), onIndependentPartCompilationEnd)
|
||||||
|
|
||||||
outputFiles.put(module, generationState.factory)
|
outputFiles.put(module, generationState.factory)
|
||||||
generationStates.add(generationState);
|
generationStates.add(generationState)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -156,7 +156,7 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
for (generationState in generationStates) {
|
for (generationState in generationStates) {
|
||||||
generationState.destroy();
|
generationState.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,7 +435,7 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
|
|
||||||
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
|
||||||
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector()
|
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector()
|
||||||
);
|
)
|
||||||
|
|
||||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||||
return generationState
|
return generationState
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ class ConsoleReplCommandReader : ReplCommandReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun readLine(next: ReplFromTerminal.WhatNextAfterOneLine): String? {
|
override fun readLine(next: ReplFromTerminal.WhatNextAfterOneLine): String? {
|
||||||
val prompt = if (next == ReplFromTerminal.WhatNextAfterOneLine.INCOMPLETE) "... " else ">>> ";
|
val prompt = if (next == ReplFromTerminal.WhatNextAfterOneLine.INCOMPLETE) "... " else ">>> "
|
||||||
return consoleReader.readLine(prompt)
|
return consoleReader.readLine(prompt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class CompileServiceImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val stub = UnicastRemoteObject.exportObject(this, port, LoopbackNetworkInterface.clientLoopbackSocketFactory, LoopbackNetworkInterface.serverLoopbackSocketFactory) as CompileService
|
val stub = UnicastRemoteObject.exportObject(this, port, LoopbackNetworkInterface.clientLoopbackSocketFactory, LoopbackNetworkInterface.serverLoopbackSocketFactory) as CompileService
|
||||||
registry.rebind (COMPILER_SERVICE_RMI_NAME, stub);
|
registry.rebind (COMPILER_SERVICE_RMI_NAME, stub)
|
||||||
|
|
||||||
timer.schedule(0) {
|
timer.schedule(0) {
|
||||||
initiateElections()
|
initiateElections()
|
||||||
|
|||||||
+2
-2
@@ -71,11 +71,11 @@ fun isContainedByCompiledPartOfOurModule(descriptor: DeclarationDescriptor, outD
|
|||||||
val file = binaryClass.file
|
val file = binaryClass.file
|
||||||
if (file.fileSystem.protocol == StandardFileSystems.FILE_PROTOCOL) {
|
if (file.fileSystem.protocol == StandardFileSystems.FILE_PROTOCOL) {
|
||||||
val ioFile = VfsUtilCore.virtualToIoFile(file)
|
val ioFile = VfsUtilCore.virtualToIoFile(file)
|
||||||
return ioFile.absolutePath.startsWith(outDirectory.absolutePath + File.separator);
|
return ioFile.absolutePath.startsWith(outDirectory.absolutePath + File.separator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSourceElement(descriptor: DeclarationDescriptor): SourceElement =
|
fun getSourceElement(descriptor: DeclarationDescriptor): SourceElement =
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ class ProtectedInSuperClassCompanionCallChecker : CallChecker {
|
|||||||
if (!parentClassDescriptors.any { DescriptorUtils.isSubclass(it, companionOwnerDescriptor) }) return
|
if (!parentClassDescriptors.any { DescriptorUtils.isSubclass(it, companionOwnerDescriptor) }) return
|
||||||
// Called not within the same companion object or its owner class
|
// Called not within the same companion object or its owner class
|
||||||
if (companionDescriptor !in parentClassDescriptors && companionOwnerDescriptor !in parentClassDescriptors) {
|
if (companionDescriptor !in parentClassDescriptors && companionOwnerDescriptor !in parentClassDescriptors) {
|
||||||
context.trace.report(ErrorsJvm.SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC.on(resolvedCall.call.callElement));
|
context.trace.report(ErrorsJvm.SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC.on(resolvedCall.call.callElement))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ object RepeatableAnnotationChecker: AdditionalAnnotationChecker {
|
|||||||
if (duplicateAnnotation
|
if (duplicateAnnotation
|
||||||
&& classDescriptor.isRepeatableAnnotation()
|
&& classDescriptor.isRepeatableAnnotation()
|
||||||
&& classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) {
|
&& classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) {
|
||||||
trace.report(ErrorsJvm.NON_SOURCE_REPEATED_ANNOTATION.on(entry));
|
trace.report(ErrorsJvm.NON_SOURCE_REPEATED_ANNOTATION.on(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
existingTargetsForAnnotation.add(useSiteTarget)
|
existingTargetsForAnnotation.add(useSiteTarget)
|
||||||
|
|||||||
+1
-1
@@ -131,7 +131,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
val propertyType = getMethod.returnType!!
|
val propertyType = getMethod.returnType!!
|
||||||
|
|
||||||
val descriptor = MyPropertyDescriptor.create(ownerClass, getMethod.original, setMethod?.original, name, propertyType)
|
val descriptor = MyPropertyDescriptor.create(ownerClass, getMethod.original, setMethod?.original, name, propertyType)
|
||||||
return result(descriptor, possibleGetMethodNames, setMethodName);
|
return result(descriptor, possibleGetMethodNames, setMethodName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isGoodGetMethod(descriptor: FunctionDescriptor): Boolean {
|
private fun isGoodGetMethod(descriptor: FunctionDescriptor): Boolean {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.cfg
|
package org.jetbrains.kotlin.cfg
|
||||||
|
|
||||||
import org.jetbrains.kotlin.psi.*;
|
import org.jetbrains.kotlin.psi.*
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.tree.TokenSet
|
import com.intellij.psi.tree.TokenSet
|
||||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class KDocLinkParser(): PsiParser {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!builder.eof()) {
|
if (!builder.eof()) {
|
||||||
builder.error("Expression expected");
|
builder.error("Expression expected")
|
||||||
while (!builder.eof()) {
|
while (!builder.eof()) {
|
||||||
builder.advanceLexer();
|
builder.advanceLexer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ abstract class KtClassOrObject :
|
|||||||
fun isAnnotation(): Boolean = hasModifier(KtTokens.ANNOTATION_KEYWORD)
|
fun isAnnotation(): Boolean = hasModifier(KtTokens.ANNOTATION_KEYWORD)
|
||||||
|
|
||||||
override fun delete() {
|
override fun delete() {
|
||||||
CheckUtil.checkWritable(this);
|
CheckUtil.checkWritable(this)
|
||||||
|
|
||||||
val file = getContainingKtFile();
|
val file = getContainingKtFile()
|
||||||
if (!isTopLevel() || file.declarations.size > 1) {
|
if (!isTopLevel() || file.declarations.size > 1) {
|
||||||
super.delete()
|
super.delete()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.delete();
|
file.delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ abstract class KtCodeFragment(
|
|||||||
private val context: PsiElement?
|
private val context: PsiElement?
|
||||||
): KtFile((PsiManager.getInstance(_project) as PsiManagerEx).fileManager.createFileViewProvider(LightVirtualFile(name, KotlinFileType.INSTANCE, text), true), false), JavaCodeFragment {
|
): KtFile((PsiManager.getInstance(_project) as PsiManagerEx).fileManager.createFileViewProvider(LightVirtualFile(name, KotlinFileType.INSTANCE, text), true), false), JavaCodeFragment {
|
||||||
|
|
||||||
private var viewProvider = super<KtFile>.getViewProvider() as SingleRootFileViewProvider
|
private var viewProvider = super.getViewProvider() as SingleRootFileViewProvider
|
||||||
private var imports = LinkedHashSet<String>()
|
private var imports = LinkedHashSet<String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -68,7 +68,7 @@ abstract class KtCodeFragment(
|
|||||||
|
|
||||||
override fun getContext() = context
|
override fun getContext() = context
|
||||||
|
|
||||||
override fun getResolveScope() = context?.resolveScope ?: super<KtFile>.getResolveScope()
|
override fun getResolveScope() = context?.resolveScope ?: super.getResolveScope()
|
||||||
|
|
||||||
override fun clone(): KtCodeFragment {
|
override fun clone(): KtCodeFragment {
|
||||||
val clone = cloneImpl(calcTreeElement().clone() as FileElement) as KtCodeFragment
|
val clone = cloneImpl(calcTreeElement().clone() as FileElement) as KtCodeFragment
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ abstract class KtConstructor<T : KtConstructor<T>> : KtDeclarationStub<KotlinPla
|
|||||||
override fun getTextOffset(): Int {
|
override fun getTextOffset(): Int {
|
||||||
return getConstructorKeyword()?.getTextOffset()
|
return getConstructorKeyword()?.getTextOffset()
|
||||||
?: getValueParameterList()?.getTextOffset()
|
?: getValueParameterList()?.getTextOffset()
|
||||||
?: super<KtDeclarationStub>.getTextOffset()
|
?: super.getTextOffset()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUseScope(): SearchScope {
|
override fun getUseScope(): SearchScope {
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ class KtEnumEntrySuperclassReferenceExpression :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getReferencedNameAsName(): Name {
|
override fun getReferencedNameAsName(): Name {
|
||||||
return referencedElement.getName()?.let { Name.identifier(it) } ?: SpecialNames.NO_NAME_PROVIDED;
|
return referencedElement.getName()?.let { Name.identifier(it) } ?: SpecialNames.NO_NAME_PROVIDED
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getReferencedNameElement(): PsiElement {
|
override fun getReferencedNameElement(): PsiElement {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ abstract class KtExpressionImpl(node: ASTNode) : KtElementImpl(node), KtExpressi
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun replace(newElement: PsiElement): PsiElement {
|
override fun replace(newElement: PsiElement): PsiElement {
|
||||||
return replaceExpression(this, newElement, { super<KtElementImpl>.replace(it) })
|
return replaceExpression(this, newElement, { super.replace(it) })
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class AnnotationChecker(private val additionalCheckers: Iterable<AdditionalAnnot
|
|||||||
|| (existingTargetsForAnnotation.any { (it == null) != (useSiteTarget == null) })
|
|| (existingTargetsForAnnotation.any { (it == null) != (useSiteTarget == null) })
|
||||||
|
|
||||||
if (duplicateAnnotation && !classDescriptor.isRepeatableAnnotation()) {
|
if (duplicateAnnotation && !classDescriptor.isRepeatableAnnotation()) {
|
||||||
trace.report(Errors.REPEATED_ANNOTATION.on(entry));
|
trace.report(Errors.REPEATED_ANNOTATION.on(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
existingTargetsForAnnotation.add(useSiteTarget)
|
existingTargetsForAnnotation.add(useSiteTarget)
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ interface DeclarationChecker {
|
|||||||
declaration: KtDeclaration,
|
declaration: KtDeclaration,
|
||||||
descriptor: DeclarationDescriptor,
|
descriptor: DeclarationDescriptor,
|
||||||
diagnosticHolder: DiagnosticSink,
|
diagnosticHolder: DiagnosticSink,
|
||||||
bindingContext: BindingContext);
|
bindingContext: BindingContext)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ class DelegationResolver<T : CallableMemberDescriptor> private constructor(
|
|||||||
val alreadyDelegated = delegatedMembers.firstOrNull { isOverridableBy(it, candidate) }
|
val alreadyDelegated = delegatedMembers.firstOrNull { isOverridableBy(it, candidate) }
|
||||||
if (alreadyDelegated != null) {
|
if (alreadyDelegated != null) {
|
||||||
trace.report(MANY_IMPL_MEMBER_NOT_IMPLEMENTED.on(classOrObject, classOrObject, alreadyDelegated))
|
trace.report(MANY_IMPL_MEMBER_NOT_IMPLEMENTED.on(classOrObject, classOrObject, alreadyDelegated))
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ object ModifierCheckerCore {
|
|||||||
for (second in children) {
|
for (second in children) {
|
||||||
for (first in children) {
|
for (first in children) {
|
||||||
if (first == second) {
|
if (first == second) {
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
checkCompatibility(trace, first, second, list.owner, incorrectNodes)
|
checkCompatibility(trace, first, second, list.owner, incorrectNodes)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ private class ExplicitTypeBinding(
|
|||||||
// todo fix for List<*>
|
// todo fix for List<*>
|
||||||
val jetTypeReference = psiTypeArguments[index]
|
val jetTypeReference = psiTypeArguments[index]
|
||||||
val jetTypeElement = jetTypeReference?.typeElement
|
val jetTypeElement = jetTypeReference?.typeElement
|
||||||
if (jetTypeElement == null) return@map null;
|
if (jetTypeElement == null) return@map null
|
||||||
|
|
||||||
if (isErrorBinding) {
|
if (isErrorBinding) {
|
||||||
val nextJetType = trace[BindingContext.TYPE, jetTypeReference]
|
val nextJetType = trace[BindingContext.TYPE, jetTypeReference]
|
||||||
if (nextJetType == null) return@map null;
|
if (nextJetType == null) return@map null
|
||||||
|
|
||||||
return@map TypeArgumentBindingImpl(
|
return@map TypeArgumentBindingImpl(
|
||||||
TypeProjectionImpl(nextJetType),
|
TypeProjectionImpl(nextJetType),
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class TypeResolver(
|
|||||||
|
|
||||||
val lazyKotlinType = LazyKotlinType()
|
val lazyKotlinType = LazyKotlinType()
|
||||||
c.trace.record(BindingContext.TYPE, typeReference, lazyKotlinType)
|
c.trace.record(BindingContext.TYPE, typeReference, lazyKotlinType)
|
||||||
return type(lazyKotlinType);
|
return type(lazyKotlinType)
|
||||||
}
|
}
|
||||||
|
|
||||||
val type = doResolvePossiblyBareType(c, typeReference)
|
val type = doResolvePossiblyBareType(c, typeReference)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class VarianceCheckerCore(
|
|||||||
when (descriptor) {
|
when (descriptor) {
|
||||||
is FunctionDescriptorImpl -> descriptor.visibility = Visibilities.PRIVATE_TO_THIS
|
is FunctionDescriptorImpl -> descriptor.visibility = Visibilities.PRIVATE_TO_THIS
|
||||||
is PropertyDescriptorImpl -> {
|
is PropertyDescriptorImpl -> {
|
||||||
descriptor.visibility = Visibilities.PRIVATE_TO_THIS;
|
descriptor.visibility = Visibilities.PRIVATE_TO_THIS
|
||||||
for (accessor in descriptor.accessors) {
|
for (accessor in descriptor.accessors) {
|
||||||
(accessor as PropertyAccessorDescriptorImpl).visibility = Visibilities.PRIVATE_TO_THIS
|
(accessor as PropertyAccessorDescriptorImpl).visibility = Visibilities.PRIVATE_TO_THIS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class CandidateResolver(
|
|||||||
val candidateReflectionType = getReflectionTypeForCandidateDescriptor(
|
val candidateReflectionType = getReflectionTypeForCandidateDescriptor(
|
||||||
candidate, reflectionTypes,
|
candidate, reflectionTypes,
|
||||||
call.callElement.parent.let { it is KtCallableReferenceExpression && it.isEmptyLHS }
|
call.callElement.parent.let { it is KtCallableReferenceExpression && it.isEmptyLHS }
|
||||||
);
|
)
|
||||||
if (candidateReflectionType != null) {
|
if (candidateReflectionType != null) {
|
||||||
if (!KotlinTypeChecker.DEFAULT.isSubtypeOf(candidateReflectionType, expectedType)) {
|
if (!KotlinTypeChecker.DEFAULT.isSubtypeOf(candidateReflectionType, expectedType)) {
|
||||||
candidateCall.addStatus(OTHER_ERROR)
|
candidateCall.addStatus(OTHER_ERROR)
|
||||||
@@ -384,7 +384,7 @@ class CandidateResolver(
|
|||||||
val dataFlowValue = DataFlowValueFactory.createDataFlowValue(expression, type, context)
|
val dataFlowValue = DataFlowValueFactory.createDataFlowValue(expression, type, context)
|
||||||
val smartCastResult = SmartCastManager.checkAndRecordPossibleCast(dataFlowValue, expectedType, expression, context, null, false)
|
val smartCastResult = SmartCastManager.checkAndRecordPossibleCast(dataFlowValue, expectedType, expression, context, null, false)
|
||||||
if (smartCastResult == null || !smartCastResult.isCorrect) {
|
if (smartCastResult == null || !smartCastResult.isCorrect) {
|
||||||
context.trace.report(Errors.SPREAD_OF_NULLABLE.on(spreadElement));
|
context.trace.report(Errors.SPREAD_OF_NULLABLE.on(spreadElement))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -250,7 +250,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
|||||||
private fun createStringConstant(compileTimeConstant: CompileTimeConstant<*>): TypedCompileTimeConstant<String>? {
|
private fun createStringConstant(compileTimeConstant: CompileTimeConstant<*>): TypedCompileTimeConstant<String>? {
|
||||||
val constantValue = compileTimeConstant.toConstantValue(TypeUtils.NO_EXPECTED_TYPE)
|
val constantValue = compileTimeConstant.toConstantValue(TypeUtils.NO_EXPECTED_TYPE)
|
||||||
if (constantValue.isStandaloneOnlyConstant()) {
|
if (constantValue.isStandaloneOnlyConstant()) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
return when (constantValue) {
|
return when (constantValue) {
|
||||||
is ErrorValue, is EnumValue -> return null
|
is ErrorValue, is EnumValue -> return null
|
||||||
@@ -533,7 +533,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
override fun visitSimpleNameExpression(expression: KtSimpleNameExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
|
||||||
val enumDescriptor = trace.bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
val enumDescriptor = trace.bindingContext.get(BindingContext.REFERENCE_TARGET, expression)
|
||||||
if (enumDescriptor != null && DescriptorUtils.isEnumEntry(enumDescriptor)) {
|
if (enumDescriptor != null && DescriptorUtils.isEnumEntry(enumDescriptor)) {
|
||||||
return factory.createEnumValue(enumDescriptor as ClassDescriptor).wrap()
|
return factory.createEnumValue(enumDescriptor as ClassDescriptor).wrap()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.inline;
|
package org.jetbrains.kotlin.resolve.inline
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
|
|||||||
+1
-1
@@ -144,7 +144,7 @@ class LazyAnnotationDescriptor(
|
|||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
return resolutionResults.resultingCall.valueArguments
|
return resolutionResults.resultingCall.valueArguments
|
||||||
.mapValues { val (valueParameter, resolvedArgument) = it;
|
.mapValues { val (valueParameter, resolvedArgument) = it
|
||||||
if (resolvedArgument == null) null
|
if (resolvedArgument == null) null
|
||||||
else c.annotationResolver.getAnnotationArgumentValue(c.trace, valueParameter, resolvedArgument)
|
else c.annotationResolver.getAnnotationArgumentValue(c.trace, valueParameter, resolvedArgument)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -193,7 +193,7 @@ open class LazyClassMemberScope(
|
|||||||
if (descriptor.kind != FAKE_OVERRIDE && descriptor.kind != DELEGATION) {
|
if (descriptor.kind != FAKE_OVERRIDE && descriptor.kind != DELEGATION) {
|
||||||
OverridingUtil.resolveUnknownVisibilityForMember(descriptor, OverrideResolver.createCannotInferVisibilityReporter(trace))
|
OverridingUtil.resolveUnknownVisibilityForMember(descriptor, OverrideResolver.createCannotInferVisibilityReporter(trace))
|
||||||
}
|
}
|
||||||
VarianceCheckerCore(trace.bindingContext, DiagnosticSink.DO_NOTHING).recordPrivateToThisIfNeeded(descriptor);
|
VarianceCheckerCore(trace.bindingContext, DiagnosticSink.DO_NOTHING).recordPrivateToThisIfNeeded(descriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -189,7 +189,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
|||||||
functionTypeExpected: Boolean
|
functionTypeExpected: Boolean
|
||||||
): KotlinType {
|
): KotlinType {
|
||||||
val expectedReturnType = if (functionTypeExpected) getReturnTypeFromFunctionType(context.expectedType) else null
|
val expectedReturnType = if (functionTypeExpected) getReturnTypeFromFunctionType(context.expectedType) else null
|
||||||
val returnType = computeUnsafeReturnType(expression, context, functionDescriptor, expectedReturnType);
|
val returnType = computeUnsafeReturnType(expression, context, functionDescriptor, expectedReturnType)
|
||||||
|
|
||||||
if (!expression.functionLiteral.hasDeclaredReturnType() && functionTypeExpected) {
|
if (!expression.functionLiteral.hasDeclaredReturnType() && functionTypeExpected) {
|
||||||
if (!TypeUtils.noExpectedType(expectedReturnType!!) && KotlinBuiltIns.isUnit(expectedReturnType)) {
|
if (!TypeUtils.noExpectedType(expectedReturnType!!) && KotlinBuiltIns.isUnit(expectedReturnType)) {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.asJava;
|
package org.jetbrains.kotlin.asJava
|
||||||
|
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||||
|
|
||||||
interface KtLightClass : PsiClass, KtLightDeclaration<KtClassOrObject, PsiClass> {
|
interface KtLightClass : PsiClass, KtLightDeclaration<KtClassOrObject, PsiClass> {
|
||||||
|
|||||||
+2
-2
@@ -88,8 +88,8 @@ private fun createSynthesizedFunctionWithFirstParameterAsReceiver(descriptor: Fu
|
|||||||
result.isExternal = original.isExternal
|
result.isExternal = original.isExternal
|
||||||
result.isInline = original.isInline
|
result.isInline = original.isInline
|
||||||
result.isTailrec = original.isTailrec
|
result.isTailrec = original.isTailrec
|
||||||
result.setHasStableParameterNames(false);
|
result.setHasStableParameterNames(false)
|
||||||
result.setHasSynthesizedParameterNames(true);
|
result.setHasSynthesizedParameterNames(true)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.codegen;
|
package org.jetbrains.kotlin.codegen
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.output.OutputFile
|
import org.jetbrains.kotlin.backend.common.output.OutputFile
|
||||||
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
|
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class KotlinClassFinderTest : KotlinTestWithEnvironmentManagement() {
|
|||||||
val className = "test.A.B.C"
|
val className = "test.A.B.C"
|
||||||
val psiClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project))
|
val psiClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project))
|
||||||
assertNotNull(psiClass, "Psi class not found for $className")
|
assertNotNull(psiClass, "Psi class not found for $className")
|
||||||
assertTrue(psiClass !is KtLightClass, "Kotlin light classes are not not expected");
|
assertTrue(psiClass !is KtLightClass, "Kotlin light classes are not not expected")
|
||||||
|
|
||||||
val binaryClass = JvmVirtualFileFinder.SERVICE.getInstance(project).findKotlinClass(JavaClassImpl(psiClass!!))
|
val binaryClass = JvmVirtualFileFinder.SERVICE.getInstance(project).findKotlinClass(JavaClassImpl(psiClass!!))
|
||||||
assertNotNull(binaryClass, "No binary class for $className")
|
assertNotNull(binaryClass, "No binary class for $className")
|
||||||
|
|||||||
+5
-5
@@ -171,7 +171,7 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testSimpleT() {
|
fun testSimpleT() {
|
||||||
doTest("simpleT.txt", "T");
|
doTest("simpleT.txt", "T")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testNullableT() {
|
fun testNullableT() {
|
||||||
@@ -179,19 +179,19 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testUseSiteInT() {
|
fun testUseSiteInT() {
|
||||||
doTest("useSiteInT.txt", "in T");
|
doTest("useSiteInT.txt", "in T")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testUseSiteInNullableT() {
|
fun testUseSiteInNullableT() {
|
||||||
doTest("useSiteInNullableT.txt", "in T?");
|
doTest("useSiteInNullableT.txt", "in T?")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testUseSiteOutT() {
|
fun testUseSiteOutT() {
|
||||||
doTest("useSiteOutT.txt", "out T");
|
doTest("useSiteOutT.txt", "out T")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testUseSiteOutNullableT() {
|
fun testUseSiteOutNullableT() {
|
||||||
doTest("useSiteOutNullableT.txt", "out T?");
|
doTest("useSiteOutNullableT.txt", "out T?")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testTwoVariables() {
|
fun testTwoVariables() {
|
||||||
|
|||||||
+1
-1
@@ -550,7 +550,7 @@ class LazyJavaClassMemberScope(
|
|||||||
constructorDescriptor.initialize(valueParameters, getConstructorVisibility(classDescriptor))
|
constructorDescriptor.initialize(valueParameters, getConstructorVisibility(classDescriptor))
|
||||||
constructorDescriptor.setHasStableParameterNames(true)
|
constructorDescriptor.setHasStableParameterNames(true)
|
||||||
constructorDescriptor.returnType = classDescriptor.defaultType
|
constructorDescriptor.returnType = classDescriptor.defaultType
|
||||||
c.components.javaResolverCache.recordConstructor(jClass, constructorDescriptor);
|
c.components.javaResolverCache.recordConstructor(jClass, constructorDescriptor)
|
||||||
return constructorDescriptor
|
return constructorDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -258,7 +258,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
c.components.javaResolverCache.recordField(field, propertyDescriptor);
|
c.components.javaResolverCache.recordField(field, propertyDescriptor)
|
||||||
|
|
||||||
return propertyDescriptor
|
return propertyDescriptor
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -134,7 +134,7 @@ fun <T : Any> mapType(
|
|||||||
descriptor is TypeParameterDescriptor -> {
|
descriptor is TypeParameterDescriptor -> {
|
||||||
val type = mapType(getRepresentativeUpperBound(descriptor),
|
val type = mapType(getRepresentativeUpperBound(descriptor),
|
||||||
factory, mode, typeMappingConfiguration, writeGenericType = DO_NOTHING_3, descriptorTypeWriter = null)
|
factory, mode, typeMappingConfiguration, writeGenericType = DO_NOTHING_3, descriptorTypeWriter = null)
|
||||||
descriptorTypeWriter?.writeTypeVariable(descriptor.getName(), type);
|
descriptorTypeWriter?.writeTypeVariable(descriptor.getName(), type)
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ abstract class PackageFragmentDescriptorImpl(
|
|||||||
visitor.visitPackageFragmentDescriptor(this, data)
|
visitor.visitPackageFragmentDescriptor(this, data)
|
||||||
|
|
||||||
override fun getContainingDeclaration(): ModuleDescriptor {
|
override fun getContainingDeclaration(): ModuleDescriptor {
|
||||||
return super<DeclarationDescriptorNonRootImpl>.getContainingDeclaration() as ModuleDescriptor
|
return super.getContainingDeclaration() as ModuleDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSource(): SourceElement {
|
override fun getSource(): SourceElement {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.types;
|
package org.jetbrains.kotlin.types
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ abstract class DelegatingFlexibleType protected constructor(
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
return when(capabilityClass) {
|
return when(capabilityClass) {
|
||||||
Flexibility::class.java, SubtypingRepresentatives::class.java -> this as T
|
Flexibility::class.java, SubtypingRepresentatives::class.java -> this as T
|
||||||
else -> super<DelegatingType>.getCapability(capabilityClass)
|
else -> super.getCapability(capabilityClass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.serialization;
|
package org.jetbrains.kotlin.serialization
|
||||||
|
|
||||||
import com.google.protobuf.ExtensionRegistryLite
|
import com.google.protobuf.ExtensionRegistryLite
|
||||||
import com.google.protobuf.GeneratedMessageLite.GeneratedExtension
|
import com.google.protobuf.GeneratedMessageLite.GeneratedExtension
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ open class MemberDescription protected constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = 13;
|
var result = 13
|
||||||
result = result * 23 + ownerInternalName.hashCode()
|
result = result * 23 + ownerInternalName.hashCode()
|
||||||
result = result * 23 + name.hashCode()
|
result = result * 23 + name.hashCode()
|
||||||
result = result * 23 + desc.hashCode()
|
result = result * 23 + desc.hashCode()
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ fun MethodDescription.matches(ctor: Constructor<*>): Boolean {
|
|||||||
if (!p.matches(methodParams[i])) return false
|
if (!p.matches(methodParams[i])) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun MethodDescription.matches(method: Method): Boolean {
|
fun MethodDescription.matches(method: Method): Boolean {
|
||||||
|
|||||||
+1
-1
@@ -375,7 +375,7 @@ val SHOULD_NOT_BE_ESCAPED = JsFunctionScope.RESERVED_WORDS.filter { it !in SHOUL
|
|||||||
val s1 = SHOULD_BE_ESCAPED.cyclicSequence()
|
val s1 = SHOULD_BE_ESCAPED.cyclicSequence()
|
||||||
val s2 = SHOULD_NOT_BE_ESCAPED.cyclicSequence()
|
val s2 = SHOULD_NOT_BE_ESCAPED.cyclicSequence()
|
||||||
|
|
||||||
val PORTION_PART_SIZE = 2;
|
val PORTION_PART_SIZE = 2
|
||||||
|
|
||||||
fun nextKeywordPortion() = s1.take(PORTION_PART_SIZE).toList() + s2.take(PORTION_PART_SIZE).toList()
|
fun nextKeywordPortion() = s1.take(PORTION_PART_SIZE).toList() + s2.take(PORTION_PART_SIZE).toList()
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class KotlinSpacingBuilder(val codeStyleSettings: CodeStyleSettings, val spacing
|
|||||||
|
|
||||||
inner class BasicSpacingBuilder() : SpacingBuilder(codeStyleSettings, KotlinLanguage.INSTANCE), Builder {
|
inner class BasicSpacingBuilder() : SpacingBuilder(codeStyleSettings, KotlinLanguage.INSTANCE), Builder {
|
||||||
override fun getSpacing(parent: ASTBlock, left: ASTBlock, right: ASTBlock): Spacing? {
|
override fun getSpacing(parent: ASTBlock, left: ASTBlock, right: ASTBlock): Spacing? {
|
||||||
return super<SpacingBuilder>.getSpacing(parent, left, right)
|
return super.getSpacing(parent, left, right)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ class KDocMissingDocumentationInspection(): AbstractKotlinInspection() {
|
|||||||
|
|
||||||
if (element is KtNamedDeclaration) {
|
if (element is KtNamedDeclaration) {
|
||||||
val nameIdentifier = element.nameIdentifier
|
val nameIdentifier = element.nameIdentifier
|
||||||
val descriptor = element.resolveToDescriptor() as? MemberDescriptor;
|
val descriptor = element.resolveToDescriptor() as? MemberDescriptor
|
||||||
if (nameIdentifier != null && descriptor?.visibility == Visibilities.PUBLIC) {
|
if (nameIdentifier != null && descriptor?.visibility == Visibilities.PUBLIC) {
|
||||||
val hasDocumentation = element.docComment != null ||
|
val hasDocumentation = element.docComment != null ||
|
||||||
(descriptor as? CallableMemberDescriptor)?.overriddenDescriptors
|
(descriptor as? CallableMemberDescriptor)?.overriddenDescriptors
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere
|
|||||||
|
|
||||||
override fun handleElementRename(newElementName: String?): PsiElement {
|
override fun handleElementRename(newElementName: String?): PsiElement {
|
||||||
if (!canRename()) throw IncorrectOperationException()
|
if (!canRename()) throw IncorrectOperationException()
|
||||||
if (newElementName == null) return expression;
|
if (newElementName == null) return expression
|
||||||
|
|
||||||
// Do not rename if the reference corresponds to synthesized component function
|
// Do not rename if the reference corresponds to synthesized component function
|
||||||
val expressionText = expression.text
|
val expressionText = expression.text
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ class IllegalIdentifierInspection : AbstractKotlinInspection() {
|
|||||||
val editor = editorManager.getSelectedEditor(file.virtualFile) ?: return
|
val editor = editorManager.getSelectedEditor(file.virtualFile) ?: return
|
||||||
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
||||||
val renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext)
|
val renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext)
|
||||||
renameHandler?.invoke(project, arrayOf(element), dataContext);
|
renameHandler?.invoke(project, arrayOf(element), dataContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -52,7 +52,7 @@ abstract class DeclarationLookupObjectImpl(
|
|||||||
(psiElement as? PsiClass)?.qualifiedName?.let { FqName(it) }
|
(psiElement as? PsiClass)?.qualifiedName?.let { FqName(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = super<DeclarationLookupObject>.toString() + " " + (descriptor ?: psiElement)
|
override fun toString() = super.toString() + " " + (descriptor ?: psiElement)
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return if (descriptor != null) descriptor.original.hashCode() else psiElement!!.hashCode()
|
return if (descriptor != null) descriptor.original.hashCode() else psiElement!!.hashCode()
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa
|
|||||||
if (lookup.currentItem != item) { // do not touch selection if not changed - important for char filter tests
|
if (lookup.currentItem != item) { // do not touch selection if not changed - important for char filter tests
|
||||||
lookup.currentItem = item
|
lookup.currentItem = item
|
||||||
}
|
}
|
||||||
lookup.focusDegree = LookupImpl.FocusDegree.FOCUSED;
|
lookup.focusDegree = LookupImpl.FocusDegree.FOCUSED
|
||||||
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
|
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
|
||||||
(object : WriteCommandAction.Simple<Any>(project) {
|
(object : WriteCommandAction.Simple<Any>(project) {
|
||||||
override fun run(result: Result<Any>) {
|
override fun run(result: Result<Any>) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ExtraSteppingFilter : com.intellij.debugger.engine.ExtraSteppingFilter {
|
|||||||
|
|
||||||
override fun isApplicable(context: SuspendContext?): Boolean {
|
override fun isApplicable(context: SuspendContext?): Boolean {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
val debugProcess = context.debugProcess ?: return false
|
val debugProcess = context.debugProcess ?: return false
|
||||||
@@ -43,7 +43,7 @@ class ExtraSteppingFilter : com.intellij.debugger.engine.ExtraSteppingFilter {
|
|||||||
private fun shouldFilter(positionManager: KotlinPositionManager, location: Location): Boolean {
|
private fun shouldFilter(positionManager: KotlinPositionManager, location: Location): Boolean {
|
||||||
val defaultStrata = location.declaringType()?.defaultStratum()
|
val defaultStrata = location.declaringType()?.defaultStratum()
|
||||||
if ("Kotlin" != defaultStrata) {
|
if ("Kotlin" != defaultStrata) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourcePosition =
|
val sourcePosition =
|
||||||
@@ -68,7 +68,7 @@ class ExtraSteppingFilter : com.intellij.debugger.engine.ExtraSteppingFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getStepRequestDepth(context: SuspendContext?): Int {
|
override fun getStepRequestDepth(context: SuspendContext?): Int {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class KotlinReferenceData(
|
|||||||
|
|
||||||
public override fun clone(): KotlinReferenceData {
|
public override fun clone(): KotlinReferenceData {
|
||||||
try {
|
try {
|
||||||
return super<Cloneable>.clone() as KotlinReferenceData
|
return super.clone() as KotlinReferenceData
|
||||||
}
|
}
|
||||||
catch (e: CloneNotSupportedException) {
|
catch (e: CloneNotSupportedException) {
|
||||||
throw RuntimeException()
|
throw RuntimeException()
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq
|
|||||||
if (start == null || end == null) return null
|
if (start == null || end == null) return null
|
||||||
|
|
||||||
val literalsOrFunctions = getLambdasAtLineIfAny(file, lineNumber)
|
val literalsOrFunctions = getLambdasAtLineIfAny(file, lineNumber)
|
||||||
if (literalsOrFunctions.isEmpty()) return null;
|
if (literalsOrFunctions.isEmpty()) return null
|
||||||
|
|
||||||
val elementAt = file.findElementAt(start) ?: return null
|
val elementAt = file.findElementAt(start) ?: return null
|
||||||
val typeMapper = KotlinDebuggerCaches.getOrCreateTypeMapper(elementAt)
|
val typeMapper = KotlinDebuggerCaches.getOrCreateTypeMapper(elementAt)
|
||||||
|
|||||||
+2
-2
@@ -161,10 +161,10 @@ class KotlinFieldBreakpointType : JavaBreakpointType<KotlinPropertyBreakpointPro
|
|||||||
override fun getDisplayText(breakpoint: XLineBreakpoint<KotlinPropertyBreakpointProperties>): String? {
|
override fun getDisplayText(breakpoint: XLineBreakpoint<KotlinPropertyBreakpointProperties>): String? {
|
||||||
val kotlinBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint) as? BreakpointWithHighlighter
|
val kotlinBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint) as? BreakpointWithHighlighter
|
||||||
if (kotlinBreakpoint != null) {
|
if (kotlinBreakpoint != null) {
|
||||||
return kotlinBreakpoint.description;
|
return kotlinBreakpoint.description
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return super.getDisplayText(breakpoint);
|
return super.getDisplayText(breakpoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ class KotlinEnterHandler: EnterHandlerDelegateAdapter() {
|
|||||||
if (elementAt is PsiWhiteSpace && ("\n" in elementAt.getText()!!)) return EnterHandlerDelegate.Result.Continue
|
if (elementAt is PsiWhiteSpace && ("\n" in elementAt.getText()!!)) return EnterHandlerDelegate.Result.Continue
|
||||||
|
|
||||||
// Indent for LBRACE can be removed after fixing IDEA-124917
|
// Indent for LBRACE can be removed after fixing IDEA-124917
|
||||||
val elementBefore = CodeInsightUtils.getElementAtOffsetIgnoreWhitespaceAfter(file, caretOffset);
|
val elementBefore = CodeInsightUtils.getElementAtOffsetIgnoreWhitespaceAfter(file, caretOffset)
|
||||||
val elementAfter = CodeInsightUtils.getElementAtOffsetIgnoreWhitespaceBefore(file, caretOffset);
|
val elementAfter = CodeInsightUtils.getElementAtOffsetIgnoreWhitespaceBefore(file, caretOffset)
|
||||||
|
|
||||||
val isAfterLBraceOrArrow = elementBefore != null && elementBefore.node!!.elementType in FORCE_INDENT_IN_LAMBDA_AFTER
|
val isAfterLBraceOrArrow = elementBefore != null && elementBefore.node!!.elementType in FORCE_INDENT_IN_LAMBDA_AFTER
|
||||||
val isBeforeRBrace = elementAfter == null || elementAfter.node!!.elementType == KtTokens.RBRACE
|
val isBeforeRBrace = elementAfter == null || elementAfter.node!!.elementType == KtTokens.RBRACE
|
||||||
@@ -81,7 +81,7 @@ class KotlinEnterHandler: EnterHandlerDelegateAdapter() {
|
|||||||
CodeStyleManager.getInstance(file.getProject())!!.adjustLineIndent(file, editor.caretModel.offset)
|
CodeStyleManager.getInstance(file.getProject())!!.adjustLineIndent(file, editor.caretModel.offset)
|
||||||
}
|
}
|
||||||
catch (e: IncorrectOperationException) {
|
catch (e: IncorrectOperationException) {
|
||||||
LOG.error(e);
|
LOG.error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
return EnterHandlerDelegate.Result.DefaultForceIndent
|
return EnterHandlerDelegate.Result.DefaultForceIndent
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.psi.KtNamedFunction
|
|||||||
|
|
||||||
class KotlinFunctionParametersFixer : SmartEnterProcessorWithFixers.Fixer<KotlinSmartEnterHandler>() {
|
class KotlinFunctionParametersFixer : SmartEnterProcessorWithFixers.Fixer<KotlinSmartEnterHandler>() {
|
||||||
override fun apply(editor: Editor, processor: KotlinSmartEnterHandler, psiElement: PsiElement) {
|
override fun apply(editor: Editor, processor: KotlinSmartEnterHandler, psiElement: PsiElement) {
|
||||||
if (psiElement !is KtNamedFunction) return;
|
if (psiElement !is KtNamedFunction) return
|
||||||
|
|
||||||
val parameterList = psiElement.valueParameterList
|
val parameterList = psiElement.valueParameterList
|
||||||
if (parameterList == null) {
|
if (parameterList == null) {
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
|||||||
|
|
||||||
class KotlinPropertySetterParametersFixer : SmartEnterProcessorWithFixers.Fixer<KotlinSmartEnterHandler>() {
|
class KotlinPropertySetterParametersFixer : SmartEnterProcessorWithFixers.Fixer<KotlinSmartEnterHandler>() {
|
||||||
override fun apply(editor: Editor, processor: KotlinSmartEnterHandler, psiElement: PsiElement) {
|
override fun apply(editor: Editor, processor: KotlinSmartEnterHandler, psiElement: PsiElement) {
|
||||||
if (psiElement !is KtPropertyAccessor) return;
|
if (psiElement !is KtPropertyAccessor) return
|
||||||
|
|
||||||
if (!psiElement.isSetter) return
|
if (!psiElement.isSetter) return
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class KotlinExceptionFilter(private val searchScope: GlobalSearchScope) : Filter
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun readDebugInfo(bytes: ByteArray): SmapData? {
|
private fun readDebugInfo(bytes: ByteArray): SmapData? {
|
||||||
val cr = ClassReader(bytes);
|
val cr = ClassReader(bytes)
|
||||||
var debugInfo: String? = null
|
var debugInfo: String? = null
|
||||||
cr.accept(object : ClassVisitor(InlineCodegenUtil.API) {
|
cr.accept(object : ClassVisitor(InlineCodegenUtil.API) {
|
||||||
override fun visitSource(source: String?, debug: String?) {
|
override fun visitSource(source: String?, debug: String?) {
|
||||||
|
|||||||
+1
-1
@@ -178,7 +178,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection(), Clean
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteRedundantExtensionAction(property: KtProperty) : KotlinQuickFixAction<KtProperty>(property) {
|
private class DeleteRedundantExtensionAction(property: KtProperty) : KotlinQuickFixAction<KtProperty>(property) {
|
||||||
private val LOG = Logger.getInstance(DeleteRedundantExtensionAction::class.java);
|
private val LOG = Logger.getInstance(DeleteRedundantExtensionAction::class.java)
|
||||||
|
|
||||||
override fun getFamilyName() = "Delete redundant extension property"
|
override fun getFamilyName() = "Delete redundant extension property"
|
||||||
override fun getText() = familyName
|
override fun getText() = familyName
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ class ConvertPropertyToFunctionIntention : SelfTargetingIntention<KtProperty>(Kt
|
|||||||
private val newName: String = JvmAbi.getterName(callableDescriptor.name.asString())
|
private val newName: String = JvmAbi.getterName(callableDescriptor.name.asString())
|
||||||
|
|
||||||
private fun convertProperty(originalProperty: KtProperty, psiFactory: KtPsiFactory) {
|
private fun convertProperty(originalProperty: KtProperty, psiFactory: KtPsiFactory) {
|
||||||
val property = originalProperty.copy() as KtProperty;
|
val property = originalProperty.copy() as KtProperty
|
||||||
val getter = property.getter;
|
val getter = property.getter
|
||||||
|
|
||||||
val sampleFunction = psiFactory.createFunction("fun foo() {\n\n}");
|
val sampleFunction = psiFactory.createFunction("fun foo() {\n\n}")
|
||||||
|
|
||||||
property.valOrVarKeyword.replace(sampleFunction.funKeyword!!);
|
property.valOrVarKeyword.replace(sampleFunction.funKeyword!!)
|
||||||
property.addAfter(psiFactory.createParameterList("()"), property.nameIdentifier);
|
property.addAfter(psiFactory.createParameterList("()"), property.nameIdentifier)
|
||||||
if (property.initializer == null) {
|
if (property.initializer == null) {
|
||||||
if (getter != null) {
|
if (getter != null) {
|
||||||
val dropGetterTo = (getter.equalsToken ?: getter.bodyExpression)
|
val dropGetterTo = (getter.equalsToken ?: getter.bodyExpression)
|
||||||
|
|||||||
+4
-4
@@ -73,11 +73,11 @@ class DoubleBangToIfThenIntention : SelfTargetingRangeIntention<KtPostfixExpress
|
|||||||
val exceptionLookupExpression = ChooseStringExpression(listOf(nullPtrExceptionText, kotlinNullPtrExceptionText))
|
val exceptionLookupExpression = ChooseStringExpression(listOf(nullPtrExceptionText, kotlinNullPtrExceptionText))
|
||||||
val project = element.project
|
val project = element.project
|
||||||
val builder = TemplateBuilderImpl(thrownExpression)
|
val builder = TemplateBuilderImpl(thrownExpression)
|
||||||
builder.replaceElement(thrownExpression, exceptionLookupExpression);
|
builder.replaceElement(thrownExpression, exceptionLookupExpression)
|
||||||
|
|
||||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||||
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.document);
|
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.document)
|
||||||
editor.caretModel.moveToOffset(thrownExpression.node!!.startOffset);
|
editor.caretModel.moveToOffset(thrownExpression.node!!.startOffset)
|
||||||
|
|
||||||
TemplateManager.getInstance(project).startTemplate(editor, builder.buildInlineTemplate(), object: TemplateEditingAdapter() {
|
TemplateManager.getInstance(project).startTemplate(editor, builder.buildInlineTemplate(), object: TemplateEditingAdapter() {
|
||||||
override fun templateFinished(template: Template?, brokenOff: Boolean) {
|
override fun templateFinished(template: Template?, brokenOff: Boolean) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ object KDocRenderer {
|
|||||||
to.append(", ")
|
to.append(", ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
to.append("</DD></DL></DD>");
|
to.append("</DD></DL></DD>")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderTagList(tags: List<KDocTag>, title: String, to: StringBuilder) {
|
private fun renderTagList(tags: List<KDocTag>, title: String, to: StringBuilder) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class RenameUnderscoreFix(declaration: KtDeclaration) : KotlinQuickFixAction<KtD
|
|||||||
if (editor == null) return
|
if (editor == null) return
|
||||||
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
||||||
val renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext)
|
val renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext)
|
||||||
renameHandler?.invoke(project, arrayOf(element), dataContext);
|
renameHandler?.invoke(project, arrayOf(element), dataContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
abstract class WholeProjectModalAction<TData : Any>(val title: String) : IntentionAction {
|
abstract class WholeProjectModalAction<TData : Any>(val title: String) : IntentionAction {
|
||||||
private val LOG = Logger.getInstance(WholeProjectModalAction::class.java);
|
private val LOG = Logger.getInstance(WholeProjectModalAction::class.java)
|
||||||
|
|
||||||
override final fun startInWriteAction() = false
|
override final fun startInWriteAction() = false
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -87,7 +87,7 @@ class TypeCandidate(val theType: KotlinType, scope: HierarchicalScope? = null) {
|
|||||||
private set
|
private set
|
||||||
|
|
||||||
fun render(typeParameterNameMap: Map<TypeParameterDescriptor, String>, fakeFunction: FunctionDescriptor?) {
|
fun render(typeParameterNameMap: Map<TypeParameterDescriptor, String>, fakeFunction: FunctionDescriptor?) {
|
||||||
renderedType = theType.renderShort(typeParameterNameMap);
|
renderedType = theType.renderShort(typeParameterNameMap)
|
||||||
renderedTypeParameters = typeParameters.map {
|
renderedTypeParameters = typeParameters.map {
|
||||||
RenderedTypeParameter(it, it.containingDeclaration == fakeFunction, typeParameterNameMap[it]!!)
|
RenderedTypeParameter(it, it.containingDeclaration == fakeFunction, typeParameterNameMap[it]!!)
|
||||||
}
|
}
|
||||||
@@ -97,10 +97,10 @@ class TypeCandidate(val theType: KotlinType, scope: HierarchicalScope? = null) {
|
|||||||
val typeParametersInType = theType.getTypeParameters()
|
val typeParametersInType = theType.getTypeParameters()
|
||||||
if (scope == null) {
|
if (scope == null) {
|
||||||
typeParameters = typeParametersInType.toTypedArray()
|
typeParameters = typeParametersInType.toTypedArray()
|
||||||
renderedType = theType.renderShort(Collections.emptyMap());
|
renderedType = theType.renderShort(Collections.emptyMap())
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
typeParameters = getTypeParameterNamesNotInScope(typeParametersInType, scope).toTypedArray();
|
typeParameters = getTypeParameterNamesNotInScope(typeParametersInType, scope).toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +874,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
}
|
}
|
||||||
modifierList.setModifierProperty(PsiModifier.STATIC, needStatic)
|
modifierList.setModifierProperty(PsiModifier.STATIC, needStatic)
|
||||||
|
|
||||||
JavaCodeStyleManager.getInstance(project).shortenClassReferences(newJavaMember);
|
JavaCodeStyleManager.getInstance(project).shortenClassReferences(newJavaMember)
|
||||||
|
|
||||||
val descriptor = OpenFileDescriptor(project, targetClass.containingFile.virtualFile)
|
val descriptor = OpenFileDescriptor(project, targetClass.containingFile.virtualFile)
|
||||||
val targetEditor = FileEditorManager.getInstance(project).openTextEditor(descriptor, true)!!
|
val targetEditor = FileEditorManager.getInstance(project).openTextEditor(descriptor, true)!!
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ class DeprecatedSymbolUsageInWholeProjectFix(
|
|||||||
private val text: String
|
private val text: String
|
||||||
) : DeprecatedSymbolUsageFixBase(element, replaceWith) {
|
) : DeprecatedSymbolUsageFixBase(element, replaceWith) {
|
||||||
|
|
||||||
private val LOG = Logger.getInstance(DeprecatedSymbolUsageInWholeProjectFix::class.java);
|
private val LOG = Logger.getInstance(DeprecatedSymbolUsageInWholeProjectFix::class.java)
|
||||||
|
|
||||||
override fun getFamilyName() = "Replace deprecated symbol usage in whole project"
|
override fun getFamilyName() = "Replace deprecated symbol usage in whole project"
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ open class KotlinChangeInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun removeParameter(index: Int) {
|
fun removeParameter(index: Int) {
|
||||||
val parameterInfo = newParameters.removeAt(index);
|
val parameterInfo = newParameters.removeAt(index)
|
||||||
if (parameterInfo == receiverParameterInfo) {
|
if (parameterInfo == receiverParameterInfo) {
|
||||||
receiverParameterInfo = null
|
receiverParameterInfo = null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -160,7 +160,7 @@ class KotlinChangeSignatureData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun canChangeVisibility(): Boolean {
|
override fun canChangeVisibility(): Boolean {
|
||||||
if (DescriptorUtils.isLocal(baseDescriptor)) return false;
|
if (DescriptorUtils.isLocal(baseDescriptor)) return false
|
||||||
val parent = baseDescriptor.containingDeclaration
|
val parent = baseDescriptor.containingDeclaration
|
||||||
return !(baseDescriptor is AnonymousFunctionDescriptor || parent is ClassDescriptor && parent.kind == ClassKind.INTERFACE)
|
return !(baseDescriptor is AnonymousFunctionDescriptor || parent is ClassDescriptor && parent.kind == ClassKind.INTERFACE)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -385,7 +385,7 @@ class KotlinChangeSignatureDialog(
|
|||||||
methodName,
|
methodName,
|
||||||
myDefaultValueContext,
|
myDefaultValueContext,
|
||||||
false)
|
false)
|
||||||
changeInfo.primaryPropagationTargets = myMethodsToPropagateParameters ?: emptyList();
|
changeInfo.primaryPropagationTargets = myMethodsToPropagateParameters ?: emptyList()
|
||||||
return KotlinChangeSignatureProcessor(myProject, changeInfo, commandName ?: title)
|
return KotlinChangeSignatureProcessor(myProject, changeInfo, commandName ?: title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -266,7 +266,7 @@ private fun makeCall(
|
|||||||
anchor.nextSibling?.let { from ->
|
anchor.nextSibling?.let { from ->
|
||||||
val to = rangeToReplace.endElement
|
val to = rangeToReplace.endElement
|
||||||
if (to != anchor) {
|
if (to != anchor) {
|
||||||
anchorParent.deleteChildRange(from, to);
|
anchorParent.deleteChildRange(from, to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -165,7 +165,7 @@ fun IntroduceParameterDescriptor.performRefactoring() {
|
|||||||
override fun performSilently(affectedFunctions: Collection<PsiElement>): Boolean = true
|
override fun performSilently(affectedFunctions: Collection<PsiElement>): Boolean = true
|
||||||
}
|
}
|
||||||
|
|
||||||
val project = callable.project;
|
val project = callable.project
|
||||||
val changeSignature = { runChangeSignature(project, callableDescriptor, config, callable, INTRODUCE_PARAMETER) }
|
val changeSignature = { runChangeSignature(project, callableDescriptor, config, callable, INTRODUCE_PARAMETER) }
|
||||||
changeSignature.runRefactoringWithPostprocessing(project, "refactoring.changeSignature") {
|
changeSignature.runRefactoringWithPostprocessing(project, "refactoring.changeSignature") {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ fun <T, E: PsiElement> getPsiElementPopup(
|
|||||||
}
|
}
|
||||||
addListener(object: JBPopupAdapter() {
|
addListener(object: JBPopupAdapter() {
|
||||||
override fun onClosed(event: LightweightWindowEvent?) {
|
override fun onClosed(event: LightweightWindowEvent?) {
|
||||||
highlighter?.dropHighlight();
|
highlighter?.dropHighlight()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class KotlinMemberSelectionTable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun setVisibilityIcon(memberInfo: KotlinMemberInfo, icon: RowIcon) {
|
override fun setVisibilityIcon(memberInfo: KotlinMemberInfo, icon: RowIcon) {
|
||||||
icon.setIcon(KotlinIconProvider.getVisibilityIcon(memberInfo.member.modifierList), 1);
|
icon.setIcon(KotlinIconProvider.getVisibilityIcon(memberInfo.member.modifierList), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getOverrideIcon(memberInfo: KotlinMemberInfo): Icon? {
|
override fun getOverrideIcon(memberInfo: KotlinMemberInfo): Icon? {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring.move.changePackage;
|
package org.jetbrains.kotlin.idea.refactoring.move.changePackage
|
||||||
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||||
import com.intellij.codeInsight.template.*
|
import com.intellij.codeInsight.template.*
|
||||||
|
|||||||
+1
-1
@@ -95,7 +95,7 @@ sealed class MoveDeclarationsDelegate {
|
|||||||
) {
|
) {
|
||||||
val usageIterator = usages.iterator()
|
val usageIterator = usages.iterator()
|
||||||
while (usageIterator.hasNext()) {
|
while (usageIterator.hasNext()) {
|
||||||
val usage = usageIterator.next();
|
val usage = usageIterator.next()
|
||||||
val element = usage.element ?: continue
|
val element = usage.element ?: continue
|
||||||
|
|
||||||
val isConflict = when (usage) {
|
val isConflict = when (usage) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class RenameDynamicMemberHandler: VariableInplaceRenameHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to dynamically invoked members", "Rename", null);
|
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to dynamically invoked members", "Rename", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea.refactoring.rename;
|
package org.jetbrains.kotlin.idea.refactoring.rename
|
||||||
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
|||||||
+2
-2
@@ -42,13 +42,13 @@ class RenameOnSecondaryConstructorHandler : RenameHandler {
|
|||||||
file, editor.caretModel.offset, KtSecondaryConstructor::class.java, false,
|
file, editor.caretModel.offset, KtSecondaryConstructor::class.java, false,
|
||||||
KtBlockExpression::class.java, KtValueArgumentList::class.java, KtParameterList::class.java
|
KtBlockExpression::class.java, KtValueArgumentList::class.java, KtParameterList::class.java
|
||||||
)
|
)
|
||||||
return element != null;
|
return element != null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isRenaming(dataContext: DataContext?): Boolean = isAvailableOnDataContext(dataContext)
|
override fun isRenaming(dataContext: DataContext?): Boolean = isAvailableOnDataContext(dataContext)
|
||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to secondary constructors", "Rename", null);
|
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to secondary constructors", "Rename", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() {
|
|||||||
val virtualFile = file.virtualFile
|
val virtualFile = file.virtualFile
|
||||||
|
|
||||||
val runnable = {
|
val runnable = {
|
||||||
var offset = -1;
|
var offset = -1
|
||||||
while (true) {
|
while (true) {
|
||||||
val fileText = document.text
|
val fileText = document.text
|
||||||
offset = fileText.indexOf("point!", offset + 1)
|
offset = fileText.indexOf("point!", offset + 1)
|
||||||
|
|||||||
+1
-1
@@ -217,7 +217,7 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestBase() {
|
|||||||
Printer(config).printTree(tree)
|
Printer(config).printTree(tree)
|
||||||
|
|
||||||
for (extra in getExtraVars()) {
|
for (extra in getExtraVars()) {
|
||||||
watchesView.addWatchExpression(XExpressionImpl.fromText(extra.text), -1, false);
|
watchesView.addWatchExpression(XExpressionImpl.fromText(extra.text), -1, false)
|
||||||
}
|
}
|
||||||
Printer(config).printTree(watchesView.tree)
|
Printer(config).printTree(watchesView.tree)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -56,5 +56,5 @@ abstract class AbstractSelectExpressionForDebuggerTest : LightCodeInsightFixture
|
|||||||
|
|
||||||
override fun getProjectDescriptor() = KotlinLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor() = KotlinLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/debugger/selectExpression";
|
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/debugger/selectExpression"
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user