Minor: fix warnings

This commit is contained in:
Natalia Ukhorskaya
2015-04-27 19:03:40 +03:00
parent 68603d188b
commit 4848af5ef6
2 changed files with 14 additions and 14 deletions
@@ -30,6 +30,7 @@ import com.intellij.psi.impl.PsiModificationTrackerImpl
import com.intellij.psi.util.PsiModificationTracker
import org.jetbrains.kotlin.types.JetType
import java.util.LinkedHashSet
import java.util.regex.Pattern
public abstract class JetCodeFragment(
private val _project: Project,
@@ -96,7 +97,7 @@ public abstract class JetCodeFragment(
}
override fun importsToString(): String {
return myImports.join(IMPORT_SEPARATOR)
return myImports.join(IMPORT_SEPARATOR.pattern())
}
override fun addImportsFromString(imports: String?) {
@@ -148,7 +149,7 @@ public abstract class JetCodeFragment(
}
companion object {
public val IMPORT_SEPARATOR: String = ","
public val IMPORT_SEPARATOR: Pattern = ",".toRegex()
public val RUNTIME_TYPE_EVALUATOR: Key<Function1<JetExpression, JetType?>> = Key.create("RUNTIME_TYPE_EVALUATOR")
}
}
@@ -100,15 +100,15 @@ object KotlinEvaluationBuilder: EvaluatorBuilder {
}
if (codeFragment.getContext() !is JetElement) {
val attachments = array(attachmentByPsiFile(position.getFile()),
attachmentByPsiFile(codeFragment),
Attachment("breakpoint.info", "line: ${position.getLine()}"))
val attachments = arrayOf(attachmentByPsiFile(position.getFile()),
attachmentByPsiFile(codeFragment),
Attachment("breakpoint.info", "line: ${position.getLine()}"))
logger.error("Trying to evaluate ${codeFragment.javaClass} with context ${codeFragment.getContext()?.javaClass}", mergeAttachments(*attachments))
throw EvaluateExceptionUtil.createEvaluateException("Couldn't evaluate kotlin expression in this context")
}
return ExpressionEvaluatorImpl(KotlinEvaluator(codeFragment as JetCodeFragment, position))
return ExpressionEvaluatorImpl(KotlinEvaluator(codeFragment, position))
}
}
@@ -150,9 +150,9 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment,
exception(DebuggerBundle.message("error.vm.disconnected"))
}
catch (e: Exception) {
val attachments = array(attachmentByPsiFile(sourcePosition.getFile()),
attachmentByPsiFile(codeFragment),
Attachment("breakpoint.info", "line: ${sourcePosition.getLine()}"))
val attachments = arrayOf(attachmentByPsiFile(sourcePosition.getFile()),
attachmentByPsiFile(codeFragment),
Attachment("breakpoint.info", "line: ${sourcePosition.getLine()}"))
logger.error("Couldn't evaluate expression:\n" + ExceptionUtil.getThrowableText(e), mergeAttachments(*attachments))
val cause = if (e.getMessage() != null) ": ${e.getMessage()}" else ""
@@ -176,8 +176,7 @@ class KotlinEvaluator(val codeFragment: JetCodeFragment,
val classFileFactory = createClassFileFactory(codeFragment, extractedFunction, context)
// KT-4509
val outputFiles = (classFileFactory : OutputFileCollection).asList()
val outputFiles = classFileFactory.asList()
.filter { it.relativePath != "$packageInternalName.class" }
.sortBy { it.relativePath.length() }
@@ -588,9 +587,9 @@ fun EvaluationContextImpl.findLocalVariable(name: String, asmType: Type?, checkT
var thisObj: Value? = thisObject.asValue()
while (result == null && thisObj != null) {
result = getField(thisObj!!, name, asmType, checkType)
result = getField(thisObj, name, asmType, checkType)
if (result == null) {
thisObj = getField(thisObj!!, AsmUtil.CAPTURED_THIS_FIELD, null, false)
thisObj = getField(thisObj, AsmUtil.CAPTURED_THIS_FIELD, null, false)
}
}
return result
@@ -626,7 +625,7 @@ fun Type.getClassDescriptor(project: Project): ClassDescriptor? {
val jvmName = JvmClassName.byInternalName(getInternalName()).getFqNameForClassNameWithoutDollars()
val platformClasses = JavaToKotlinClassMap.INSTANCE.mapPlatformClass(jvmName)
if (platformClasses.notEmpty) return platformClasses.first()
if (platformClasses.isNotEmpty()) return platformClasses.first()
return runReadAction {
val classes = JavaPsiFacade.getInstance(project).findClasses(jvmName.asString(), GlobalSearchScope.allScope(project))